@easyquery/core 7.2.4-rc01 → 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.
@@ -5677,6 +5677,13 @@ var Query = /** @class */ (function () {
5677
5677
  this._enableAggregation = false;
5678
5678
  this.parentQuery = null;
5679
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
+ }
5680
5687
  this.eventEmitter = new public_api/* EventEmitter */.vp(this);
5681
5688
  this.root = new Condition(this, CondTag.Group);
5682
5689
  this.extraConditions = new Condition(this, CondTag.Group);
@@ -5772,7 +5779,7 @@ var Query = /** @class */ (function () {
5772
5779
  return hasChanged;
5773
5780
  };
5774
5781
  Query.prototype.createSubQuery = function () {
5775
- return new Query(this.model);
5782
+ return new Query(this.model, null, { context: this.context });
5776
5783
  };
5777
5784
  Query.prototype.useAggregation = function (settingsTuner, silent) {
5778
5785
  if (silent === void 0) { silent = false; }
@@ -6113,7 +6120,7 @@ var Query = /** @class */ (function () {
6113
6120
  }
6114
6121
  }
6115
6122
  this.sortedColumns.sort(function (col1, col2) {
6116
- return col1.sortIndex - col2.sortIndex;
6123
+ return col1._sortIndex - col2._sortIndex;
6117
6124
  });
6118
6125
  this.fixupSortingIndices();
6119
6126
  if (data.extraData) {
@@ -6440,6 +6447,7 @@ var Query = /** @class */ (function () {
6440
6447
  }
6441
6448
  public_api/* utils.moveArrayItem */.P6.moveArrayItem(this.sortedColumns, colIdx, index);
6442
6449
  this.fixupSortingIndices();
6450
+ this.fireColumnsChangedEvent(QueryChangeAction.All);
6443
6451
  };
6444
6452
  Query.prototype.getColumnSorting = function (col) {
6445
6453
  var idx = this.getColumnSortIndex(col);
@@ -6465,12 +6473,34 @@ var Query = /** @class */ (function () {
6465
6473
  this.fixupSortingIndices();
6466
6474
  }
6467
6475
  }
6476
+ this.adjustColumnsSorting();
6477
+ this.fireColumnsChangedEvent(QueryChangeAction.Modify, col, col.isJustSorted());
6468
6478
  };
6469
6479
  Query.prototype.fixupSortingIndices = function () {
6470
6480
  this.sortedColumns.forEach(function (col, index) {
6471
6481
  col._sortIndex = index;
6472
6482
  });
6473
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();
6503
+ };
6474
6504
  Query.prototype.createColumn = function (justsorted) {
6475
6505
  if (justsorted === void 0) { justsorted = false; }
6476
6506
  return new QueryColumn(this, justsorted);
@@ -6687,6 +6717,7 @@ var Query = /** @class */ (function () {
6687
6717
  Query.prototype.moveColumn = function (index1, index2) {
6688
6718
  var columns = this.getColumns();
6689
6719
  public_api/* utils.moveArrayItem */.P6.moveArrayItem(columns, index1, index2);
6720
+ this.adjustColumnsSorting();
6690
6721
  };
6691
6722
  /**
6692
6723
  * Removes the column.
@@ -7110,7 +7141,7 @@ var BrowserQueryStorage = /** @class */ (function () {
7110
7141
  BrowserQueryStorage.prototype.newQuery = function (options) {
7111
7142
  var _this = this;
7112
7143
  return new Promise(function (resolve, reject) {
7113
- var query = new Query(_this.context.getModel());
7144
+ var query = new Query(_this.context.getModel(), null, { context: _this.context });
7114
7145
  query.reset();
7115
7146
  query.setDefaultName();
7116
7147
  if (options) {
@@ -7563,7 +7594,7 @@ var EqServiceProvider = /** @class */ (function () {
7563
7594
  this.httpClient.defaultHeaders['x-eqjs-version'] = '7.2.0';
7564
7595
  this.modelResolver = function (_) { return new DataModel(); };
7565
7596
  this.modelStorageResolver = null;
7566
- this.queryResolver = function (context) { return new Query(context.getModel()); };
7597
+ this.queryResolver = function (context) { return new Query(context.getModel(), null, { context: context }); };
7567
7598
  this.modelLoaderResolver = function (context) { return new EqServerModelLoader(context); };
7568
7599
  this.queryStorageResolver = function (context) { return new BrowserQueryStorage(context); };
7569
7600
  this.querySynchronizerResolver = function (context) { return new EqServerQuerySynchronizer(context); };
@@ -7912,7 +7943,9 @@ var context_assign = (undefined && undefined.__assign) || function () {
7912
7943
  var EqContext = /** @class */ (function () {
7913
7944
  function EqContext() {
7914
7945
  var _this = this;
7915
- this.options = {};
7946
+ this.options = {
7947
+ syncSortOrderWithColumnsOrder: true
7948
+ };
7916
7949
  this.servicesInitialized = false;
7917
7950
  this.internalListCache = {};
7918
7951
  this.loadModelOnStart = true;
@@ -8042,8 +8075,8 @@ var EqContext = /** @class */ (function () {
8042
8075
  return Array.from(this.exporters.keys());
8043
8076
  };
8044
8077
  EqContext.prototype.addDefaultExporters = function () {
8045
- this.registerServerExporter('csv', '');
8046
- this.registerServerExporter('excel-html', '');
8078
+ this.registerServerExporter('csv', 'arraybuffer');
8079
+ this.registerServerExporter('excel-html', 'arraybuffer');
8047
8080
  };
8048
8081
  EqContext.prototype.resolveEndpoint = function (endpointKey, options) {
8049
8082
  options = options || {};
@@ -8205,8 +8238,7 @@ var EqContext = /** @class */ (function () {
8205
8238
  this.exporters.clear();
8206
8239
  for (var _i = 0, _a = options.serverExporters; _i < _a.length; _i++) {
8207
8240
  var format = _a[_i];
8208
- var responseType = format == 'csv' || format == 'excel-html' ? '' : 'arraybuffer';
8209
- this.registerServerExporter(format, responseType);
8241
+ this.registerServerExporter(format, "arraybuffer");
8210
8242
  }
8211
8243
  }
8212
8244
  var query = this.getQuery();