@easyquery/core 7.2.4-beta03 → 7.2.4-rc02
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 +245 -63
- package/dist/bundles/easyquery.core.js.map +1 -1
- package/dist/bundles/easyquery.core.min.js +1 -1
- 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/eqs/eqs_exporter.js +3 -1
- package/dist/lib/eqs/eqs_exporter.js.map +1 -1
- package/dist/lib/eqs/eqs_query_file_loader.js +1 -1
- package/dist/lib/eqs/eqs_query_file_loader.js.map +1 -1
- package/dist/lib/export/exporter.d.ts +3 -0
- package/dist/lib/export/exporter.js +6 -1
- package/dist/lib/export/exporter.js.map +1 -1
- package/dist/lib/main/context.d.ts +3 -0
- package/dist/lib/main/context.js +23 -4
- package/dist/lib/main/context.js.map +1 -1
- package/dist/lib/main/context_options.d.ts +2 -0
- package/dist/lib/main/query_storage.js +1 -1
- package/dist/lib/main/query_storage.js.map +1 -1
- package/dist/lib/query/query.d.ts +12 -2
- package/dist/lib/query/query.js +156 -51
- package/dist/lib/query/query.js.map +1 -1
- package/dist/lib/query/query_column.d.ts +6 -2
- package/dist/lib/query/query_column.js +52 -5
- package/dist/lib/query/query_column.js.map +1 -1
- package/package.json +2 -2
|
@@ -3170,6 +3170,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
3170
3170
|
DataModel: () => (/* reexport */ DataModel),
|
|
3171
3171
|
DefaultAggregatesCalculator: () => (/* reexport */ DefaultAggregatesCalculator),
|
|
3172
3172
|
EasyQueryDataLoader: () => (/* reexport */ EasyQueryDataLoader),
|
|
3173
|
+
EmptyChunk: () => (/* reexport */ EmptyChunk),
|
|
3173
3174
|
Entity: () => (/* reexport */ Entity),
|
|
3174
3175
|
EntityAttr: () => (/* reexport */ EntityAttr),
|
|
3175
3176
|
EqAction: () => (/* reexport */ EqAction),
|
|
@@ -3476,6 +3477,14 @@ var eqconsts;
|
|
|
3476
3477
|
];
|
|
3477
3478
|
})(eqconsts || (eqconsts = {}));
|
|
3478
3479
|
|
|
3480
|
+
;// CONCATENATED MODULE: ./src/export/exporter.ts
|
|
3481
|
+
//possibly move it to the EasyData lib on the next update
|
|
3482
|
+
var EmptyChunk = {
|
|
3483
|
+
offset: 0,
|
|
3484
|
+
limit: 0,
|
|
3485
|
+
needTotal: false
|
|
3486
|
+
};
|
|
3487
|
+
|
|
3479
3488
|
;// CONCATENATED MODULE: ./src/dm/aggr_function.ts
|
|
3480
3489
|
|
|
3481
3490
|
/**
|
|
@@ -5062,12 +5071,14 @@ var QueryColumn = /** @class */ (function () {
|
|
|
5062
5071
|
/** The parameters associated with this column */
|
|
5063
5072
|
this.params = [];
|
|
5064
5073
|
this._isHidden = false;
|
|
5074
|
+
this.query = query;
|
|
5065
5075
|
this._id = public_api/* utils.generateId */.P6.generateId('col');
|
|
5066
5076
|
this.caption = '';
|
|
5067
|
-
this.
|
|
5068
|
-
this.
|
|
5077
|
+
this._sorting = SortDirection.None;
|
|
5078
|
+
this._sortIndex = -1;
|
|
5069
5079
|
this.expr = new Expression(this);
|
|
5070
5080
|
this.blockId = '';
|
|
5081
|
+
this.justsorted = justsorted;
|
|
5071
5082
|
}
|
|
5072
5083
|
Object.defineProperty(QueryColumn.prototype, "id", {
|
|
5073
5084
|
get: function () {
|
|
@@ -5076,6 +5087,51 @@ var QueryColumn = /** @class */ (function () {
|
|
|
5076
5087
|
enumerable: false,
|
|
5077
5088
|
configurable: true
|
|
5078
5089
|
});
|
|
5090
|
+
Object.defineProperty(QueryColumn.prototype, "sorting", {
|
|
5091
|
+
/** Column sorting direction */
|
|
5092
|
+
get: function () {
|
|
5093
|
+
if (this.query) {
|
|
5094
|
+
return this.query.getColumnSorting(this);
|
|
5095
|
+
}
|
|
5096
|
+
else {
|
|
5097
|
+
return this._sorting;
|
|
5098
|
+
}
|
|
5099
|
+
},
|
|
5100
|
+
set: function (direction) {
|
|
5101
|
+
if (this.query) {
|
|
5102
|
+
this.query.setColumnSorting(this, direction);
|
|
5103
|
+
}
|
|
5104
|
+
else {
|
|
5105
|
+
this._sorting = direction;
|
|
5106
|
+
}
|
|
5107
|
+
},
|
|
5108
|
+
enumerable: false,
|
|
5109
|
+
configurable: true
|
|
5110
|
+
});
|
|
5111
|
+
;
|
|
5112
|
+
Object.defineProperty(QueryColumn.prototype, "sortIndex", {
|
|
5113
|
+
/** The index of the column in the sorting list. */
|
|
5114
|
+
get: function () {
|
|
5115
|
+
if (this.query) {
|
|
5116
|
+
return this.query.getColumnSortIndex(this);
|
|
5117
|
+
}
|
|
5118
|
+
else {
|
|
5119
|
+
return this._sortIndex;
|
|
5120
|
+
}
|
|
5121
|
+
},
|
|
5122
|
+
set: function (index) {
|
|
5123
|
+
if (this.query) {
|
|
5124
|
+
this.query.setColumnSortIndex(this, index);
|
|
5125
|
+
}
|
|
5126
|
+
else {
|
|
5127
|
+
this._sortIndex = index;
|
|
5128
|
+
}
|
|
5129
|
+
},
|
|
5130
|
+
enumerable: false,
|
|
5131
|
+
configurable: true
|
|
5132
|
+
});
|
|
5133
|
+
;
|
|
5134
|
+
;
|
|
5079
5135
|
QueryColumn.prototype.getModel = function () {
|
|
5080
5136
|
return this.query.getModel();
|
|
5081
5137
|
};
|
|
@@ -5130,8 +5186,8 @@ var QueryColumn = /** @class */ (function () {
|
|
|
5130
5186
|
}
|
|
5131
5187
|
this.caption = colData.cptn;
|
|
5132
5188
|
if (typeof colData.srt !== 'undefined') {
|
|
5133
|
-
this.
|
|
5134
|
-
this.
|
|
5189
|
+
this._sorting = colData.srt;
|
|
5190
|
+
this._sortIndex = (typeof colData.srtidx !== 'undefined')
|
|
5135
5191
|
? colData.srtidx
|
|
5136
5192
|
: -1;
|
|
5137
5193
|
}
|
|
@@ -5157,7 +5213,7 @@ var QueryColumn = /** @class */ (function () {
|
|
|
5157
5213
|
if (typeof this.caption !== 'undefined') {
|
|
5158
5214
|
obj.cptn = this.caption;
|
|
5159
5215
|
}
|
|
5160
|
-
if (
|
|
5216
|
+
if (this.sorting != SortDirection.None) {
|
|
5161
5217
|
obj.srt = this.sorting;
|
|
5162
5218
|
obj.srtidx = this.sortIndex;
|
|
5163
5219
|
}
|
|
@@ -5621,11 +5677,19 @@ var Query = /** @class */ (function () {
|
|
|
5621
5677
|
this._enableAggregation = false;
|
|
5622
5678
|
this.parentQuery = null;
|
|
5623
5679
|
this.drillDowns = [];
|
|
5680
|
+
this.syncSortOrderWithColumnsOrder = true;
|
|
5681
|
+
if (options) {
|
|
5682
|
+
this.context = options.context;
|
|
5683
|
+
if (this.context) {
|
|
5684
|
+
this.syncSortOrderWithColumnsOrder = this.context.options.syncSortOrderWithColumnsOrder;
|
|
5685
|
+
}
|
|
5686
|
+
}
|
|
5624
5687
|
this.eventEmitter = new public_api/* EventEmitter */.vp(this);
|
|
5625
5688
|
this.root = new Condition(this, CondTag.Group);
|
|
5626
5689
|
this.extraConditions = new Condition(this, CondTag.Group);
|
|
5627
5690
|
this.columns = new Array();
|
|
5628
|
-
this.justsorted = new Array();
|
|
5691
|
+
//this.justsorted = new Array<QueryColumn>();
|
|
5692
|
+
this.sortedColumns = new Array();
|
|
5629
5693
|
if (!this.id) {
|
|
5630
5694
|
this.regenerateId();
|
|
5631
5695
|
}
|
|
@@ -5715,7 +5779,7 @@ var Query = /** @class */ (function () {
|
|
|
5715
5779
|
return hasChanged;
|
|
5716
5780
|
};
|
|
5717
5781
|
Query.prototype.createSubQuery = function () {
|
|
5718
|
-
return new Query(this.model);
|
|
5782
|
+
return new Query(this.model, null, { context: this.context });
|
|
5719
5783
|
};
|
|
5720
5784
|
Query.prototype.useAggregation = function (settingsTuner, silent) {
|
|
5721
5785
|
if (silent === void 0) { silent = false; }
|
|
@@ -5776,6 +5840,7 @@ var Query = /** @class */ (function () {
|
|
|
5776
5840
|
});
|
|
5777
5841
|
};
|
|
5778
5842
|
Query.prototype.processQueryForAggregation = function (silent) {
|
|
5843
|
+
var _this = this;
|
|
5779
5844
|
if (silent === void 0) { silent = false; }
|
|
5780
5845
|
var aggrSettings = this.getAggregationSettings();
|
|
5781
5846
|
var groups = aggrSettings.getGroups();
|
|
@@ -5789,19 +5854,21 @@ var Query = /** @class */ (function () {
|
|
|
5789
5854
|
if (groupColIds.indexOf(col.id) >= 0) {
|
|
5790
5855
|
groupedCols.push(col);
|
|
5791
5856
|
}
|
|
5792
|
-
else if (col
|
|
5857
|
+
else if (this.getColumnSorting(col) != SortDirection.None) {
|
|
5793
5858
|
sortedCols.push(col);
|
|
5794
5859
|
}
|
|
5795
5860
|
}
|
|
5796
5861
|
var sortIndex_1 = 0;
|
|
5797
5862
|
groupedCols.forEach(function (col) {
|
|
5798
|
-
if (col
|
|
5799
|
-
col
|
|
5863
|
+
if (_this.getColumnSorting(col) == SortDirection.None) {
|
|
5864
|
+
_this.setColumnSorting(col, SortDirection.Ascending);
|
|
5800
5865
|
}
|
|
5801
|
-
col
|
|
5866
|
+
_this.setColumnSortIndex(col, sortIndex_1++);
|
|
5867
|
+
//col.sortIndex = sortIndex++;
|
|
5802
5868
|
});
|
|
5803
5869
|
sortedCols.forEach(function (col) {
|
|
5804
|
-
col
|
|
5870
|
+
_this.setColumnSortIndex(col, sortIndex_1++);
|
|
5871
|
+
// col.sortIndex = sortIndex++;
|
|
5805
5872
|
});
|
|
5806
5873
|
if (!silent) {
|
|
5807
5874
|
this.fireChangedEvent({
|
|
@@ -6032,12 +6099,14 @@ var Query = /** @class */ (function () {
|
|
|
6032
6099
|
}
|
|
6033
6100
|
this.name = data.name;
|
|
6034
6101
|
this.description = data.desc;
|
|
6035
|
-
this.justsorted = [];
|
|
6102
|
+
//this.justsorted = [];
|
|
6103
|
+
this.sortedColumns = [];
|
|
6036
6104
|
if (data.justsortcols) {
|
|
6037
6105
|
for (var i = 0; i < data.justsortcols.length; i++) {
|
|
6038
6106
|
var newCol = this.createColumn(true);
|
|
6039
6107
|
newCol.loadFromData(this.model, data.justsortcols[i]);
|
|
6040
|
-
this.justsorted.push(newCol);
|
|
6108
|
+
//this.justsorted.push(newCol);
|
|
6109
|
+
this.addColumnToSorted(newCol);
|
|
6041
6110
|
}
|
|
6042
6111
|
}
|
|
6043
6112
|
if (data.cols) {
|
|
@@ -6045,8 +6114,15 @@ var Query = /** @class */ (function () {
|
|
|
6045
6114
|
var newCol = this.createColumn();
|
|
6046
6115
|
newCol.loadFromData(this.model, data.cols[i]);
|
|
6047
6116
|
this.columns.push(newCol);
|
|
6117
|
+
if (newCol._sorting != SortDirection.None) {
|
|
6118
|
+
this.addColumnToSorted(newCol);
|
|
6119
|
+
}
|
|
6048
6120
|
}
|
|
6049
6121
|
}
|
|
6122
|
+
this.sortedColumns.sort(function (col1, col2) {
|
|
6123
|
+
return col1._sortIndex - col2._sortIndex;
|
|
6124
|
+
});
|
|
6125
|
+
this.fixupSortingIndices();
|
|
6050
6126
|
if (data.extraData) {
|
|
6051
6127
|
this.extraData = data.extraData;
|
|
6052
6128
|
}
|
|
@@ -6136,6 +6212,7 @@ var Query = /** @class */ (function () {
|
|
|
6136
6212
|
*/
|
|
6137
6213
|
Query.prototype.toJSONData = function () {
|
|
6138
6214
|
var _this = this;
|
|
6215
|
+
this.fixupSortingIndices();
|
|
6139
6216
|
var obj = {
|
|
6140
6217
|
modelId: this.model ? this.model.getId() : null,
|
|
6141
6218
|
modelName: this.model ? this.model.getName() : null
|
|
@@ -6150,9 +6227,14 @@ var Query = /** @class */ (function () {
|
|
|
6150
6227
|
obj.cols.push(this.columns[i].saveToData());
|
|
6151
6228
|
}
|
|
6152
6229
|
obj.justsortcols = [];
|
|
6153
|
-
for (
|
|
6154
|
-
|
|
6155
|
-
}
|
|
6230
|
+
// for (let i = 0; i < this.justsorted.length; i++) {
|
|
6231
|
+
// obj.justsortcols.push(this.justsorted[i].saveToData());
|
|
6232
|
+
// }
|
|
6233
|
+
this.sortedColumns.forEach(function (col) {
|
|
6234
|
+
if (col.isJustSorted()) {
|
|
6235
|
+
obj.justsortcols.push(col.saveToData());
|
|
6236
|
+
}
|
|
6237
|
+
});
|
|
6156
6238
|
if (this.extraData) {
|
|
6157
6239
|
obj.extraData = this.extraData;
|
|
6158
6240
|
}
|
|
@@ -6225,7 +6307,8 @@ var Query = /** @class */ (function () {
|
|
|
6225
6307
|
*/
|
|
6226
6308
|
Query.prototype.clearColumns = function () {
|
|
6227
6309
|
this.columns = [];
|
|
6228
|
-
this.justsorted = [];
|
|
6310
|
+
//this.justsorted = [];
|
|
6311
|
+
this.sortedColumns = [];
|
|
6229
6312
|
};
|
|
6230
6313
|
/**
|
|
6231
6314
|
* Clears all conditions in query.
|
|
@@ -6317,31 +6400,34 @@ var Query = /** @class */ (function () {
|
|
|
6317
6400
|
cols.pop();
|
|
6318
6401
|
return cols;
|
|
6319
6402
|
};
|
|
6403
|
+
Query.prototype.addColumnToSorted = function (col) {
|
|
6404
|
+
var colJson = JSON.stringify(col.expr.saveToData());
|
|
6405
|
+
var isUnique = true;
|
|
6406
|
+
this.sortedColumns.forEach(function (scol) {
|
|
6407
|
+
var qcolJson = JSON.stringify(scol.expr.saveToData());
|
|
6408
|
+
if (qcolJson === colJson) {
|
|
6409
|
+
isUnique = false;
|
|
6410
|
+
}
|
|
6411
|
+
});
|
|
6412
|
+
if (isUnique) {
|
|
6413
|
+
this.sortedColumns.push(col);
|
|
6414
|
+
}
|
|
6415
|
+
};
|
|
6320
6416
|
/**
|
|
6321
6417
|
* Get array of columns used only in sorting.
|
|
6322
6418
|
* @retruns Columns.
|
|
6323
6419
|
*/
|
|
6324
6420
|
Query.prototype.getJustSortedColumns = function () {
|
|
6325
|
-
return this.
|
|
6421
|
+
return this.sortedColumns.filter(function (col) {
|
|
6422
|
+
return col.isJustSorted();
|
|
6423
|
+
});
|
|
6326
6424
|
};
|
|
6327
6425
|
/**
|
|
6328
6426
|
* Gets array of columns used in sorting
|
|
6329
6427
|
* @retruns Columns
|
|
6330
6428
|
*/
|
|
6331
6429
|
Query.prototype.getSortedColumns = function () {
|
|
6332
|
-
|
|
6333
|
-
var cols = this.getColumns()
|
|
6334
|
-
.concat(this.getJustSortedColumns());
|
|
6335
|
-
for (var i = 0; i < cols.length; i++) {
|
|
6336
|
-
var col = cols[i];
|
|
6337
|
-
if (col.sortIndex >= 0) {
|
|
6338
|
-
sortedCols.push(col);
|
|
6339
|
-
}
|
|
6340
|
-
}
|
|
6341
|
-
sortedCols.sort(function (col1, col2) {
|
|
6342
|
-
return col1.sortIndex - col2.sortIndex;
|
|
6343
|
-
});
|
|
6344
|
-
return sortedCols;
|
|
6430
|
+
return this.sortedColumns;
|
|
6345
6431
|
};
|
|
6346
6432
|
/**
|
|
6347
6433
|
* Gets Colummn sorting index.
|
|
@@ -6349,17 +6435,71 @@ var Query = /** @class */ (function () {
|
|
|
6349
6435
|
* @retruns The index.
|
|
6350
6436
|
*/
|
|
6351
6437
|
Query.prototype.getColumnSortIndex = function (col) {
|
|
6352
|
-
|
|
6353
|
-
|
|
6354
|
-
|
|
6355
|
-
|
|
6356
|
-
|
|
6438
|
+
return this.sortedColumns.indexOf(col);
|
|
6439
|
+
};
|
|
6440
|
+
Query.prototype.setColumnSortIndex = function (col, index) {
|
|
6441
|
+
if (index < 0)
|
|
6442
|
+
return;
|
|
6443
|
+
var colIdx = this.getColumnSortIndex(col);
|
|
6444
|
+
if (colIdx < 0) {
|
|
6445
|
+
this.addColumnToSorted(col);
|
|
6446
|
+
colIdx = this.sortedColumns.length - 1;
|
|
6447
|
+
}
|
|
6448
|
+
public_api/* utils.moveArrayItem */.P6.moveArrayItem(this.sortedColumns, colIdx, index);
|
|
6449
|
+
this.fixupSortingIndices();
|
|
6450
|
+
this.fireColumnsChangedEvent(QueryChangeAction.All);
|
|
6451
|
+
};
|
|
6452
|
+
Query.prototype.getColumnSorting = function (col) {
|
|
6453
|
+
var idx = this.getColumnSortIndex(col);
|
|
6454
|
+
if (idx >= 0) {
|
|
6455
|
+
return col._sorting != SortDirection.None ? col._sorting : SortDirection.Ascending;
|
|
6456
|
+
}
|
|
6457
|
+
else {
|
|
6458
|
+
return SortDirection.None;
|
|
6459
|
+
}
|
|
6460
|
+
};
|
|
6461
|
+
Query.prototype.setColumnSorting = function (col, direction) {
|
|
6462
|
+
var idx = this.getColumnSortIndex(col);
|
|
6463
|
+
col._sorting = direction;
|
|
6464
|
+
if (idx >= 0) {
|
|
6465
|
+
if (direction == SortDirection.None) {
|
|
6466
|
+
public_api/* utils.removeArrayItem */.P6.removeArrayItem(this.sortedColumns, col);
|
|
6467
|
+
this.fixupSortingIndices();
|
|
6357
6468
|
}
|
|
6358
|
-
|
|
6359
|
-
|
|
6469
|
+
}
|
|
6470
|
+
else {
|
|
6471
|
+
if (direction != SortDirection.None) {
|
|
6472
|
+
this.addColumnToSorted(col);
|
|
6473
|
+
this.fixupSortingIndices();
|
|
6360
6474
|
}
|
|
6361
6475
|
}
|
|
6362
|
-
|
|
6476
|
+
this.adjustColumnsSorting();
|
|
6477
|
+
this.fireColumnsChangedEvent(QueryChangeAction.Modify, col, col.isJustSorted());
|
|
6478
|
+
};
|
|
6479
|
+
Query.prototype.fixupSortingIndices = function () {
|
|
6480
|
+
this.sortedColumns.forEach(function (col, index) {
|
|
6481
|
+
col._sortIndex = index;
|
|
6482
|
+
});
|
|
6483
|
+
};
|
|
6484
|
+
Query.prototype.adjustColumnsSorting = function () {
|
|
6485
|
+
var _this = this;
|
|
6486
|
+
if (!this.syncSortOrderWithColumnsOrder) {
|
|
6487
|
+
return;
|
|
6488
|
+
}
|
|
6489
|
+
if (this.getJustSortedColumns().length > 0) {
|
|
6490
|
+
return;
|
|
6491
|
+
}
|
|
6492
|
+
var idx = 0;
|
|
6493
|
+
this.columns.forEach(function (col) {
|
|
6494
|
+
if (col.sorting != SortDirection.None) {
|
|
6495
|
+
var colIdx = _this.getColumnSortIndex(col);
|
|
6496
|
+
if (colIdx >= 0) {
|
|
6497
|
+
public_api/* utils.moveArrayItem */.P6.moveArrayItem(_this.sortedColumns, colIdx, idx);
|
|
6498
|
+
idx++;
|
|
6499
|
+
}
|
|
6500
|
+
}
|
|
6501
|
+
});
|
|
6502
|
+
this.fixupSortingIndices();
|
|
6363
6503
|
};
|
|
6364
6504
|
Query.prototype.createColumn = function (justsorted) {
|
|
6365
6505
|
if (justsorted === void 0) { justsorted = false; }
|
|
@@ -6384,9 +6524,9 @@ var Query = /** @class */ (function () {
|
|
|
6384
6524
|
* }});
|
|
6385
6525
|
*/
|
|
6386
6526
|
Query.prototype.addColumn = function (descriptor, author) {
|
|
6387
|
-
|
|
6388
|
-
|
|
6389
|
-
|
|
6527
|
+
// let columns = (descriptor.justsorted)
|
|
6528
|
+
// ? this.justsorted
|
|
6529
|
+
// : this.columns;
|
|
6390
6530
|
var newColumn;
|
|
6391
6531
|
if (descriptor.column) {
|
|
6392
6532
|
newColumn = descriptor.column;
|
|
@@ -6448,17 +6588,22 @@ var Query = /** @class */ (function () {
|
|
|
6448
6588
|
newColumn.expr.dataType = attr.dataType;
|
|
6449
6589
|
}
|
|
6450
6590
|
newColumn.caption = descriptor.caption || newColumn.caption;
|
|
6451
|
-
newColumn.
|
|
6452
|
-
newColumn.
|
|
6591
|
+
newColumn._sorting = descriptor.sorting || SortDirection.None;
|
|
6592
|
+
newColumn._sortIndex = descriptor.sortIndex || -1;
|
|
6453
6593
|
newColumn.enabled = public_api/* utils.getIfDefined */.P6.getIfDefined(descriptor.enabled, true);
|
|
6454
6594
|
newColumn.setReadOnly(public_api/* utils.getIfDefined */.P6.getIfDefined(descriptor.readonly, false));
|
|
6455
6595
|
}
|
|
6456
|
-
|
|
6457
|
-
|
|
6458
|
-
|
|
6459
|
-
|
|
6460
|
-
|
|
6596
|
+
var justsorted = descriptor.justsorted || (descriptor.column && descriptor.column.isJustSorted());
|
|
6597
|
+
if (!justsorted) {
|
|
6598
|
+
if (descriptor.index && descriptor.index >= 0 && descriptor.index < this.columns.length) {
|
|
6599
|
+
this.columns.splice(descriptor.index, 0, newColumn);
|
|
6600
|
+
}
|
|
6601
|
+
else {
|
|
6602
|
+
this.columns.push(newColumn);
|
|
6603
|
+
}
|
|
6461
6604
|
}
|
|
6605
|
+
this.setColumnSorting(newColumn, newColumn._sorting);
|
|
6606
|
+
this.fireColumnsChangedEvent(QueryChangeAction.Add, newColumn, justsorted);
|
|
6462
6607
|
return newColumn;
|
|
6463
6608
|
};
|
|
6464
6609
|
/**
|
|
@@ -6473,6 +6618,7 @@ var Query = /** @class */ (function () {
|
|
|
6473
6618
|
* query.addColumn(column, 1)
|
|
6474
6619
|
*/
|
|
6475
6620
|
Query.prototype.addColumnObj = function (column, index, author) {
|
|
6621
|
+
var _this = this;
|
|
6476
6622
|
var columns = this.columns;
|
|
6477
6623
|
if (typeof column.length == "undefined") {
|
|
6478
6624
|
if (typeof index == "number") {
|
|
@@ -6481,6 +6627,10 @@ var Query = /** @class */ (function () {
|
|
|
6481
6627
|
else {
|
|
6482
6628
|
columns.push(column);
|
|
6483
6629
|
}
|
|
6630
|
+
if (column.sorting != SortDirection.None) {
|
|
6631
|
+
this.addColumnToSorted(column);
|
|
6632
|
+
}
|
|
6633
|
+
this.fixupSortingIndices();
|
|
6484
6634
|
}
|
|
6485
6635
|
else {
|
|
6486
6636
|
if (typeof index == "number") {
|
|
@@ -6489,6 +6639,12 @@ var Query = /** @class */ (function () {
|
|
|
6489
6639
|
else {
|
|
6490
6640
|
columns.push.apply(columns, [].concat(column));
|
|
6491
6641
|
}
|
|
6642
|
+
column.forEach(function (col) {
|
|
6643
|
+
if (col.sorting != SortDirection.None) {
|
|
6644
|
+
_this.addColumnToSorted(col);
|
|
6645
|
+
}
|
|
6646
|
+
});
|
|
6647
|
+
this.fixupSortingIndices();
|
|
6492
6648
|
}
|
|
6493
6649
|
};
|
|
6494
6650
|
/**
|
|
@@ -6561,6 +6717,7 @@ var Query = /** @class */ (function () {
|
|
|
6561
6717
|
Query.prototype.moveColumn = function (index1, index2) {
|
|
6562
6718
|
var columns = this.getColumns();
|
|
6563
6719
|
public_api/* utils.moveArrayItem */.P6.moveArrayItem(columns, index1, index2);
|
|
6720
|
+
this.adjustColumnsSorting();
|
|
6564
6721
|
};
|
|
6565
6722
|
/**
|
|
6566
6723
|
* Removes the column.
|
|
@@ -6568,10 +6725,11 @@ var Query = /** @class */ (function () {
|
|
|
6568
6725
|
* @param author The author
|
|
6569
6726
|
*/
|
|
6570
6727
|
Query.prototype.removeColumn = function (column, author) {
|
|
6571
|
-
|
|
6572
|
-
|
|
6573
|
-
|
|
6574
|
-
public_api/* utils.removeArrayItem */.P6.removeArrayItem(columns, column);
|
|
6728
|
+
// const columns = (column.isJustSorted())
|
|
6729
|
+
// ? this.getJustSortedColumns()
|
|
6730
|
+
// : this.getColumns();
|
|
6731
|
+
public_api/* utils.removeArrayItem */.P6.removeArrayItem(this.columns, column);
|
|
6732
|
+
public_api/* utils.removeArrayItem */.P6.removeArrayItem(this.sortedColumns, column);
|
|
6575
6733
|
};
|
|
6576
6734
|
/**
|
|
6577
6735
|
* Adds a condition group - a group of simple conditions (predicates) linked by AND or OR
|
|
@@ -6677,10 +6835,13 @@ var Query = /** @class */ (function () {
|
|
|
6677
6835
|
}
|
|
6678
6836
|
if (columns.length > 0) {
|
|
6679
6837
|
removeFromArray(this.getColumns(), columns);
|
|
6838
|
+
removeFromArray(this.sortedColumns, columns);
|
|
6680
6839
|
}
|
|
6681
6840
|
if (justSortedColumns.length > 0) {
|
|
6682
|
-
removeFromArray(this.getJustSortedColumns(), justSortedColumns);
|
|
6841
|
+
//removeFromArray(this.getJustSortedColumns(), justSortedColumns);
|
|
6842
|
+
removeFromArray(this.sortedColumns, justSortedColumns);
|
|
6683
6843
|
}
|
|
6844
|
+
this.fixupSortingIndices();
|
|
6684
6845
|
};
|
|
6685
6846
|
/**
|
|
6686
6847
|
* Fires process event.
|
|
@@ -6980,7 +7141,7 @@ var BrowserQueryStorage = /** @class */ (function () {
|
|
|
6980
7141
|
BrowserQueryStorage.prototype.newQuery = function (options) {
|
|
6981
7142
|
var _this = this;
|
|
6982
7143
|
return new Promise(function (resolve, reject) {
|
|
6983
|
-
var query = new Query(_this.context.getModel());
|
|
7144
|
+
var query = new Query(_this.context.getModel(), null, { context: _this.context });
|
|
6984
7145
|
query.reset();
|
|
6985
7146
|
query.setDefaultName();
|
|
6986
7147
|
if (options) {
|
|
@@ -7257,7 +7418,7 @@ var EqQueryFileLoader = /** @class */ (function () {
|
|
|
7257
7418
|
});
|
|
7258
7419
|
var request = actionResult.getRequest();
|
|
7259
7420
|
return actionResult.then(function (responseData) {
|
|
7260
|
-
var blob = new Blob([
|
|
7421
|
+
var blob = new Blob([responseData]);
|
|
7261
7422
|
var dispositionHeader = request.getXMLHttpRequest().getResponseHeader("Content-Disposition");
|
|
7262
7423
|
var fileName = dispositionHeader
|
|
7263
7424
|
? dispositionHeader.match(/filename="(.*)"/)[1]
|
|
@@ -7433,7 +7594,7 @@ var EqServiceProvider = /** @class */ (function () {
|
|
|
7433
7594
|
this.httpClient.defaultHeaders['x-eqjs-version'] = '7.2.0';
|
|
7434
7595
|
this.modelResolver = function (_) { return new DataModel(); };
|
|
7435
7596
|
this.modelStorageResolver = null;
|
|
7436
|
-
this.queryResolver = function (context) { return new Query(context.getModel()); };
|
|
7597
|
+
this.queryResolver = function (context) { return new Query(context.getModel(), null, { context: context }); };
|
|
7437
7598
|
this.modelLoaderResolver = function (context) { return new EqServerModelLoader(context); };
|
|
7438
7599
|
this.queryStorageResolver = function (context) { return new BrowserQueryStorage(context); };
|
|
7439
7600
|
this.querySynchronizerResolver = function (context) { return new EqServerQuerySynchronizer(context); };
|
|
@@ -7686,6 +7847,7 @@ var EqActionResult;
|
|
|
7686
7847
|
})(EqActionResult || (EqActionResult = {}));
|
|
7687
7848
|
|
|
7688
7849
|
;// CONCATENATED MODULE: ./src/eqs/eqs_exporter.ts
|
|
7850
|
+
|
|
7689
7851
|
var EqServerExporter = /** @class */ (function () {
|
|
7690
7852
|
function EqServerExporter(context) {
|
|
7691
7853
|
this.context = context;
|
|
@@ -7701,7 +7863,8 @@ var EqServerExporter = /** @class */ (function () {
|
|
|
7701
7863
|
var query = exportOptions.query || this.context.getQuery();
|
|
7702
7864
|
var modelId = query.getModel().getId();
|
|
7703
7865
|
var requestData = {
|
|
7704
|
-
'settings': exportOptions.settings
|
|
7866
|
+
'settings': exportOptions.settings,
|
|
7867
|
+
'chunk': EmptyChunk
|
|
7705
7868
|
};
|
|
7706
7869
|
if (typeof (exportOptions.queryId) !== 'undefined') {
|
|
7707
7870
|
requestData.queryId = exportOptions.queryId;
|
|
@@ -7766,6 +7929,8 @@ var context_assign = (undefined && undefined.__assign) || function () {
|
|
|
7766
7929
|
|
|
7767
7930
|
|
|
7768
7931
|
|
|
7932
|
+
|
|
7933
|
+
|
|
7769
7934
|
/**
|
|
7770
7935
|
* Encapsulates all information about EasyQuery components on some webpage
|
|
7771
7936
|
* and provides some basic operation over those components
|
|
@@ -7778,6 +7943,9 @@ var context_assign = (undefined && undefined.__assign) || function () {
|
|
|
7778
7943
|
var EqContext = /** @class */ (function () {
|
|
7779
7944
|
function EqContext() {
|
|
7780
7945
|
var _this = this;
|
|
7946
|
+
this.options = {
|
|
7947
|
+
syncSortOrderWithColumnsOrder: true
|
|
7948
|
+
};
|
|
7781
7949
|
this.servicesInitialized = false;
|
|
7782
7950
|
this.internalListCache = {};
|
|
7783
7951
|
this.loadModelOnStart = true;
|
|
@@ -7907,8 +8075,8 @@ var EqContext = /** @class */ (function () {
|
|
|
7907
8075
|
return Array.from(this.exporters.keys());
|
|
7908
8076
|
};
|
|
7909
8077
|
EqContext.prototype.addDefaultExporters = function () {
|
|
7910
|
-
this.registerServerExporter('csv', '');
|
|
7911
|
-
this.registerServerExporter('excel-html', '');
|
|
8078
|
+
this.registerServerExporter('csv', 'arraybuffer');
|
|
8079
|
+
this.registerServerExporter('excel-html', 'arraybuffer');
|
|
7912
8080
|
};
|
|
7913
8081
|
EqContext.prototype.resolveEndpoint = function (endpointKey, options) {
|
|
7914
8082
|
options = options || {};
|
|
@@ -7971,6 +8139,7 @@ var EqContext = /** @class */ (function () {
|
|
|
7971
8139
|
if (!this.servicesInitialized)
|
|
7972
8140
|
this.initStart();
|
|
7973
8141
|
options = options || {};
|
|
8142
|
+
this.setOptions(options);
|
|
7974
8143
|
if (typeof (options.debugMode) !== 'undefined') {
|
|
7975
8144
|
this.debugMode = options.debugMode;
|
|
7976
8145
|
}
|
|
@@ -8069,8 +8238,7 @@ var EqContext = /** @class */ (function () {
|
|
|
8069
8238
|
this.exporters.clear();
|
|
8070
8239
|
for (var _i = 0, _a = options.serverExporters; _i < _a.length; _i++) {
|
|
8071
8240
|
var format = _a[_i];
|
|
8072
|
-
|
|
8073
|
-
this.registerServerExporter(format, responseType);
|
|
8241
|
+
this.registerServerExporter(format, "arraybuffer");
|
|
8074
8242
|
}
|
|
8075
8243
|
}
|
|
8076
8244
|
var query = this.getQuery();
|
|
@@ -8092,6 +8260,9 @@ var EqContext = /** @class */ (function () {
|
|
|
8092
8260
|
this.fireEvent('ready');
|
|
8093
8261
|
}
|
|
8094
8262
|
};
|
|
8263
|
+
EqContext.prototype.setOptions = function (options) {
|
|
8264
|
+
public_api/* utils.assignDeep */.P6.assignDeep(this.options, options);
|
|
8265
|
+
};
|
|
8095
8266
|
Object.defineProperty(EqContext.prototype, "backendInfo", {
|
|
8096
8267
|
get: function () {
|
|
8097
8268
|
return this._backendInfo;
|
|
@@ -8549,6 +8720,7 @@ var EqContext = /** @class */ (function () {
|
|
|
8549
8720
|
validate: false
|
|
8550
8721
|
});
|
|
8551
8722
|
}
|
|
8723
|
+
_this.limitCustomSqlColumns();
|
|
8552
8724
|
_this.fireEvent('loadQuery');
|
|
8553
8725
|
_this.endProcess({
|
|
8554
8726
|
result: EqActionResult.Success,
|
|
@@ -9132,6 +9304,7 @@ var EqContext = /** @class */ (function () {
|
|
|
9132
9304
|
EqContext.prototype.exportResult = function (options) {
|
|
9133
9305
|
var _this = this;
|
|
9134
9306
|
options = options || {};
|
|
9307
|
+
options.chunk = options.chunk || EmptyChunk;
|
|
9135
9308
|
if (this.beforeExportResult) {
|
|
9136
9309
|
this.beforeExportResult(this, options);
|
|
9137
9310
|
}
|
|
@@ -9181,6 +9354,15 @@ var EqContext = /** @class */ (function () {
|
|
|
9181
9354
|
}
|
|
9182
9355
|
}
|
|
9183
9356
|
};
|
|
9357
|
+
EqContext.prototype.limitCustomSqlColumns = function () {
|
|
9358
|
+
if (!this.options.allowCustomExpressions) {
|
|
9359
|
+
this.query.getColumns().forEach(function (col) {
|
|
9360
|
+
if (col.expr.tag === ExprTag.CustomSql) {
|
|
9361
|
+
col.enabled = false;
|
|
9362
|
+
}
|
|
9363
|
+
});
|
|
9364
|
+
}
|
|
9365
|
+
};
|
|
9184
9366
|
return EqContext;
|
|
9185
9367
|
}());
|
|
9186
9368
|
|