@easyquery/core 7.1.3-beta02 → 7.2.0-rc01
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/bundles/easyquery.core.js +214 -185
- package/dist/bundles/easyquery.core.js.map +1 -1
- package/dist/bundles/easyquery.core.min.js +1 -2
- package/dist/bundles/easyquery.core.min.js.map +1 -1
- package/dist/lib/common/eq_services.js +1 -1
- package/dist/lib/common/eq_services.js.map +1 -1
- package/dist/lib/data/eq_aggr_container.d.ts +8 -4
- package/dist/lib/data/eq_aggr_container.js +30 -16
- package/dist/lib/data/eq_aggr_container.js.map +1 -1
- package/dist/lib/data/eq_data_loader.js +0 -1
- package/dist/lib/data/eq_data_loader.js.map +1 -1
- package/dist/lib/eqs/eqs_exporter.js +2 -2
- package/dist/lib/eqs/eqs_exporter.js.map +1 -1
- package/dist/lib/eqs/eqs_query_file_loader.js +2 -2
- package/dist/lib/eqs/eqs_query_file_loader.js.map +1 -1
- package/dist/lib/main/context.d.ts +2 -0
- package/dist/lib/main/context.js +41 -35
- package/dist/lib/main/context.js.map +1 -1
- package/dist/lib/main/context_options.d.ts +1 -2
- package/dist/lib/main/widget.d.ts +1 -1
- package/dist/lib/query/condition.d.ts +3 -2
- package/dist/lib/query/expression.d.ts +1 -1
- package/dist/lib/query/query.d.ts +2 -1
- package/dist/lib/query/query.js +15 -16
- package/dist/lib/query/query.js.map +1 -1
- package/dist/lib/query/query_column.d.ts +1 -1
- package/dist/lib/types/eq_editor_tag.js +1 -1
- package/dist/lib/types/eq_editor_tag.js.map +1 -1
- package/dist/lib/utils/constants.d.ts +4 -3
- package/package.json +4 -5
- package/dist/bundles/easyquery.core.min.js.LICENSE.txt +0 -1
|
@@ -766,7 +766,7 @@ var i18n_i18n;
|
|
|
766
766
|
var utils_utils;
|
|
767
767
|
(function (utils) {
|
|
768
768
|
function getAllDataTypes() {
|
|
769
|
-
return Object.values(DataType);
|
|
769
|
+
return Object.values(DataType).filter(function (item) { return typeof item === "number"; });
|
|
770
770
|
}
|
|
771
771
|
utils.getAllDataTypes = getAllDataTypes;
|
|
772
772
|
function getDateDataTypes() {
|
|
@@ -774,12 +774,16 @@ var utils_utils;
|
|
|
774
774
|
}
|
|
775
775
|
utils.getDateDataTypes = getDateDataTypes;
|
|
776
776
|
function getStringDataTypes() {
|
|
777
|
-
return [DataType.String, DataType.Memo];
|
|
777
|
+
return [DataType.String, DataType.Memo, DataType.FixedChar];
|
|
778
778
|
}
|
|
779
779
|
utils.getStringDataTypes = getStringDataTypes;
|
|
780
780
|
var _numericTypes = [DataType.Byte, DataType.Word, DataType.Int32,
|
|
781
|
-
DataType.Int64, DataType.Float, DataType.Currency];
|
|
782
|
-
|
|
781
|
+
DataType.Int64, DataType.Float, DataType.Currency, DataType.Autoinc];
|
|
782
|
+
function getNumericDataTypes() {
|
|
783
|
+
return _numericTypes;
|
|
784
|
+
}
|
|
785
|
+
utils.getNumericDataTypes = getNumericDataTypes;
|
|
786
|
+
var _intTypes = [DataType.Byte, DataType.Word, DataType.Int32, DataType.Int64, DataType.Autoinc];
|
|
783
787
|
//-------------- object functions -------------------
|
|
784
788
|
/**
|
|
785
789
|
* Copy the content of all objests passed in `args` parameters into `target`
|
|
@@ -844,7 +848,7 @@ var utils_utils;
|
|
|
844
848
|
hashSet.set(sourceVal, target[key]);
|
|
845
849
|
}
|
|
846
850
|
else {
|
|
847
|
-
if (typeof target[key] == 'undefined') {
|
|
851
|
+
if (typeof target[key] == 'undefined' || target[key] == null) {
|
|
848
852
|
target[key] = Object.create(Object.getPrototypeOf(sourceVal));
|
|
849
853
|
}
|
|
850
854
|
hashSet.set(sourceVal, target[key]);
|
|
@@ -1373,7 +1377,7 @@ var http_client_HttpClient = /** @class */ (function () {
|
|
|
1373
1377
|
var desc = {
|
|
1374
1378
|
method: method,
|
|
1375
1379
|
url: url,
|
|
1376
|
-
headers: __assign({}, this.defaultHeaders, options.headers || {}),
|
|
1380
|
+
headers: __assign(__assign({}, this.defaultHeaders), options.headers || {}),
|
|
1377
1381
|
queryParams: options.queryParams || {},
|
|
1378
1382
|
data: data
|
|
1379
1383
|
};
|
|
@@ -1519,6 +1523,12 @@ var MetaEntity = /** @class */ (function () {
|
|
|
1519
1523
|
};
|
|
1520
1524
|
internalProcessEntity(this);
|
|
1521
1525
|
};
|
|
1526
|
+
MetaEntity.prototype.getFirstPrimaryAttr = function () {
|
|
1527
|
+
return this.getPrimaryAttrs()[0];
|
|
1528
|
+
};
|
|
1529
|
+
MetaEntity.prototype.getPrimaryAttrs = function () {
|
|
1530
|
+
return this.attributes.filter(function (attr) { return attr.isPrimaryKey; });
|
|
1531
|
+
};
|
|
1522
1532
|
return MetaEntity;
|
|
1523
1533
|
}());
|
|
1524
1534
|
|
|
@@ -2137,9 +2147,9 @@ var meta_data_MetaData = /** @class */ (function () {
|
|
|
2137
2147
|
}());
|
|
2138
2148
|
|
|
2139
2149
|
//# sourceMappingURL=meta_data.js.map
|
|
2140
|
-
// CONCATENATED MODULE: c:/azuredevops-agents/korzhdev/_work/1/s/easydata/easydata.js/packs/core/dist/lib/data/
|
|
2141
|
-
var
|
|
2142
|
-
|
|
2150
|
+
// CONCATENATED MODULE: c:/azuredevops-agents/korzhdev/_work/1/s/easydata/easydata.js/packs/core/dist/lib/data/aggr_settings.js
|
|
2151
|
+
var aggr_settings_assign = (undefined && undefined.__assign) || function () {
|
|
2152
|
+
aggr_settings_assign = Object.assign || function(t) {
|
|
2143
2153
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
2144
2154
|
s = arguments[i];
|
|
2145
2155
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
@@ -2147,7 +2157,7 @@ var aggr_calculator_assign = (undefined && undefined.__assign) || function () {
|
|
|
2147
2157
|
}
|
|
2148
2158
|
return t;
|
|
2149
2159
|
};
|
|
2150
|
-
return
|
|
2160
|
+
return aggr_settings_assign.apply(this, arguments);
|
|
2151
2161
|
};
|
|
2152
2162
|
/**
|
|
2153
2163
|
* Defines aggregations settings for the current context.
|
|
@@ -2160,16 +2170,32 @@ var AggregationSettings = /** @class */ (function () {
|
|
|
2160
2170
|
this.groups = [];
|
|
2161
2171
|
this.useGrandTotals = false;
|
|
2162
2172
|
this.useRecordCount = false;
|
|
2163
|
-
this.
|
|
2173
|
+
this._caseSensitiveGroups = false;
|
|
2164
2174
|
this.COUNT_FIELD_NAME = 'GRPRECCNT';
|
|
2165
2175
|
}
|
|
2176
|
+
Object.defineProperty(AggregationSettings.prototype, "caseSensitiveGroups", {
|
|
2177
|
+
get: function () {
|
|
2178
|
+
return this._caseSensitiveGroups;
|
|
2179
|
+
},
|
|
2180
|
+
set: function (value) {
|
|
2181
|
+
this._caseSensitiveGroups = value;
|
|
2182
|
+
this.updateCompareProc();
|
|
2183
|
+
},
|
|
2184
|
+
enumerable: true,
|
|
2185
|
+
configurable: true
|
|
2186
|
+
});
|
|
2187
|
+
AggregationSettings.prototype.updateCompareProc = function () {
|
|
2188
|
+
this.compareValues = this._caseSensitiveGroups
|
|
2189
|
+
? this.strictCompare
|
|
2190
|
+
: this.caseInsensitiveCompare;
|
|
2191
|
+
};
|
|
2166
2192
|
AggregationSettings.prototype.addGroup = function (settings) {
|
|
2167
2193
|
var cols = settings.columns || this.colStore.getColumnIds(settings.from, settings.to);
|
|
2168
2194
|
if (!this.colStore.validateColumns(cols))
|
|
2169
2195
|
throw "Invalid columns: " + cols;
|
|
2170
2196
|
if (this.hasColumnsInUse(cols))
|
|
2171
2197
|
throw "Can't add same columns to different groups/aggregates";
|
|
2172
|
-
this.groups.push(
|
|
2198
|
+
this.groups.push(aggr_settings_assign({ columns: cols }, settings));
|
|
2173
2199
|
return this;
|
|
2174
2200
|
};
|
|
2175
2201
|
AggregationSettings.prototype.addAggregateColumn = function (colIndexOrId, funcId) {
|
|
@@ -2194,7 +2220,7 @@ var AggregationSettings = /** @class */ (function () {
|
|
|
2194
2220
|
var cols = [];
|
|
2195
2221
|
var mappedGrops = this.groups.map(function (grp) {
|
|
2196
2222
|
cols = cols.concat(grp.columns);
|
|
2197
|
-
return
|
|
2223
|
+
return aggr_settings_assign(aggr_settings_assign({}, grp), { columns: Array.from(cols), aggregates: Array.from(_this.aggregates) });
|
|
2198
2224
|
});
|
|
2199
2225
|
return mappedGrops;
|
|
2200
2226
|
};
|
|
@@ -2286,10 +2312,35 @@ var AggregationSettings = /** @class */ (function () {
|
|
|
2286
2312
|
}
|
|
2287
2313
|
}
|
|
2288
2314
|
};
|
|
2315
|
+
AggregationSettings.prototype.buildGroupKey = function (group, row) {
|
|
2316
|
+
var caseInsensitive = !this.caseSensitiveGroups;
|
|
2317
|
+
var result = {};
|
|
2318
|
+
if (group) {
|
|
2319
|
+
for (var _i = 0, _a = group.columns; _i < _a.length; _i++) {
|
|
2320
|
+
var colId = _a[_i];
|
|
2321
|
+
var keyVal = row.getValue(colId);
|
|
2322
|
+
if (caseInsensitive && typeof (keyVal) === 'string') {
|
|
2323
|
+
keyVal = keyVal.toLowerCase();
|
|
2324
|
+
}
|
|
2325
|
+
result[colId] = keyVal;
|
|
2326
|
+
}
|
|
2327
|
+
}
|
|
2328
|
+
return result;
|
|
2329
|
+
};
|
|
2330
|
+
//returns true if value1 == value2
|
|
2331
|
+
AggregationSettings.prototype.strictCompare = function (value1, value2) {
|
|
2332
|
+
return value1 === value2;
|
|
2333
|
+
};
|
|
2334
|
+
//makes a case insensative comparision of two values and return true if there are equal
|
|
2335
|
+
AggregationSettings.prototype.caseInsensitiveCompare = function (value1, value2) {
|
|
2336
|
+
var val1 = (typeof value1 === 'string') ? value1.toLowerCase() : value1;
|
|
2337
|
+
var val2 = (typeof value2 === 'string') ? value2.toLowerCase() : value2;
|
|
2338
|
+
return val1 === val2;
|
|
2339
|
+
};
|
|
2289
2340
|
return AggregationSettings;
|
|
2290
2341
|
}());
|
|
2291
2342
|
|
|
2292
|
-
//# sourceMappingURL=
|
|
2343
|
+
//# sourceMappingURL=aggr_settings.js.map
|
|
2293
2344
|
// CONCATENATED MODULE: c:/azuredevops-agents/korzhdev/_work/1/s/easydata/easydata.js/packs/core/dist/lib/data/data_column.js
|
|
2294
2345
|
|
|
2295
2346
|
|
|
@@ -2317,6 +2368,7 @@ var data_column_DataColumn = /** @class */ (function () {
|
|
|
2317
2368
|
this.groupFooterColumnTemplate = desc.gfct;
|
|
2318
2369
|
this.style = desc.style || {};
|
|
2319
2370
|
this.description = desc.description;
|
|
2371
|
+
this.calculatedWidth = 0;
|
|
2320
2372
|
}
|
|
2321
2373
|
return DataColumn;
|
|
2322
2374
|
}());
|
|
@@ -2356,9 +2408,10 @@ var data_column_DataColumnList = /** @class */ (function () {
|
|
|
2356
2408
|
.map(function (col, index) { return index; });
|
|
2357
2409
|
};
|
|
2358
2410
|
DataColumnList.prototype.put = function (index, col) {
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2411
|
+
if (index >= 0 && index < this.count) {
|
|
2412
|
+
this.items[index] = col;
|
|
2413
|
+
this.updateDateColumnIdx();
|
|
2414
|
+
}
|
|
2362
2415
|
};
|
|
2363
2416
|
DataColumnList.prototype.move = function (col, newIndex) {
|
|
2364
2417
|
var oldIndex = this.items.indexOf(col);
|
|
@@ -2368,8 +2421,12 @@ var data_column_DataColumnList = /** @class */ (function () {
|
|
|
2368
2421
|
}
|
|
2369
2422
|
};
|
|
2370
2423
|
DataColumnList.prototype.get = function (index) {
|
|
2371
|
-
|
|
2372
|
-
|
|
2424
|
+
if (index >= 0 && index < this.count) {
|
|
2425
|
+
return this.items[index];
|
|
2426
|
+
}
|
|
2427
|
+
else {
|
|
2428
|
+
return null;
|
|
2429
|
+
}
|
|
2373
2430
|
};
|
|
2374
2431
|
DataColumnList.prototype.getIndex = function (id) {
|
|
2375
2432
|
return this.mapper[id];
|
|
@@ -2453,16 +2510,23 @@ var easy_data_table_EasyDataTable = /** @class */ (function () {
|
|
|
2453
2510
|
function EasyDataTable(options) {
|
|
2454
2511
|
this._chunkSize = 1000;
|
|
2455
2512
|
this._elasticChunks = false;
|
|
2456
|
-
|
|
2457
|
-
this.chunkMap = {};
|
|
2513
|
+
this.cachedRows = [];
|
|
2458
2514
|
this.total = 0;
|
|
2459
2515
|
this.loader = null;
|
|
2460
2516
|
this.needTotal = true;
|
|
2517
|
+
this.isInMemory = false;
|
|
2461
2518
|
options = options || {};
|
|
2462
2519
|
this._chunkSize = options.chunkSize || this._chunkSize;
|
|
2463
2520
|
this._elasticChunks = options.elasticChunks || this._elasticChunks;
|
|
2464
2521
|
this.loader = options.loader;
|
|
2522
|
+
if (typeof options.inMemory !== 'undefined') {
|
|
2523
|
+
this.isInMemory = options.inMemory;
|
|
2524
|
+
}
|
|
2525
|
+
if (this.isInMemory) {
|
|
2526
|
+
this.needTotal = false;
|
|
2527
|
+
}
|
|
2465
2528
|
this._columns = new data_column_DataColumnList();
|
|
2529
|
+
this.onUpdate = options.onUpdate;
|
|
2466
2530
|
if (options.columns) {
|
|
2467
2531
|
for (var _i = 0, _a = options.columns; _i < _a.length; _i++) {
|
|
2468
2532
|
var colDesc = _a[_i];
|
|
@@ -2493,7 +2557,7 @@ var easy_data_table_EasyDataTable = /** @class */ (function () {
|
|
|
2493
2557
|
this._chunkSize = value;
|
|
2494
2558
|
this.total = 0;
|
|
2495
2559
|
this.needTotal = !this.elasticChunks;
|
|
2496
|
-
this.
|
|
2560
|
+
this.cachedRows = [];
|
|
2497
2561
|
},
|
|
2498
2562
|
enumerable: true,
|
|
2499
2563
|
configurable: true
|
|
@@ -2506,7 +2570,7 @@ var easy_data_table_EasyDataTable = /** @class */ (function () {
|
|
|
2506
2570
|
this._elasticChunks = value;
|
|
2507
2571
|
this.total = 0;
|
|
2508
2572
|
this.needTotal = !this.elasticChunks;
|
|
2509
|
-
this.
|
|
2573
|
+
this.cachedRows = [];
|
|
2510
2574
|
},
|
|
2511
2575
|
enumerable: true,
|
|
2512
2576
|
configurable: true
|
|
@@ -2534,22 +2598,12 @@ var easy_data_table_EasyDataTable = /** @class */ (function () {
|
|
|
2534
2598
|
endIndex = this.total;
|
|
2535
2599
|
}
|
|
2536
2600
|
}
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
var allChunksCached = true;
|
|
2540
|
-
for (var i = lbChunk; i <= ubChunk; i++) {
|
|
2541
|
-
if (!this.chunkMap[i]) {
|
|
2542
|
-
allChunksCached = false;
|
|
2543
|
-
break;
|
|
2544
|
-
}
|
|
2601
|
+
if (this.isInMemory && endIndex > this.cachedRows.length) {
|
|
2602
|
+
endIndex = this.cachedRows.length;
|
|
2545
2603
|
}
|
|
2604
|
+
var allChunksCached = endIndex <= this.cachedRows.length;
|
|
2546
2605
|
if (allChunksCached) {
|
|
2547
|
-
|
|
2548
|
-
for (var i = lbChunk; i <= ubChunk; i++) {
|
|
2549
|
-
resultArr = resultArr.concat(this.chunkMap[i].rows);
|
|
2550
|
-
}
|
|
2551
|
-
var firstChunkOffset = this.chunkMap[lbChunk].offset;
|
|
2552
|
-
return Promise.resolve(resultArr.slice(fromIndex - firstChunkOffset, endIndex - firstChunkOffset));
|
|
2606
|
+
return Promise.resolve(this.cachedRows.slice(fromIndex, endIndex));
|
|
2553
2607
|
}
|
|
2554
2608
|
//if loader is not defined
|
|
2555
2609
|
if (!this.loader) {
|
|
@@ -2560,53 +2614,34 @@ var easy_data_table_EasyDataTable = /** @class */ (function () {
|
|
|
2560
2614
|
if (this.needTotal) {
|
|
2561
2615
|
this.needTotal = false;
|
|
2562
2616
|
}
|
|
2563
|
-
var
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2617
|
+
var offset = this.cachedRows.length;
|
|
2618
|
+
var limit = endIndex - offset;
|
|
2619
|
+
if (limit < this._chunkSize) {
|
|
2620
|
+
limit = this._chunkSize;
|
|
2621
|
+
}
|
|
2622
|
+
var resultPromise = this.loader.loadChunk({
|
|
2623
|
+
offset: offset,
|
|
2568
2624
|
limit: limit,
|
|
2569
2625
|
needTotal: needTotal
|
|
2570
2626
|
})
|
|
2571
2627
|
.then(function (result) {
|
|
2572
|
-
var chunks = result.table.getCachedChunks();
|
|
2573
2628
|
if (needTotal) {
|
|
2574
2629
|
_this.total = result.total;
|
|
2575
|
-
if (endIndex > _this.total) {
|
|
2576
|
-
endIndex = _this.total;
|
|
2577
|
-
}
|
|
2578
2630
|
}
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
_this.chunkMap[index] = {
|
|
2583
|
-
offset: index * _this._chunkSize,
|
|
2584
|
-
rows: chunk.rows
|
|
2585
|
-
};
|
|
2586
|
-
index++;
|
|
2631
|
+
Array.prototype.push.apply(_this.cachedRows, result.table.getCachedRows());
|
|
2632
|
+
if (endIndex > _this.cachedRows.length) {
|
|
2633
|
+
endIndex = _this.cachedRows.length;
|
|
2587
2634
|
}
|
|
2588
2635
|
if (_this.elasticChunks) {
|
|
2589
2636
|
var count_1 = result.table.getCachedCount();
|
|
2590
|
-
if (count_1
|
|
2591
|
-
|
|
2592
|
-
if (count_1 === limit) {
|
|
2593
|
-
chunk.rows.splice(chunk.rows.length - 1, 1);
|
|
2594
|
-
if (chunk.rows.length == 0) {
|
|
2595
|
-
delete _this.chunkMap[index - 1];
|
|
2596
|
-
}
|
|
2597
|
-
}
|
|
2598
|
-
if (count_1 < limit) {
|
|
2599
|
-
_this.total = _this.getCachedCount();
|
|
2600
|
-
}
|
|
2637
|
+
if (count_1 < limit) {
|
|
2638
|
+
_this.total = _this.cachedRows.length;
|
|
2601
2639
|
}
|
|
2602
2640
|
}
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
resultArr = resultArr.concat(_this.chunkMap[i].rows);
|
|
2606
|
-
}
|
|
2607
|
-
var firstChunkOffset = _this.chunkMap[lbChunk].offset;
|
|
2608
|
-
return resultArr.slice(fromIndex - firstChunkOffset, endIndex - firstChunkOffset);
|
|
2641
|
+
_this.fireUpdated();
|
|
2642
|
+
return _this.cachedRows.slice(fromIndex, endIndex);
|
|
2609
2643
|
});
|
|
2644
|
+
return resultPromise;
|
|
2610
2645
|
};
|
|
2611
2646
|
EasyDataTable.prototype.getRow = function (index) {
|
|
2612
2647
|
return this.getRows({ offset: index, limit: 1 })
|
|
@@ -2618,14 +2653,13 @@ var easy_data_table_EasyDataTable = /** @class */ (function () {
|
|
|
2618
2653
|
EasyDataTable.prototype.setTotal = function (total) {
|
|
2619
2654
|
this.total = total;
|
|
2620
2655
|
this.needTotal = false;
|
|
2621
|
-
this.chunkMap = {};
|
|
2622
2656
|
};
|
|
2623
2657
|
EasyDataTable.prototype.getCachedCount = function () {
|
|
2624
|
-
return this.
|
|
2658
|
+
return this.cachedRows.length;
|
|
2625
2659
|
};
|
|
2626
2660
|
EasyDataTable.prototype.clear = function () {
|
|
2627
2661
|
this.columns.clear();
|
|
2628
|
-
this.
|
|
2662
|
+
this.cachedRows = [];
|
|
2629
2663
|
this.total = 0;
|
|
2630
2664
|
this.needTotal = !this._elasticChunks;
|
|
2631
2665
|
};
|
|
@@ -2658,60 +2692,33 @@ var easy_data_table_EasyDataTable = /** @class */ (function () {
|
|
|
2658
2692
|
}
|
|
2659
2693
|
return null;
|
|
2660
2694
|
};
|
|
2661
|
-
EasyDataTable.prototype.addRow = function (
|
|
2695
|
+
EasyDataTable.prototype.addRow = function (rowOrValues) {
|
|
2662
2696
|
var newRow;
|
|
2663
|
-
if (Array.isArray(
|
|
2697
|
+
if (Array.isArray(rowOrValues)) {
|
|
2698
|
+
var values = rowOrValues;
|
|
2664
2699
|
var dateIdx = this._columns.getDateColumnIndexes();
|
|
2665
2700
|
if (dateIdx.length > 0) {
|
|
2666
2701
|
for (var _i = 0, dateIdx_1 = dateIdx; _i < dateIdx_1.length; _i++) {
|
|
2667
2702
|
var idx = dateIdx_1[_i];
|
|
2668
|
-
if (
|
|
2669
|
-
|
|
2703
|
+
if (values[idx]) {
|
|
2704
|
+
values[idx] = this.mapDate(values[idx], this._columns.get(idx).type);
|
|
2670
2705
|
}
|
|
2671
2706
|
}
|
|
2672
2707
|
}
|
|
2673
|
-
newRow = new DataRow(this._columns,
|
|
2708
|
+
newRow = new DataRow(this._columns, values);
|
|
2674
2709
|
}
|
|
2675
2710
|
else {
|
|
2676
|
-
newRow = this.createRow(
|
|
2677
|
-
}
|
|
2678
|
-
var lastChunk = this.getLastChunk();
|
|
2679
|
-
if (!lastChunk || lastChunk.rows.length >= this._chunkSize) {
|
|
2680
|
-
lastChunk = this.createChunk();
|
|
2711
|
+
newRow = this.createRow(rowOrValues);
|
|
2681
2712
|
}
|
|
2682
|
-
|
|
2713
|
+
this.cachedRows.push(newRow);
|
|
2683
2714
|
var cachedTotal = this.getCachedCount();
|
|
2684
2715
|
if (cachedTotal > this.total) {
|
|
2685
2716
|
this.total = cachedTotal;
|
|
2686
2717
|
}
|
|
2687
2718
|
return newRow;
|
|
2688
2719
|
};
|
|
2689
|
-
EasyDataTable.prototype.createChunk = function (index) {
|
|
2690
|
-
if (typeof index == 'undefined') {
|
|
2691
|
-
index = this.getLastChunkIndex() + 1;
|
|
2692
|
-
}
|
|
2693
|
-
var chunk = { offset: index * this._chunkSize, rows: [] };
|
|
2694
|
-
this.chunkMap[index] = chunk;
|
|
2695
|
-
return chunk;
|
|
2696
|
-
};
|
|
2697
|
-
EasyDataTable.prototype.getLastChunkIndex = function () {
|
|
2698
|
-
var keys = Object.keys(this.chunkMap);
|
|
2699
|
-
return keys.length > 0
|
|
2700
|
-
? parseInt(keys[keys.length - 1])
|
|
2701
|
-
: -1;
|
|
2702
|
-
};
|
|
2703
|
-
EasyDataTable.prototype.getLastChunk = function () {
|
|
2704
|
-
var index = this.getLastChunkIndex();
|
|
2705
|
-
return index > -1
|
|
2706
|
-
? this.chunkMap[index]
|
|
2707
|
-
: null;
|
|
2708
|
-
};
|
|
2709
2720
|
EasyDataTable.prototype.getCachedRows = function () {
|
|
2710
|
-
return this.
|
|
2711
|
-
.reduce(function (acc, v) { return acc.concat(v.rows); }, []);
|
|
2712
|
-
};
|
|
2713
|
-
EasyDataTable.prototype.getCachedChunks = function () {
|
|
2714
|
-
return Object.values(this.chunkMap);
|
|
2721
|
+
return this.cachedRows;
|
|
2715
2722
|
};
|
|
2716
2723
|
EasyDataTable.prototype.totalIsKnown = function () {
|
|
2717
2724
|
if (this.elasticChunks) {
|
|
@@ -2720,6 +2727,11 @@ var easy_data_table_EasyDataTable = /** @class */ (function () {
|
|
|
2720
2727
|
}
|
|
2721
2728
|
return !this.needTotal;
|
|
2722
2729
|
};
|
|
2730
|
+
EasyDataTable.prototype.fireUpdated = function () {
|
|
2731
|
+
if (this.onUpdate) {
|
|
2732
|
+
this.onUpdate(this);
|
|
2733
|
+
}
|
|
2734
|
+
};
|
|
2723
2735
|
return EasyDataTable;
|
|
2724
2736
|
}());
|
|
2725
2737
|
|
|
@@ -2904,7 +2916,6 @@ i18n_i18n.resetLocales();
|
|
|
2904
2916
|
|
|
2905
2917
|
|
|
2906
2918
|
|
|
2907
|
-
//data
|
|
2908
2919
|
|
|
2909
2920
|
|
|
2910
2921
|
|
|
@@ -3746,7 +3757,7 @@ var __assign = (undefined && undefined.__assign) || function () {
|
|
|
3746
3757
|
};
|
|
3747
3758
|
|
|
3748
3759
|
/** Represents editor tags*/
|
|
3749
|
-
var EqEditorTag = __assign({}, public_api["d" /* EditorTag */], {
|
|
3760
|
+
var EqEditorTag = __assign(__assign({}, public_api["d" /* EditorTag */]), {
|
|
3750
3761
|
/** SqlList tag value */
|
|
3751
3762
|
SqlList: "SQLLIST",
|
|
3752
3763
|
/** SubQuery tag value */
|
|
@@ -5620,20 +5631,19 @@ var query_Query = /** @class */ (function () {
|
|
|
5620
5631
|
this.processQueryForAggregation();
|
|
5621
5632
|
var aggrCols = this.columns.filter(function (c) { return c.enabled
|
|
5622
5633
|
&& c.expr.tag == ExprTag.AggregateFunction; });
|
|
5623
|
-
// query contains aggregate columns
|
|
5624
|
-
if (aggrCols.length) {
|
|
5625
|
-
|
|
5626
|
-
|
|
5627
|
-
|
|
5628
|
-
|
|
5629
|
-
|
|
5630
|
-
|
|
5631
|
-
|
|
5632
|
-
|
|
5633
|
-
|
|
5634
|
-
|
|
5635
|
-
|
|
5636
|
-
}
|
|
5634
|
+
// // query contains aggregate columns
|
|
5635
|
+
// if (aggrCols.length) {
|
|
5636
|
+
// for (const col of aggrCols) {
|
|
5637
|
+
// const attr = this.model.getAttributeById(col.expr.args[0].value);
|
|
5638
|
+
// this.changeColumnType(col, ExprTag.EntityAttribute, {
|
|
5639
|
+
// caption: this.model.getAttributeText(attr, `{attr}`)
|
|
5640
|
+
// });
|
|
5641
|
+
// }
|
|
5642
|
+
// this.fireChangedEvent({
|
|
5643
|
+
// part: QueryChangePart.Columns,
|
|
5644
|
+
// wasModified: true
|
|
5645
|
+
// });
|
|
5646
|
+
// }
|
|
5637
5647
|
}
|
|
5638
5648
|
if (!this._enableAggregation) {
|
|
5639
5649
|
this.aggrSettings.clear();
|
|
@@ -5668,8 +5678,8 @@ var query_Query = /** @class */ (function () {
|
|
|
5668
5678
|
var colsToGroup = _this.columns.filter(function (c) { return c.enabled
|
|
5669
5679
|
&& c.expr.tag == ExprTag.EntityAttribute; });
|
|
5670
5680
|
var aggrsToAdd = [];
|
|
5671
|
-
for (var _i = 0,
|
|
5672
|
-
var col =
|
|
5681
|
+
for (var _i = 0, aggrCols_1 = aggrCols; _i < aggrCols_1.length; _i++) {
|
|
5682
|
+
var col = aggrCols_1[_i];
|
|
5673
5683
|
aggrsToAdd.push({ id: col.id, func: col.expr.func });
|
|
5674
5684
|
_this.changeColumnType(col, ExprTag.EntityAttribute);
|
|
5675
5685
|
}
|
|
@@ -7182,9 +7192,9 @@ var EqQueryFileLoader = /** @class */ (function () {
|
|
|
7182
7192
|
fileName = options.fileName
|
|
7183
7193
|
+ fileName.substring(fileName.lastIndexOf('.'));
|
|
7184
7194
|
}
|
|
7185
|
-
if (window.navigator
|
|
7195
|
+
if (window.navigator['msSaveOrOpenBlob']) {
|
|
7186
7196
|
// Internet Explorer
|
|
7187
|
-
window.navigator
|
|
7197
|
+
window.navigator['msSaveOrOpenBlob'](blob, fileName);
|
|
7188
7198
|
}
|
|
7189
7199
|
else {
|
|
7190
7200
|
var a = document.createElement("a");
|
|
@@ -7220,13 +7230,12 @@ var EqAggregatesContainer = /** @class */ (function () {
|
|
|
7220
7230
|
this.context = context;
|
|
7221
7231
|
this.levels = {};
|
|
7222
7232
|
}
|
|
7223
|
-
EqAggregatesContainer.prototype.
|
|
7233
|
+
EqAggregatesContainer.prototype.getAggregateData = function (level, groupKey) {
|
|
7224
7234
|
var _this = this;
|
|
7225
7235
|
return new Promise(function (resolve, reject) {
|
|
7226
|
-
var desc = _this.getLevelDesc(level);
|
|
7227
7236
|
var processFunc = function (data) {
|
|
7228
7237
|
// map values
|
|
7229
|
-
var keyStr =
|
|
7238
|
+
var keyStr = _this.groupKeyToStr(groupKey);
|
|
7230
7239
|
var value = data.get(keyStr);
|
|
7231
7240
|
if (value) {
|
|
7232
7241
|
resolve(value);
|
|
@@ -7235,33 +7244,43 @@ var EqAggregatesContainer = /** @class */ (function () {
|
|
|
7235
7244
|
reject("Can't find data for " + keyStr);
|
|
7236
7245
|
}
|
|
7237
7246
|
};
|
|
7238
|
-
|
|
7247
|
+
var desc = _this.getLevelDesc(level, false);
|
|
7248
|
+
if (desc && desc.data) {
|
|
7239
7249
|
processFunc(desc.data);
|
|
7240
7250
|
}
|
|
7241
7251
|
else {
|
|
7242
|
-
desc.
|
|
7252
|
+
desc.receivedCallbacks.push(processFunc);
|
|
7243
7253
|
}
|
|
7244
7254
|
});
|
|
7245
7255
|
};
|
|
7246
|
-
EqAggregatesContainer.prototype.
|
|
7247
|
-
var desc = this.getLevelDesc(level);
|
|
7256
|
+
EqAggregatesContainer.prototype.setAggregateData = function (level, data) {
|
|
7257
|
+
var desc = this.getLevelDesc(level, true);
|
|
7248
7258
|
desc.data = data;
|
|
7249
|
-
if (desc.
|
|
7250
|
-
for (var _i = 0, _a = desc.
|
|
7259
|
+
if (desc.receivedCallbacks) {
|
|
7260
|
+
for (var _i = 0, _a = desc.receivedCallbacks; _i < _a.length; _i++) {
|
|
7251
7261
|
var callback = _a[_i];
|
|
7252
7262
|
callback(desc.data);
|
|
7253
7263
|
}
|
|
7254
7264
|
}
|
|
7255
|
-
desc.
|
|
7265
|
+
desc.receivedCallbacks = [];
|
|
7266
|
+
};
|
|
7267
|
+
EqAggregatesContainer.prototype.updateAggregateData = function (level, groupKey, values) {
|
|
7268
|
+
var desc = this.getLevelDesc(level, true);
|
|
7269
|
+
var key = this.groupKeyToStr(groupKey);
|
|
7270
|
+
desc.data.set(key, values);
|
|
7271
|
+
};
|
|
7272
|
+
EqAggregatesContainer.prototype.groupKeyToStr = function (groupKey) {
|
|
7273
|
+
return JSON.stringify(groupKey);
|
|
7256
7274
|
};
|
|
7257
|
-
EqAggregatesContainer.prototype.getLevelDesc = function (level) {
|
|
7275
|
+
EqAggregatesContainer.prototype.getLevelDesc = function (level, createIfNotExists) {
|
|
7258
7276
|
var desc = this.levels[level];
|
|
7259
|
-
if (!desc) {
|
|
7277
|
+
if (!desc && createIfNotExists) {
|
|
7260
7278
|
desc = {
|
|
7261
|
-
|
|
7279
|
+
receivedCallbacks: [],
|
|
7280
|
+
data: new Map()
|
|
7262
7281
|
};
|
|
7282
|
+
this.levels[level] = desc;
|
|
7263
7283
|
}
|
|
7264
|
-
this.levels[level] = desc;
|
|
7265
7284
|
return desc;
|
|
7266
7285
|
};
|
|
7267
7286
|
EqAggregatesContainer.prototype.clear = function () {
|
|
@@ -7294,18 +7313,23 @@ var DefaultAggregatesCalculator = /** @class */ (function () {
|
|
|
7294
7313
|
columns[i].enabled = false;
|
|
7295
7314
|
}
|
|
7296
7315
|
if (settings.hasGrandTotals()) {
|
|
7297
|
-
this.aggrs.
|
|
7316
|
+
this.aggrs.setAggregateData(0, new Map());
|
|
7298
7317
|
if (options.resultObtained)
|
|
7299
7318
|
options.resultObtained({}, 0);
|
|
7300
7319
|
}
|
|
7301
7320
|
var groups = settings.getGroups();
|
|
7302
7321
|
for (var level = 1; level <= groups.length && level <= options.maxLevel; level++) {
|
|
7303
|
-
this.aggrs.
|
|
7322
|
+
this.aggrs.setAggregateData(level, new Map());
|
|
7304
7323
|
if (options.resultObtained)
|
|
7305
7324
|
options.resultObtained({}, level);
|
|
7306
7325
|
}
|
|
7307
7326
|
return Promise.resolve();
|
|
7308
7327
|
};
|
|
7328
|
+
DefaultAggregatesCalculator.prototype.needRecalculation = function () {
|
|
7329
|
+
return true;
|
|
7330
|
+
};
|
|
7331
|
+
DefaultAggregatesCalculator.prototype.reset = function () {
|
|
7332
|
+
};
|
|
7309
7333
|
return DefaultAggregatesCalculator;
|
|
7310
7334
|
}());
|
|
7311
7335
|
|
|
@@ -7420,7 +7444,7 @@ var eq_services_EqServiceProvider = /** @class */ (function () {
|
|
|
7420
7444
|
EqServiceProvider.prototype.getAggregatesCalculator = function () {
|
|
7421
7445
|
if (!this.aggrCalculator) {
|
|
7422
7446
|
if (!this.aggrCalculatoResolver) {
|
|
7423
|
-
throw 'Resolver for
|
|
7447
|
+
throw 'Resolver for AggregatesCalculator is not defined';
|
|
7424
7448
|
}
|
|
7425
7449
|
this.aggrCalculator = this.aggrCalculatoResolver(this.context);
|
|
7426
7450
|
}
|
|
@@ -7469,7 +7493,6 @@ var eq_data_loader_EasyQueryDataLoader = /** @class */ (function () {
|
|
|
7469
7493
|
// different grids
|
|
7470
7494
|
this.dataLoadPromise = new Promise(function (resolve, reject) {
|
|
7471
7495
|
var fetchOptions = {
|
|
7472
|
-
skipAggr: true,
|
|
7473
7496
|
chunk: chunk,
|
|
7474
7497
|
success: function (result) {
|
|
7475
7498
|
var dataTable = new public_api["c" /* EasyDataTable */]({
|
|
@@ -7587,9 +7610,9 @@ var EqServerExporter = /** @class */ (function () {
|
|
|
7587
7610
|
var blob = new Blob([responseData]);
|
|
7588
7611
|
var filename = request.getXMLHttpRequest()
|
|
7589
7612
|
.getResponseHeader("Content-Disposition").match(/filename="(.*)"/)[1];
|
|
7590
|
-
if (window.navigator
|
|
7613
|
+
if (window.navigator['msSaveOrOpenBlob']) {
|
|
7591
7614
|
// Internet Explorer
|
|
7592
|
-
window.navigator
|
|
7615
|
+
window.navigator['msSaveOrOpenBlob'](blob, filename);
|
|
7593
7616
|
}
|
|
7594
7617
|
else {
|
|
7595
7618
|
var a = document.createElement("a");
|
|
@@ -7728,7 +7751,8 @@ var context_EqContext = /** @class */ (function () {
|
|
|
7728
7751
|
this.endpoints = new Map();
|
|
7729
7752
|
this.dataLoader = new eq_data_loader_EasyQueryDataLoader(this);
|
|
7730
7753
|
this.resultTable = new public_api["c" /* EasyDataTable */]({
|
|
7731
|
-
loader: this.dataLoader
|
|
7754
|
+
loader: this.dataLoader,
|
|
7755
|
+
onUpdate: this.onResultTableUpdate.bind(this)
|
|
7732
7756
|
});
|
|
7733
7757
|
this.resultTable.id = 'ResultTable';
|
|
7734
7758
|
this.errorHandlerId = this.addEventListener('error', function (context, status) {
|
|
@@ -8704,14 +8728,20 @@ var context_EqContext = /** @class */ (function () {
|
|
|
8704
8728
|
})) {
|
|
8705
8729
|
return;
|
|
8706
8730
|
}
|
|
8731
|
+
//just to support the old way of catching "group fetch" operation finish
|
|
8732
|
+
if (options.groupFetchSuccess) {
|
|
8733
|
+
this.afterGroupFetch = options.groupFetchSuccess;
|
|
8734
|
+
}
|
|
8707
8735
|
if (this.resultTable.elasticChunks) {
|
|
8708
8736
|
options.chunk.limit++;
|
|
8709
8737
|
}
|
|
8710
|
-
this.fetchDataChunk(context_assign({}, options, { success: function (result) {
|
|
8738
|
+
this.fetchDataChunk(context_assign(context_assign({}, options), { success: function (result) {
|
|
8711
8739
|
if (result.statement) {
|
|
8712
8740
|
_this.resultStatement = result.statement;
|
|
8713
8741
|
_this.refreshWidgets(WidgetGroup.Statement);
|
|
8714
8742
|
}
|
|
8743
|
+
var aggrCalculator = _this.getServices().getAggregatesCalculator();
|
|
8744
|
+
aggrCalculator.reset();
|
|
8715
8745
|
_this.resultContent = result;
|
|
8716
8746
|
if (result.resultSet) {
|
|
8717
8747
|
_this.resultTable.clear();
|
|
@@ -8736,6 +8766,7 @@ var context_EqContext = /** @class */ (function () {
|
|
|
8736
8766
|
? resultSet.rows.length
|
|
8737
8767
|
: 0;
|
|
8738
8768
|
}
|
|
8769
|
+
_this.resultTable.fireUpdated();
|
|
8739
8770
|
}
|
|
8740
8771
|
if (options.success) {
|
|
8741
8772
|
options.success(result);
|
|
@@ -8811,55 +8842,30 @@ var context_EqContext = /** @class */ (function () {
|
|
|
8811
8842
|
};
|
|
8812
8843
|
EqContext.prototype.fetchDataChunk = function (options) {
|
|
8813
8844
|
var _this = this;
|
|
8814
|
-
if (this.beforeFetchData) {
|
|
8815
|
-
this.beforeFetchData(this, options);
|
|
8816
|
-
}
|
|
8817
8845
|
var queryId = this.getQuery().getId();
|
|
8818
8846
|
var fetchOptions = options || {};
|
|
8819
8847
|
if (this.useStoredQueryOnFetch) {
|
|
8820
8848
|
fetchOptions.queryId = this.query.getId();
|
|
8821
8849
|
}
|
|
8850
|
+
if (this.beforeFetchData) {
|
|
8851
|
+
this.beforeFetchData(this, fetchOptions);
|
|
8852
|
+
}
|
|
8822
8853
|
this.startProcess({
|
|
8823
8854
|
action: EqAction.FetchData,
|
|
8824
8855
|
text: 'Fetching data for the query: ' + queryId
|
|
8825
8856
|
}, WidgetGroup.Result);
|
|
8826
8857
|
var dataFetcher = this.eqServices.getDataFetcher();
|
|
8827
|
-
dataFetcher.fetchData(
|
|
8858
|
+
dataFetcher.fetchData(fetchOptions)
|
|
8828
8859
|
.then(function (result) {
|
|
8829
8860
|
if (result.statement) {
|
|
8830
8861
|
_this.resultStatement = result.statement;
|
|
8831
8862
|
}
|
|
8832
8863
|
_this.resultContent = result;
|
|
8833
|
-
if (!options.skipAggr) {
|
|
8834
|
-
var aggrSettings = _this.query.getAggregationSettings();
|
|
8835
|
-
if (aggrSettings.needAggrCalculation()) {
|
|
8836
|
-
var calculator = _this.getServices().getAggregatesCalculator();
|
|
8837
|
-
calculator.calculate({
|
|
8838
|
-
maxLevel: aggrSettings.getGroups().length + 1,
|
|
8839
|
-
resultObtained: function (result, level) {
|
|
8840
|
-
if (options.groupFetchSucess) {
|
|
8841
|
-
options.groupFetchSucess(result);
|
|
8842
|
-
}
|
|
8843
|
-
},
|
|
8844
|
-
errorOccurred: function (error) {
|
|
8845
|
-
var errorMessage = "Data fetching error on group level " + error.level + " query. \n" + error.message;
|
|
8846
|
-
_this.throwError({
|
|
8847
|
-
action: EqAction.FetchData,
|
|
8848
|
-
text: errorMessage,
|
|
8849
|
-
sourceError: error
|
|
8850
|
-
});
|
|
8851
|
-
if (options.error) {
|
|
8852
|
-
options.error(errorMessage, EqAction.FetchData);
|
|
8853
|
-
}
|
|
8854
|
-
}
|
|
8855
|
-
});
|
|
8856
|
-
}
|
|
8857
|
-
}
|
|
8858
8864
|
// we need to call success callback before firing fetchData,
|
|
8859
8865
|
// because otherwise, it won't update the result table
|
|
8860
8866
|
// in the context before afterFetchData callback is called.
|
|
8861
|
-
if (
|
|
8862
|
-
|
|
8867
|
+
if (fetchOptions.success) {
|
|
8868
|
+
fetchOptions.success(result);
|
|
8863
8869
|
}
|
|
8864
8870
|
_this.fireEvent('fetchData');
|
|
8865
8871
|
_this.endProcess({
|
|
@@ -8876,11 +8882,34 @@ var context_EqContext = /** @class */ (function () {
|
|
|
8876
8882
|
text: errorMessage,
|
|
8877
8883
|
sourceError: error
|
|
8878
8884
|
}, WidgetGroup.Result);
|
|
8879
|
-
if (
|
|
8880
|
-
|
|
8885
|
+
if (fetchOptions.error) {
|
|
8886
|
+
fetchOptions.error(errorMessage, EqAction.FetchData);
|
|
8881
8887
|
}
|
|
8882
8888
|
});
|
|
8883
8889
|
};
|
|
8890
|
+
EqContext.prototype.onResultTableUpdate = function () {
|
|
8891
|
+
var _this = this;
|
|
8892
|
+
var aggrSettings = this.query.getAggregationSettings();
|
|
8893
|
+
var calculator = this.getServices().getAggregatesCalculator();
|
|
8894
|
+
if (aggrSettings.needAggrCalculation() && calculator.needRecalculation()) {
|
|
8895
|
+
calculator.calculate({
|
|
8896
|
+
maxLevel: aggrSettings.getGroups().length + 1,
|
|
8897
|
+
resultObtained: function (result, level) {
|
|
8898
|
+
if (_this.afterGroupFetch) {
|
|
8899
|
+
_this.afterGroupFetch(result);
|
|
8900
|
+
}
|
|
8901
|
+
},
|
|
8902
|
+
errorOccurred: function (error) {
|
|
8903
|
+
var errorMessage = "Data fetching error on group level " + error.level + " query. \n" + error.message;
|
|
8904
|
+
_this.throwError({
|
|
8905
|
+
action: EqAction.FetchData,
|
|
8906
|
+
text: errorMessage,
|
|
8907
|
+
sourceError: error
|
|
8908
|
+
});
|
|
8909
|
+
}
|
|
8910
|
+
});
|
|
8911
|
+
}
|
|
8912
|
+
};
|
|
8884
8913
|
/**
|
|
8885
8914
|
* Fetches the data for a drill-down query (if defined) and processes the result.
|
|
8886
8915
|
* @param options
|