@easyquery/ui 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.
Files changed (37) hide show
  1. package/dist/assets/css/easyquery.css +5 -2
  2. package/dist/assets/css/eqview.css +4 -5
  3. package/dist/browser/eq.community.css.map +1 -1
  4. package/dist/browser/eq.community.js +437 -197
  5. package/dist/browser/eq.community.js.map +1 -1
  6. package/dist/browser/eq.community.min.js +1 -1
  7. package/dist/browser/eq.community.min.js.map +1 -1
  8. package/dist/browser/eq.core.css +6 -3
  9. package/dist/browser/eq.core.min.css +1 -1
  10. package/dist/browser/eq.view.css +5 -6
  11. package/dist/browser/eq.view.css.map +1 -1
  12. package/dist/browser/eq.view.min.css +1 -1
  13. package/dist/bundles/easyquery.ui.js +191 -133
  14. package/dist/bundles/easyquery.ui.js.map +1 -1
  15. package/dist/bundles/easyquery.ui.min.js +1 -1
  16. package/dist/bundles/easyquery.ui.min.js.map +1 -1
  17. package/dist/lib/widgets/columns_bar.js +9 -4
  18. package/dist/lib/widgets/columns_bar.js.map +1 -1
  19. package/dist/lib/widgets/columns_panel.js +2 -1
  20. package/dist/lib/widgets/columns_panel.js.map +1 -1
  21. package/dist/lib/widgets/manage_drilldown_widget.js +2 -1
  22. package/dist/lib/widgets/manage_drilldown_widget.js.map +1 -1
  23. package/dist/lib/widgets/renderers/columnsbar/column_renderer_cb.js +1 -1
  24. package/dist/lib/widgets/renderers/columnsbar/column_renderer_cb.js.map +1 -1
  25. package/dist/lib/widgets/renderers/columnspanel/column_renderer_cp.d.ts +2 -0
  26. package/dist/lib/widgets/renderers/columnspanel/column_renderer_cp.js +22 -12
  27. package/dist/lib/widgets/renderers/columnspanel/column_renderer_cp.js.map +1 -1
  28. package/dist/lib/widgets/renderers/columnspanel/customsql_column_renderer.d.ts +0 -1
  29. package/dist/lib/widgets/renderers/columnspanel/customsql_column_renderer.js +0 -7
  30. package/dist/lib/widgets/renderers/columnspanel/customsql_column_renderer.js.map +1 -1
  31. package/dist/lib/widgets/renderers/sortingbar/column_renderer_sp.js +23 -2
  32. package/dist/lib/widgets/renderers/sortingbar/column_renderer_sp.js.map +1 -1
  33. package/dist/lib/widgets/sorting_bar.d.ts +7 -4
  34. package/dist/lib/widgets/sorting_bar.js +135 -108
  35. package/dist/lib/widgets/sorting_bar.js.map +1 -1
  36. package/dist/lib/widgets/widget_options.d.ts +2 -0
  37. package/package.json +4 -4
@@ -1,5 +1,5 @@
1
1
  /**
2
- * EasyQuery.JS Community 7.2.4-beta03 (https://korzh.com/easyquery/javascript)
2
+ * EasyQuery.JS Community 7.2.4-rc02 (https://korzh.com/easyquery/javascript)
3
3
  * Copyright 2023 Korzh.com. All rights reserved.
4
4
  *
5
5
  * EasyQuery.JS commercial licenses may be obtained at
@@ -12013,6 +12013,7 @@ __webpack_require__.d(public_api_namespaceObject, {
12013
12013
  DataModel: function() { return DataModel; },
12014
12014
  DefaultAggregatesCalculator: function() { return DefaultAggregatesCalculator; },
12015
12015
  EasyQueryDataLoader: function() { return EasyQueryDataLoader; },
12016
+ EmptyChunk: function() { return EmptyChunk; },
12016
12017
  Entity: function() { return Entity; },
12017
12018
  EntityAttr: function() { return EntityAttr; },
12018
12019
  EqAction: function() { return EqAction; },
@@ -12389,6 +12390,14 @@ var eqconsts;
12389
12390
  ];
12390
12391
  })(eqconsts || (eqconsts = {}));
12391
12392
  //# sourceMappingURL=constants.js.map
12393
+ ;// CONCATENATED MODULE: ../core/dist/lib/export/exporter.js
12394
+ //possibly move it to the EasyData lib on the next update
12395
+ var EmptyChunk = {
12396
+ offset: 0,
12397
+ limit: 0,
12398
+ needTotal: false
12399
+ };
12400
+ //# sourceMappingURL=exporter.js.map
12392
12401
  ;// CONCATENATED MODULE: ../core/dist/lib/dm/aggr_function.js
12393
12402
 
12394
12403
  /**
@@ -13975,12 +13984,14 @@ var QueryColumn = /** @class */ (function () {
13975
13984
  /** The parameters associated with this column */
13976
13985
  this.params = [];
13977
13986
  this._isHidden = false;
13987
+ this.query = query;
13978
13988
  this._id = public_api.utils.generateId('col');
13979
13989
  this.caption = '';
13980
- this.sorting = SortDirection.None;
13981
- this.sortIndex = -1;
13990
+ this._sorting = SortDirection.None;
13991
+ this._sortIndex = -1;
13982
13992
  this.expr = new Expression(this);
13983
13993
  this.blockId = '';
13994
+ this.justsorted = justsorted;
13984
13995
  }
13985
13996
  Object.defineProperty(QueryColumn.prototype, "id", {
13986
13997
  get: function () {
@@ -13989,6 +14000,51 @@ var QueryColumn = /** @class */ (function () {
13989
14000
  enumerable: false,
13990
14001
  configurable: true
13991
14002
  });
14003
+ Object.defineProperty(QueryColumn.prototype, "sorting", {
14004
+ /** Column sorting direction */
14005
+ get: function () {
14006
+ if (this.query) {
14007
+ return this.query.getColumnSorting(this);
14008
+ }
14009
+ else {
14010
+ return this._sorting;
14011
+ }
14012
+ },
14013
+ set: function (direction) {
14014
+ if (this.query) {
14015
+ this.query.setColumnSorting(this, direction);
14016
+ }
14017
+ else {
14018
+ this._sorting = direction;
14019
+ }
14020
+ },
14021
+ enumerable: false,
14022
+ configurable: true
14023
+ });
14024
+ ;
14025
+ Object.defineProperty(QueryColumn.prototype, "sortIndex", {
14026
+ /** The index of the column in the sorting list. */
14027
+ get: function () {
14028
+ if (this.query) {
14029
+ return this.query.getColumnSortIndex(this);
14030
+ }
14031
+ else {
14032
+ return this._sortIndex;
14033
+ }
14034
+ },
14035
+ set: function (index) {
14036
+ if (this.query) {
14037
+ this.query.setColumnSortIndex(this, index);
14038
+ }
14039
+ else {
14040
+ this._sortIndex = index;
14041
+ }
14042
+ },
14043
+ enumerable: false,
14044
+ configurable: true
14045
+ });
14046
+ ;
14047
+ ;
13992
14048
  QueryColumn.prototype.getModel = function () {
13993
14049
  return this.query.getModel();
13994
14050
  };
@@ -14043,8 +14099,8 @@ var QueryColumn = /** @class */ (function () {
14043
14099
  }
14044
14100
  this.caption = colData.cptn;
14045
14101
  if (typeof colData.srt !== 'undefined') {
14046
- this.sorting = colData.srt;
14047
- this.sortIndex = (typeof colData.srtidx !== 'undefined')
14102
+ this._sorting = colData.srt;
14103
+ this._sortIndex = (typeof colData.srtidx !== 'undefined')
14048
14104
  ? colData.srtidx
14049
14105
  : -1;
14050
14106
  }
@@ -14070,7 +14126,7 @@ var QueryColumn = /** @class */ (function () {
14070
14126
  if (typeof this.caption !== 'undefined') {
14071
14127
  obj.cptn = this.caption;
14072
14128
  }
14073
- if (typeof this.sorting !== 'undefined' && this.sorting != SortDirection.None) {
14129
+ if (this.sorting != SortDirection.None) {
14074
14130
  obj.srt = this.sorting;
14075
14131
  obj.srtidx = this.sortIndex;
14076
14132
  }
@@ -14534,11 +14590,19 @@ var Query = /** @class */ (function () {
14534
14590
  this._enableAggregation = false;
14535
14591
  this.parentQuery = null;
14536
14592
  this.drillDowns = [];
14593
+ this.syncSortOrderWithColumnsOrder = true;
14594
+ if (options) {
14595
+ this.context = options.context;
14596
+ if (this.context) {
14597
+ this.syncSortOrderWithColumnsOrder = this.context.options.syncSortOrderWithColumnsOrder;
14598
+ }
14599
+ }
14537
14600
  this.eventEmitter = new public_api.EventEmitter(this);
14538
14601
  this.root = new Condition(this, CondTag.Group);
14539
14602
  this.extraConditions = new Condition(this, CondTag.Group);
14540
14603
  this.columns = new Array();
14541
- this.justsorted = new Array();
14604
+ //this.justsorted = new Array<QueryColumn>();
14605
+ this.sortedColumns = new Array();
14542
14606
  if (!this.id) {
14543
14607
  this.regenerateId();
14544
14608
  }
@@ -14628,7 +14692,7 @@ var Query = /** @class */ (function () {
14628
14692
  return hasChanged;
14629
14693
  };
14630
14694
  Query.prototype.createSubQuery = function () {
14631
- return new Query(this.model);
14695
+ return new Query(this.model, null, { context: this.context });
14632
14696
  };
14633
14697
  Query.prototype.useAggregation = function (settingsTuner, silent) {
14634
14698
  if (silent === void 0) { silent = false; }
@@ -14689,6 +14753,7 @@ var Query = /** @class */ (function () {
14689
14753
  });
14690
14754
  };
14691
14755
  Query.prototype.processQueryForAggregation = function (silent) {
14756
+ var _this = this;
14692
14757
  if (silent === void 0) { silent = false; }
14693
14758
  var aggrSettings = this.getAggregationSettings();
14694
14759
  var groups = aggrSettings.getGroups();
@@ -14702,19 +14767,21 @@ var Query = /** @class */ (function () {
14702
14767
  if (groupColIds.indexOf(col.id) >= 0) {
14703
14768
  groupedCols.push(col);
14704
14769
  }
14705
- else if (col.sorting != SortDirection.None) {
14770
+ else if (this.getColumnSorting(col) != SortDirection.None) {
14706
14771
  sortedCols.push(col);
14707
14772
  }
14708
14773
  }
14709
14774
  var sortIndex_1 = 0;
14710
14775
  groupedCols.forEach(function (col) {
14711
- if (col.sorting == SortDirection.None) {
14712
- col.sorting = SortDirection.Ascending;
14776
+ if (_this.getColumnSorting(col) == SortDirection.None) {
14777
+ _this.setColumnSorting(col, SortDirection.Ascending);
14713
14778
  }
14714
- col.sortIndex = sortIndex_1++;
14779
+ _this.setColumnSortIndex(col, sortIndex_1++);
14780
+ //col.sortIndex = sortIndex++;
14715
14781
  });
14716
14782
  sortedCols.forEach(function (col) {
14717
- col.sortIndex = sortIndex_1++;
14783
+ _this.setColumnSortIndex(col, sortIndex_1++);
14784
+ // col.sortIndex = sortIndex++;
14718
14785
  });
14719
14786
  if (!silent) {
14720
14787
  this.fireChangedEvent({
@@ -14945,12 +15012,14 @@ var Query = /** @class */ (function () {
14945
15012
  }
14946
15013
  this.name = data.name;
14947
15014
  this.description = data.desc;
14948
- this.justsorted = [];
15015
+ //this.justsorted = [];
15016
+ this.sortedColumns = [];
14949
15017
  if (data.justsortcols) {
14950
15018
  for (var i = 0; i < data.justsortcols.length; i++) {
14951
15019
  var newCol = this.createColumn(true);
14952
15020
  newCol.loadFromData(this.model, data.justsortcols[i]);
14953
- this.justsorted.push(newCol);
15021
+ //this.justsorted.push(newCol);
15022
+ this.addColumnToSorted(newCol);
14954
15023
  }
14955
15024
  }
14956
15025
  if (data.cols) {
@@ -14958,8 +15027,15 @@ var Query = /** @class */ (function () {
14958
15027
  var newCol = this.createColumn();
14959
15028
  newCol.loadFromData(this.model, data.cols[i]);
14960
15029
  this.columns.push(newCol);
15030
+ if (newCol._sorting != SortDirection.None) {
15031
+ this.addColumnToSorted(newCol);
15032
+ }
14961
15033
  }
14962
15034
  }
15035
+ this.sortedColumns.sort(function (col1, col2) {
15036
+ return col1._sortIndex - col2._sortIndex;
15037
+ });
15038
+ this.fixupSortingIndices();
14963
15039
  if (data.extraData) {
14964
15040
  this.extraData = data.extraData;
14965
15041
  }
@@ -15049,6 +15125,7 @@ var Query = /** @class */ (function () {
15049
15125
  */
15050
15126
  Query.prototype.toJSONData = function () {
15051
15127
  var _this = this;
15128
+ this.fixupSortingIndices();
15052
15129
  var obj = {
15053
15130
  modelId: this.model ? this.model.getId() : null,
15054
15131
  modelName: this.model ? this.model.getName() : null
@@ -15063,9 +15140,14 @@ var Query = /** @class */ (function () {
15063
15140
  obj.cols.push(this.columns[i].saveToData());
15064
15141
  }
15065
15142
  obj.justsortcols = [];
15066
- for (var i = 0; i < this.justsorted.length; i++) {
15067
- obj.justsortcols.push(this.justsorted[i].saveToData());
15068
- }
15143
+ // for (let i = 0; i < this.justsorted.length; i++) {
15144
+ // obj.justsortcols.push(this.justsorted[i].saveToData());
15145
+ // }
15146
+ this.sortedColumns.forEach(function (col) {
15147
+ if (col.isJustSorted()) {
15148
+ obj.justsortcols.push(col.saveToData());
15149
+ }
15150
+ });
15069
15151
  if (this.extraData) {
15070
15152
  obj.extraData = this.extraData;
15071
15153
  }
@@ -15138,7 +15220,8 @@ var Query = /** @class */ (function () {
15138
15220
  */
15139
15221
  Query.prototype.clearColumns = function () {
15140
15222
  this.columns = [];
15141
- this.justsorted = [];
15223
+ //this.justsorted = [];
15224
+ this.sortedColumns = [];
15142
15225
  };
15143
15226
  /**
15144
15227
  * Clears all conditions in query.
@@ -15230,31 +15313,34 @@ var Query = /** @class */ (function () {
15230
15313
  cols.pop();
15231
15314
  return cols;
15232
15315
  };
15316
+ Query.prototype.addColumnToSorted = function (col) {
15317
+ var colJson = JSON.stringify(col.expr.saveToData());
15318
+ var isUnique = true;
15319
+ this.sortedColumns.forEach(function (scol) {
15320
+ var qcolJson = JSON.stringify(scol.expr.saveToData());
15321
+ if (qcolJson === colJson) {
15322
+ isUnique = false;
15323
+ }
15324
+ });
15325
+ if (isUnique) {
15326
+ this.sortedColumns.push(col);
15327
+ }
15328
+ };
15233
15329
  /**
15234
15330
  * Get array of columns used only in sorting.
15235
15331
  * @retruns Columns.
15236
15332
  */
15237
15333
  Query.prototype.getJustSortedColumns = function () {
15238
- return this.justsorted;
15334
+ return this.sortedColumns.filter(function (col) {
15335
+ return col.isJustSorted();
15336
+ });
15239
15337
  };
15240
15338
  /**
15241
15339
  * Gets array of columns used in sorting
15242
15340
  * @retruns Columns
15243
15341
  */
15244
15342
  Query.prototype.getSortedColumns = function () {
15245
- var sortedCols = new Array();
15246
- var cols = this.getColumns()
15247
- .concat(this.getJustSortedColumns());
15248
- for (var i = 0; i < cols.length; i++) {
15249
- var col = cols[i];
15250
- if (col.sortIndex >= 0) {
15251
- sortedCols.push(col);
15252
- }
15253
- }
15254
- sortedCols.sort(function (col1, col2) {
15255
- return col1.sortIndex - col2.sortIndex;
15256
- });
15257
- return sortedCols;
15343
+ return this.sortedColumns;
15258
15344
  };
15259
15345
  /**
15260
15346
  * Gets Colummn sorting index.
@@ -15262,17 +15348,71 @@ var Query = /** @class */ (function () {
15262
15348
  * @retruns The index.
15263
15349
  */
15264
15350
  Query.prototype.getColumnSortIndex = function (col) {
15265
- if (col.sorting != SortDirection.None) {
15266
- if (col.sortIndex < 0) {
15267
- var cols = this.getColumns()
15268
- .concat(this.getJustSortedColumns());
15269
- return public_api.utils.indexOfArrayItem(cols, col);
15351
+ return this.sortedColumns.indexOf(col);
15352
+ };
15353
+ Query.prototype.setColumnSortIndex = function (col, index) {
15354
+ if (index < 0)
15355
+ return;
15356
+ var colIdx = this.getColumnSortIndex(col);
15357
+ if (colIdx < 0) {
15358
+ this.addColumnToSorted(col);
15359
+ colIdx = this.sortedColumns.length - 1;
15360
+ }
15361
+ public_api.utils.moveArrayItem(this.sortedColumns, colIdx, index);
15362
+ this.fixupSortingIndices();
15363
+ this.fireColumnsChangedEvent(QueryChangeAction.All);
15364
+ };
15365
+ Query.prototype.getColumnSorting = function (col) {
15366
+ var idx = this.getColumnSortIndex(col);
15367
+ if (idx >= 0) {
15368
+ return col._sorting != SortDirection.None ? col._sorting : SortDirection.Ascending;
15369
+ }
15370
+ else {
15371
+ return SortDirection.None;
15372
+ }
15373
+ };
15374
+ Query.prototype.setColumnSorting = function (col, direction) {
15375
+ var idx = this.getColumnSortIndex(col);
15376
+ col._sorting = direction;
15377
+ if (idx >= 0) {
15378
+ if (direction == SortDirection.None) {
15379
+ public_api.utils.removeArrayItem(this.sortedColumns, col);
15380
+ this.fixupSortingIndices();
15270
15381
  }
15271
- else {
15272
- return col.sortIndex;
15382
+ }
15383
+ else {
15384
+ if (direction != SortDirection.None) {
15385
+ this.addColumnToSorted(col);
15386
+ this.fixupSortingIndices();
15273
15387
  }
15274
15388
  }
15275
- return -1;
15389
+ this.adjustColumnsSorting();
15390
+ this.fireColumnsChangedEvent(QueryChangeAction.Modify, col, col.isJustSorted());
15391
+ };
15392
+ Query.prototype.fixupSortingIndices = function () {
15393
+ this.sortedColumns.forEach(function (col, index) {
15394
+ col._sortIndex = index;
15395
+ });
15396
+ };
15397
+ Query.prototype.adjustColumnsSorting = function () {
15398
+ var _this = this;
15399
+ if (!this.syncSortOrderWithColumnsOrder) {
15400
+ return;
15401
+ }
15402
+ if (this.getJustSortedColumns().length > 0) {
15403
+ return;
15404
+ }
15405
+ var idx = 0;
15406
+ this.columns.forEach(function (col) {
15407
+ if (col.sorting != SortDirection.None) {
15408
+ var colIdx = _this.getColumnSortIndex(col);
15409
+ if (colIdx >= 0) {
15410
+ public_api.utils.moveArrayItem(_this.sortedColumns, colIdx, idx);
15411
+ idx++;
15412
+ }
15413
+ }
15414
+ });
15415
+ this.fixupSortingIndices();
15276
15416
  };
15277
15417
  Query.prototype.createColumn = function (justsorted) {
15278
15418
  if (justsorted === void 0) { justsorted = false; }
@@ -15297,9 +15437,9 @@ var Query = /** @class */ (function () {
15297
15437
  * }});
15298
15438
  */
15299
15439
  Query.prototype.addColumn = function (descriptor, author) {
15300
- var columns = (descriptor.justsorted)
15301
- ? this.justsorted
15302
- : this.columns;
15440
+ // let columns = (descriptor.justsorted)
15441
+ // ? this.justsorted
15442
+ // : this.columns;
15303
15443
  var newColumn;
15304
15444
  if (descriptor.column) {
15305
15445
  newColumn = descriptor.column;
@@ -15361,17 +15501,22 @@ var Query = /** @class */ (function () {
15361
15501
  newColumn.expr.dataType = attr.dataType;
15362
15502
  }
15363
15503
  newColumn.caption = descriptor.caption || newColumn.caption;
15364
- newColumn.sorting = descriptor.sorting || SortDirection.None;
15365
- newColumn.sortIndex = descriptor.sortIndex || -1;
15504
+ newColumn._sorting = descriptor.sorting || SortDirection.None;
15505
+ newColumn._sortIndex = descriptor.sortIndex || -1;
15366
15506
  newColumn.enabled = public_api.utils.getIfDefined(descriptor.enabled, true);
15367
15507
  newColumn.setReadOnly(public_api.utils.getIfDefined(descriptor.readonly, false));
15368
15508
  }
15369
- if (descriptor.index && descriptor.index >= 0 && descriptor.index < columns.length) {
15370
- columns.splice(descriptor.index, 0, newColumn);
15371
- }
15372
- else {
15373
- columns.push(newColumn);
15509
+ var justsorted = descriptor.justsorted || (descriptor.column && descriptor.column.isJustSorted());
15510
+ if (!justsorted) {
15511
+ if (descriptor.index && descriptor.index >= 0 && descriptor.index < this.columns.length) {
15512
+ this.columns.splice(descriptor.index, 0, newColumn);
15513
+ }
15514
+ else {
15515
+ this.columns.push(newColumn);
15516
+ }
15374
15517
  }
15518
+ this.setColumnSorting(newColumn, newColumn._sorting);
15519
+ this.fireColumnsChangedEvent(QueryChangeAction.Add, newColumn, justsorted);
15375
15520
  return newColumn;
15376
15521
  };
15377
15522
  /**
@@ -15386,6 +15531,7 @@ var Query = /** @class */ (function () {
15386
15531
  * query.addColumn(column, 1)
15387
15532
  */
15388
15533
  Query.prototype.addColumnObj = function (column, index, author) {
15534
+ var _this = this;
15389
15535
  var columns = this.columns;
15390
15536
  if (typeof column.length == "undefined") {
15391
15537
  if (typeof index == "number") {
@@ -15394,6 +15540,10 @@ var Query = /** @class */ (function () {
15394
15540
  else {
15395
15541
  columns.push(column);
15396
15542
  }
15543
+ if (column.sorting != SortDirection.None) {
15544
+ this.addColumnToSorted(column);
15545
+ }
15546
+ this.fixupSortingIndices();
15397
15547
  }
15398
15548
  else {
15399
15549
  if (typeof index == "number") {
@@ -15402,6 +15552,12 @@ var Query = /** @class */ (function () {
15402
15552
  else {
15403
15553
  columns.push.apply(columns, [].concat(column));
15404
15554
  }
15555
+ column.forEach(function (col) {
15556
+ if (col.sorting != SortDirection.None) {
15557
+ _this.addColumnToSorted(col);
15558
+ }
15559
+ });
15560
+ this.fixupSortingIndices();
15405
15561
  }
15406
15562
  };
15407
15563
  /**
@@ -15474,6 +15630,7 @@ var Query = /** @class */ (function () {
15474
15630
  Query.prototype.moveColumn = function (index1, index2) {
15475
15631
  var columns = this.getColumns();
15476
15632
  public_api.utils.moveArrayItem(columns, index1, index2);
15633
+ this.adjustColumnsSorting();
15477
15634
  };
15478
15635
  /**
15479
15636
  * Removes the column.
@@ -15481,10 +15638,11 @@ var Query = /** @class */ (function () {
15481
15638
  * @param author The author
15482
15639
  */
15483
15640
  Query.prototype.removeColumn = function (column, author) {
15484
- var columns = (column.isJustSorted())
15485
- ? this.getJustSortedColumns()
15486
- : this.getColumns();
15487
- public_api.utils.removeArrayItem(columns, column);
15641
+ // const columns = (column.isJustSorted())
15642
+ // ? this.getJustSortedColumns()
15643
+ // : this.getColumns();
15644
+ public_api.utils.removeArrayItem(this.columns, column);
15645
+ public_api.utils.removeArrayItem(this.sortedColumns, column);
15488
15646
  };
15489
15647
  /**
15490
15648
  * Adds a condition group - a group of simple conditions (predicates) linked by AND or OR
@@ -15590,10 +15748,13 @@ var Query = /** @class */ (function () {
15590
15748
  }
15591
15749
  if (columns.length > 0) {
15592
15750
  removeFromArray(this.getColumns(), columns);
15751
+ removeFromArray(this.sortedColumns, columns);
15593
15752
  }
15594
15753
  if (justSortedColumns.length > 0) {
15595
- removeFromArray(this.getJustSortedColumns(), justSortedColumns);
15754
+ //removeFromArray(this.getJustSortedColumns(), justSortedColumns);
15755
+ removeFromArray(this.sortedColumns, justSortedColumns);
15596
15756
  }
15757
+ this.fixupSortingIndices();
15597
15758
  };
15598
15759
  /**
15599
15760
  * Fires process event.
@@ -15894,7 +16055,7 @@ var BrowserQueryStorage = /** @class */ (function () {
15894
16055
  BrowserQueryStorage.prototype.newQuery = function (options) {
15895
16056
  var _this = this;
15896
16057
  return new Promise(function (resolve, reject) {
15897
- var query = new Query(_this.context.getModel());
16058
+ var query = new Query(_this.context.getModel(), null, { context: _this.context });
15898
16059
  query.reset();
15899
16060
  query.setDefaultName();
15900
16061
  if (options) {
@@ -16172,7 +16333,7 @@ var EqQueryFileLoader = /** @class */ (function () {
16172
16333
  });
16173
16334
  var request = actionResult.getRequest();
16174
16335
  return actionResult.then(function (responseData) {
16175
- var blob = new Blob([JSON.stringify(responseData)]);
16336
+ var blob = new Blob([responseData]);
16176
16337
  var dispositionHeader = request.getXMLHttpRequest().getResponseHeader("Content-Disposition");
16177
16338
  var fileName = dispositionHeader
16178
16339
  ? dispositionHeader.match(/filename="(.*)"/)[1]
@@ -16349,7 +16510,7 @@ var EqServiceProvider = /** @class */ (function () {
16349
16510
  this.httpClient.defaultHeaders['x-eqjs-version'] = '7.2.0';
16350
16511
  this.modelResolver = function (_) { return new DataModel(); };
16351
16512
  this.modelStorageResolver = null;
16352
- this.queryResolver = function (context) { return new Query(context.getModel()); };
16513
+ this.queryResolver = function (context) { return new Query(context.getModel(), null, { context: context }); };
16353
16514
  this.modelLoaderResolver = function (context) { return new EqServerModelLoader(context); };
16354
16515
  this.queryStorageResolver = function (context) { return new BrowserQueryStorage(context); };
16355
16516
  this.querySynchronizerResolver = function (context) { return new EqServerQuerySynchronizer(context); };
@@ -16604,6 +16765,7 @@ var EqActionResult;
16604
16765
  })(EqActionResult || (EqActionResult = {}));
16605
16766
  //# sourceMappingURL=action.js.map
16606
16767
  ;// CONCATENATED MODULE: ../core/dist/lib/eqs/eqs_exporter.js
16768
+
16607
16769
  var EqServerExporter = /** @class */ (function () {
16608
16770
  function EqServerExporter(context) {
16609
16771
  this.context = context;
@@ -16619,7 +16781,8 @@ var EqServerExporter = /** @class */ (function () {
16619
16781
  var query = exportOptions.query || this.context.getQuery();
16620
16782
  var modelId = query.getModel().getId();
16621
16783
  var requestData = {
16622
- 'settings': exportOptions.settings
16784
+ 'settings': exportOptions.settings,
16785
+ 'chunk': EmptyChunk
16623
16786
  };
16624
16787
  if (typeof (exportOptions.queryId) !== 'undefined') {
16625
16788
  requestData.queryId = exportOptions.queryId;
@@ -16684,6 +16847,8 @@ var context_assign = (undefined && undefined.__assign) || function () {
16684
16847
 
16685
16848
 
16686
16849
 
16850
+
16851
+
16687
16852
  /**
16688
16853
  * Encapsulates all information about EasyQuery components on some webpage
16689
16854
  * and provides some basic operation over those components
@@ -16696,6 +16861,9 @@ var context_assign = (undefined && undefined.__assign) || function () {
16696
16861
  var EqContext = /** @class */ (function () {
16697
16862
  function EqContext() {
16698
16863
  var _this = this;
16864
+ this.options = {
16865
+ syncSortOrderWithColumnsOrder: true
16866
+ };
16699
16867
  this.servicesInitialized = false;
16700
16868
  this.internalListCache = {};
16701
16869
  this.loadModelOnStart = true;
@@ -16825,8 +16993,8 @@ var EqContext = /** @class */ (function () {
16825
16993
  return Array.from(this.exporters.keys());
16826
16994
  };
16827
16995
  EqContext.prototype.addDefaultExporters = function () {
16828
- this.registerServerExporter('csv', '');
16829
- this.registerServerExporter('excel-html', '');
16996
+ this.registerServerExporter('csv', 'arraybuffer');
16997
+ this.registerServerExporter('excel-html', 'arraybuffer');
16830
16998
  };
16831
16999
  EqContext.prototype.resolveEndpoint = function (endpointKey, options) {
16832
17000
  options = options || {};
@@ -16889,6 +17057,7 @@ var EqContext = /** @class */ (function () {
16889
17057
  if (!this.servicesInitialized)
16890
17058
  this.initStart();
16891
17059
  options = options || {};
17060
+ this.setOptions(options);
16892
17061
  if (typeof (options.debugMode) !== 'undefined') {
16893
17062
  this.debugMode = options.debugMode;
16894
17063
  }
@@ -16987,8 +17156,7 @@ var EqContext = /** @class */ (function () {
16987
17156
  this.exporters.clear();
16988
17157
  for (var _i = 0, _a = options.serverExporters; _i < _a.length; _i++) {
16989
17158
  var format = _a[_i];
16990
- var responseType = format == 'csv' || format == 'excel-html' ? '' : 'arraybuffer';
16991
- this.registerServerExporter(format, responseType);
17159
+ this.registerServerExporter(format, "arraybuffer");
16992
17160
  }
16993
17161
  }
16994
17162
  var query = this.getQuery();
@@ -17010,6 +17178,9 @@ var EqContext = /** @class */ (function () {
17010
17178
  this.fireEvent('ready');
17011
17179
  }
17012
17180
  };
17181
+ EqContext.prototype.setOptions = function (options) {
17182
+ public_api.utils.assignDeep(this.options, options);
17183
+ };
17013
17184
  Object.defineProperty(EqContext.prototype, "backendInfo", {
17014
17185
  get: function () {
17015
17186
  return this._backendInfo;
@@ -17467,6 +17638,7 @@ var EqContext = /** @class */ (function () {
17467
17638
  validate: false
17468
17639
  });
17469
17640
  }
17641
+ _this.limitCustomSqlColumns();
17470
17642
  _this.fireEvent('loadQuery');
17471
17643
  _this.endProcess({
17472
17644
  result: EqActionResult.Success,
@@ -18050,6 +18222,7 @@ var EqContext = /** @class */ (function () {
18050
18222
  EqContext.prototype.exportResult = function (options) {
18051
18223
  var _this = this;
18052
18224
  options = options || {};
18225
+ options.chunk = options.chunk || EmptyChunk;
18053
18226
  if (this.beforeExportResult) {
18054
18227
  this.beforeExportResult(this, options);
18055
18228
  }
@@ -18099,6 +18272,15 @@ var EqContext = /** @class */ (function () {
18099
18272
  }
18100
18273
  }
18101
18274
  };
18275
+ EqContext.prototype.limitCustomSqlColumns = function () {
18276
+ if (!this.options.allowCustomExpressions) {
18277
+ this.query.getColumns().forEach(function (col) {
18278
+ if (col.expr.tag === ExprTag.CustomSql) {
18279
+ col.enabled = false;
18280
+ }
18281
+ });
18282
+ }
18283
+ };
18102
18284
  return EqContext;
18103
18285
  }());
18104
18286
 
@@ -20318,10 +20500,20 @@ var ColumnRendererCP = /** @class */ (function () {
20318
20500
  enumerable: false,
20319
20501
  configurable: true
20320
20502
  });
20503
+ Object.defineProperty(ColumnRendererCP.prototype, "columnEnabled", {
20504
+ get: function () {
20505
+ return this.column.enabled;
20506
+ },
20507
+ set: function (value) {
20508
+ this.column.enabled = value;
20509
+ },
20510
+ enumerable: false,
20511
+ configurable: true
20512
+ });
20321
20513
  ColumnRendererCP.prototype.render = function () {
20322
20514
  var _this = this;
20323
20515
  this.baseAttr = this.getAttribute();
20324
- if (this.getButtonsToShow().indexOf("sorting") >= 0 && this.column.enabled) {
20516
+ if (this.getButtonsToShow().indexOf("sorting") >= 0 && this.columnEnabled) {
20325
20517
  this.sortingButton = this.renderSoringButton(this.column.sorting);
20326
20518
  if (this.column.sorting !== SortDirection.None) {
20327
20519
  this.sortingButton.style.display = 'block';
@@ -20391,12 +20583,12 @@ var ColumnRendererCP = /** @class */ (function () {
20391
20583
  }
20392
20584
  //end enable button
20393
20585
  //start aggr func button
20394
- if (_this.getButtonsToShow().indexOf("type") >= 0 && _this.column.enabled) {
20586
+ if (_this.getButtonsToShow().indexOf("type") >= 0 && _this.columnEnabled) {
20395
20587
  builder.addChildElement(_this.renderColumnTypeButton());
20396
20588
  }
20397
20589
  //end aggr func button
20398
20590
  //start format selector button
20399
- if (_this.getButtonsToShow().indexOf("format") >= 0 && _this.column.enabled) {
20591
+ if (_this.getButtonsToShow().indexOf("format") >= 0 && _this.columnEnabled) {
20400
20592
  builder.addChildElement(_this.renderColumnFormatButton());
20401
20593
  }
20402
20594
  //end format selector button
@@ -20609,9 +20801,9 @@ var ColumnRendererCP = /** @class */ (function () {
20609
20801
  .title(public_api.i18n.getText('CmdToggleEnable'))
20610
20802
  .attr('tabIndex', '0')
20611
20803
  .addClass("".concat(this.cssPrefix, "-colelement ").concat(this.cssPrefix, "-column-checkbox"))
20612
- .addClass("".concat(this.column.enabled ? 'enabled' : ''))
20804
+ .addClass("".concat(this.columnEnabled ? 'enabled' : ''))
20613
20805
  .on('click', function () {
20614
- _this.column.enabled = !_this.column.enabled;
20806
+ _this.columnEnabled = !_this.columnEnabled;
20615
20807
  _this.column.fireChangedEvent();
20616
20808
  return false;
20617
20809
  })
@@ -20667,8 +20859,8 @@ var ColumnRendererCP = /** @class */ (function () {
20667
20859
  };
20668
20860
  ColumnRendererCP.prototype.getClassesToAdd = function () {
20669
20861
  var result = "";
20670
- result += this.column.enabled ? '' : " ".concat(this.cssPrefix, "-disabled");
20671
- if (this.column.enabled) {
20862
+ result += this.columnEnabled ? '' : " ".concat(this.cssPrefix, "-disabled");
20863
+ if (this.columnEnabled) {
20672
20864
  result += this.column.isReadOnly() ? " ".concat(this.cssPrefix, "-readonly") : '';
20673
20865
  }
20674
20866
  result += this.column.isHidden() ? " ".concat(this.cssPrefix, "-hidden") : '';
@@ -20725,7 +20917,7 @@ var ColumnRendererCP = /** @class */ (function () {
20725
20917
  .addChild('div', function (b) { return b
20726
20918
  .addClass("".concat(utils/* eqCssPrefix */.YR, "-button"), "".concat(utils/* eqCssPrefix */.YR, "-column-button"), "".concat(utils/* eqCssPrefix */.YR, "-column-button-enable"))
20727
20919
  .title(public_api.i18n.getText('CmdToggleEnable'))
20728
- .addClass(_this.column.enabled ? 'enabled' : '')
20920
+ .addClass(_this.columnEnabled ? 'enabled' : '')
20729
20921
  .attr('tabIndex', '0')
20730
20922
  .on('click', function (evt) { return _this.buttonMenuHandler(ColumnAction.Enable, evt); }) //touchstart
20731
20923
  .on('keypress', function (evt) { if (evt.keyCode == 13) {
@@ -20733,7 +20925,7 @@ var ColumnRendererCP = /** @class */ (function () {
20733
20925
  } }); }).toDOM();
20734
20926
  };
20735
20927
  ColumnRendererCP.prototype.isEditable = function () {
20736
- return this.column.enabled && !this.column.isReadOnly();
20928
+ return this.columnEnabled && !this.column.isReadOnly();
20737
20929
  };
20738
20930
  ColumnRendererCP.prototype.changeFormatHandler = function (ev) {
20739
20931
  var _this = this;
@@ -20899,7 +21091,7 @@ var ColumnRendererCP = /** @class */ (function () {
20899
21091
  curQuery.fireColumnsChangedEvent(QueryChangeAction.Delete, this.column);
20900
21092
  break;
20901
21093
  case ColumnAction.Enable:
20902
- this.column.enabled = !this.column.enabled;
21094
+ this.columnEnabled = !this.columnEnabled;
20903
21095
  this.fireColumnChanged();
20904
21096
  break;
20905
21097
  case ColumnAction.Hidden:
@@ -20973,7 +21165,7 @@ var ColumnRendererCP = /** @class */ (function () {
20973
21165
  _this.buttonMenuHandler(action, evt);
20974
21166
  },
20975
21167
  itemFilterCallback: function (item) {
20976
- var result = _this.column.enabled || item.id === "__group" || item.id === "enable" || item.id === "delete";
21168
+ var result = _this.columnEnabled || item.id === "__group" || item.id === "enable" || item.id === "delete";
20977
21169
  return result;
20978
21170
  },
20979
21171
  menuClosedCallback: function () {
@@ -21066,7 +21258,7 @@ var ColumnRendererCP = /** @class */ (function () {
21066
21258
  ColumnRendererCP.prototype.getButtonMenuSelectedItems = function () {
21067
21259
  var _this = this;
21068
21260
  var arrSelected = [];
21069
- if (this.column.enabled) {
21261
+ if (this.columnEnabled) {
21070
21262
  arrSelected.push("enable");
21071
21263
  }
21072
21264
  ;
@@ -21482,13 +21674,6 @@ var CustomSqlColumnRendererCP = /** @class */ (function (_super) {
21482
21674
  _this.dataTypeMenu = null;
21483
21675
  return _this;
21484
21676
  }
21485
- CustomSqlColumnRendererCP.prototype.render = function () {
21486
- if (!this.panel.areCustomExpressionsAllowed() && this.column.enabled) {
21487
- this.column.enabled = false;
21488
- this.fireColumnChanged();
21489
- }
21490
- return _super.prototype.render.call(this);
21491
- };
21492
21677
  CustomSqlColumnRendererCP.prototype.renderEnabledButton = function () {
21493
21678
  var elem = _super.prototype.renderEnabledButton.call(this);
21494
21679
  var child = elem.children[0];
@@ -22046,6 +22231,7 @@ var ColumnsPanel = /** @class */ (function (_super) {
22046
22231
  };
22047
22232
  ColumnsPanel.prototype.setOptions = function (options) {
22048
22233
  public_api.utils.assignDeep(this.options, options);
22234
+ this.getContext().options.allowCustomExpressions = options.allowCustomExpressions;
22049
22235
  if (browser_utils/* browserUtils.isMobileMode */.z.isMobileMode()) {
22050
22236
  this.options.buttons = ["menu"];
22051
22237
  this.options.showHeader = false;
@@ -22265,7 +22451,7 @@ var ColumnsPanel = /** @class */ (function (_super) {
22265
22451
  };
22266
22452
  ColumnsPanel.prototype.areCustomExpressionsAllowed = function () {
22267
22453
  var query = this.getQuery();
22268
- return query.isEx() && this.options.allowCustomExpressions;
22454
+ return query.isEx() && this.getContext().options.allowCustomExpressions;
22269
22455
  };
22270
22456
  ColumnsPanel.prototype.addAllColumnsToEntitiesList = function (list) {
22271
22457
  var _this = this;
@@ -22694,7 +22880,7 @@ var ColumnRendererCB = /** @class */ (function () {
22694
22880
  if (data.id == 'None' || data.id == "Ascending" || data.id == "Descending") {
22695
22881
  var query = _this.bar.getQuery();
22696
22882
  _this.column.sorting = strToSortDirection(data.id);
22697
- _this.column.sortIndex = query.getColumnSortIndex(_this.column);
22883
+ _this.column._sortIndex = query.getColumnSortIndex(_this.column);
22698
22884
  _this.fireColumnChanged();
22699
22885
  }
22700
22886
  else {
@@ -23249,10 +23435,15 @@ var ColumnsBar = /** @class */ (function (_super) {
23249
23435
  _this.hideLandingSlot();
23250
23436
  },
23251
23437
  onDrop: function (container, ev) {
23252
- var query = _this.getQuery();
23253
- var columns = query.getColumns();
23254
- var index = columns.indexOf(ev.data.column);
23255
- _this.moveColumnCore(index, _this.landingIndex);
23438
+ if (_this.landingIndex >= 0) {
23439
+ var query = _this.getQuery();
23440
+ var columns = query.getColumns();
23441
+ var index = columns.indexOf(ev.data.column);
23442
+ _this.moveColumnCore(index, _this.landingIndex);
23443
+ }
23444
+ else {
23445
+ ev.item.element.removeAttribute('style');
23446
+ }
23256
23447
  }
23257
23448
  });
23258
23449
  }
@@ -23885,6 +24076,7 @@ var ColumnRendererSB = /** @class */ (function () {
23885
24076
  configurable: true
23886
24077
  });
23887
24078
  ColumnRendererSB.prototype.render = function () {
24079
+ var _this = this;
23888
24080
  this.baseAttr = this.getAttribute();
23889
24081
  var builder = (0,lib_public_api.domel)('div');
23890
24082
  builder.data('id', this.column.id);
@@ -23894,6 +24086,23 @@ var ColumnRendererSB = /** @class */ (function () {
23894
24086
  .replaceChild(builder.toDOM(), this.element);
23895
24087
  }
23896
24088
  this.element = builder.toDOM();
24089
+ if (this.bar.options.allowDragDrop) {
24090
+ lib_public_api.eqDragManager.registerDraggableItem({
24091
+ element: this.element,
24092
+ scope: "entityAttrSortSB",
24093
+ beforeDragStart: function () { return _this.element.dispatchEvent((0,lib_public_api.createBrowserEvent)('mouseleave')); },
24094
+ onDragStart: function (ev) {
24095
+ _this.element.style.display = 'none';
24096
+ ev.dropEffect = lib_public_api.DropEffect.Allow;
24097
+ },
24098
+ onDragEnd: function (ev) {
24099
+ if (!ev.data.finishedSuccessfully) {
24100
+ _this.element.removeAttribute('style');
24101
+ }
24102
+ },
24103
+ data: { column: this.column }
24104
+ });
24105
+ }
23897
24106
  builder
23898
24107
  .addClass(this.getClassesToAdd())
23899
24108
  .addClass(browser_utils/* browserUtils.getMobileCssClass */.z.getMobileCssClass())
@@ -23996,10 +24205,13 @@ var ColumnRendererSB = /** @class */ (function () {
23996
24205
  }
23997
24206
  else {
23998
24207
  _this.column.sorting = strToSortDirection(data.id);
23999
- _this.column.sortIndex = query.getColumnSortIndex(_this.column);
24208
+ _this.column._sortIndex = query.getColumnSortIndex(_this.column);
24000
24209
  _this.fireColumnChanged();
24001
24210
  }
24002
24211
  }
24212
+ else {
24213
+ _this.bar.moveColumn(_this.column, data.id);
24214
+ }
24003
24215
  },
24004
24216
  menuClosedCallback: function () {
24005
24217
  _this.keepShowingButtons = false;
@@ -24058,6 +24270,7 @@ var SortingBar = /** @class */ (function (_super) {
24058
24270
  showAddRow: true,
24059
24271
  attrElementFormat: '{entity} {attr}',
24060
24272
  titleElementFormat: null,
24273
+ allowDragDrop: true,
24061
24274
  menuOptions: {
24062
24275
  showSearchBoxAfter: 30,
24063
24276
  searchBoxAutoFocus: true,
@@ -24069,8 +24282,17 @@ var SortingBar = /** @class */ (function (_super) {
24069
24282
  _this.sortMenuList = [
24070
24283
  { id: 'None', text: public_api.i18n.getText('CmdNotSorted') },
24071
24284
  { id: 'Ascending', text: public_api.i18n.getText('CmdAscending') },
24072
- { id: 'Descending', text: public_api.i18n.getText('CmdDescending') }
24285
+ { id: 'Descending', text: public_api.i18n.getText('CmdDescending') },
24286
+ { id: '---', text: '---' },
24287
+ { id: 'MoveTop', text: public_api.i18n.getText('CmdMoveToFirst') },
24288
+ { id: 'MoveUp', text: public_api.i18n.getText('CmdMoveToPrev') },
24289
+ { id: 'MoveDown', text: public_api.i18n.getText('CmdMoveToNext') },
24290
+ { id: 'MoveBottom', text: public_api.i18n.getText('CmdMoveToLast') }
24073
24291
  ];
24292
+ _this.landingSlot = (0,lib_public_api.domel)('div')
24293
+ .addClass("".concat(utils/* eqCssPrefix */.YR, "-highlight"))
24294
+ .toDOM();
24295
+ _this.landingIndex = -1;
24074
24296
  (0,lib_public_api.domel)(_this.slot)
24075
24297
  .addClass("".concat(_this.cssPrefix, "-panel"))
24076
24298
  .addClass(browser_utils/* browserUtils.getMobileCssClass */.z.getMobileCssClass());
@@ -24088,10 +24310,37 @@ var SortingBar = /** @class */ (function (_super) {
24088
24310
  return 'sortingBar';
24089
24311
  };
24090
24312
  SortingBar.prototype.init = function (context, options) {
24313
+ var _this = this;
24091
24314
  _super.prototype.init.call(this, context, options);
24092
24315
  this.setOptions(options);
24093
24316
  this.destroyCore();
24094
24317
  this.attachQueryObserver();
24318
+ lib_public_api.eqDragManager.removeDropContainer(this.slot);
24319
+ if (this.options.allowDragDrop) {
24320
+ lib_public_api.eqDragManager.registerDropContainer({
24321
+ element: this.slot,
24322
+ scopes: ["entityAttrSortSB"],
24323
+ onDragEnter: function (container, ev) {
24324
+ _this.showLandingSlot(ev.pageX, ev.pageY);
24325
+ },
24326
+ onDragOver: function (container, ev) {
24327
+ _this.showLandingSlot(ev.pageX, ev.pageY);
24328
+ },
24329
+ onDragLeave: function (container, ev) {
24330
+ ev.dropEffect = lib_public_api.DropEffect.Forbid;
24331
+ _this.hideLandingSlot();
24332
+ },
24333
+ onDrop: function (container, ev) {
24334
+ if (_this.landingIndex >= 0) {
24335
+ var query = _this.getQuery();
24336
+ query.setColumnSortIndex(ev.data.column, _this.landingIndex);
24337
+ }
24338
+ else {
24339
+ ev.item.element.removeAttribute('style');
24340
+ }
24341
+ }
24342
+ });
24343
+ }
24095
24344
  };
24096
24345
  SortingBar.prototype.setOptions = function (options) {
24097
24346
  public_api.utils.assignDeep(this.options, options);
@@ -24106,66 +24355,21 @@ var SortingBar = /** @class */ (function (_super) {
24106
24355
  && edata.part != QueryChangePart.Columns && edata.part != QueryChangePart.All)) {
24107
24356
  return;
24108
24357
  }
24109
- switch (edata.action) {
24110
- case QueryChangeAction.Modify: {
24111
- var columns = edata.changee;
24112
- var modifyColumn_1 = function (column) {
24113
- var colEl = _this.columnsBlock.querySelector("div[data-id='".concat(column.id, "']"));
24114
- if (colEl) {
24115
- _this.renderColumn(column, colEl);
24116
- }
24117
- };
24118
- if (Array.isArray(columns)) {
24119
- columns.forEach(function (col) { return modifyColumn_1(col); });
24120
- }
24121
- else {
24122
- modifyColumn_1(columns);
24123
- }
24124
- break;
24125
- }
24126
- case QueryChangeAction.Add: {
24127
- var columns = edata.changee;
24128
- var addColumn_1 = function (column) {
24129
- _this.addColumnElement(column);
24130
- };
24131
- if (Array.isArray(columns)) {
24132
- columns.forEach(function (col) { return addColumn_1(col); });
24133
- }
24134
- else {
24135
- addColumn_1(columns);
24136
- }
24137
- break;
24138
- }
24139
- case QueryChangeAction.Delete: {
24140
- var columns = edata.changee;
24141
- var deleteColumn_1 = function (column) {
24142
- var colEl = _this.columnsBlock.querySelector("div[data-id='".concat(column.id, "']"));
24143
- if (colEl)
24144
- _this.columnsBlock.removeChild(colEl);
24145
- };
24146
- if (Array.isArray(columns)) {
24147
- columns.forEach(function (col) { return deleteColumn_1(col); });
24148
- }
24149
- else {
24150
- deleteColumn_1(columns);
24151
- }
24152
- break;
24153
- }
24154
- default:
24155
- _this.refresh();
24156
- break;
24157
- }
24358
+ _this.refresh();
24158
24359
  });
24159
24360
  };
24160
24361
  SortingBar.prototype.detachQueryObserver = function () {
24161
24362
  if (this.queryEventCallbackId) {
24162
- var query = this.getContext().getQuery();
24363
+ var query = this.getQuery();
24163
24364
  query.removeChangedCallback(this.queryEventCallbackId);
24164
24365
  }
24165
24366
  };
24166
24367
  SortingBar.prototype.getQuery = function () {
24167
24368
  return this.getContext().getQuery();
24168
24369
  };
24370
+ SortingBar.prototype.getModel = function () {
24371
+ return this.getContext().getModel();
24372
+ };
24169
24373
  SortingBar.prototype.destroyCore = function () {
24170
24374
  this.detachQueryObserver();
24171
24375
  this.clear();
@@ -24203,7 +24407,7 @@ var SortingBar = /** @class */ (function (_super) {
24203
24407
  this.entitiesMenu.showMenu(menuOptions);
24204
24408
  };
24205
24409
  SortingBar.prototype.createEntitiesMenu = function () {
24206
- var model = this.getContext().getModel();
24410
+ var model = this.getModel();
24207
24411
  if (!model || model.isEmpty())
24208
24412
  return null;
24209
24413
  var menuId = this.slot.id;
@@ -24216,7 +24420,7 @@ var SortingBar = /** @class */ (function (_super) {
24216
24420
  this.entitiesMenu = new PopupMenu(options);
24217
24421
  };
24218
24422
  SortingBar.prototype.createSortMenu = function () {
24219
- var model = this.getContext().getModel();
24423
+ var model = this.getModel();
24220
24424
  if (!model || model.isEmpty())
24221
24425
  return null;
24222
24426
  var menuId = this.slot.id;
@@ -24253,8 +24457,8 @@ var SortingBar = /** @class */ (function (_super) {
24253
24457
  }
24254
24458
  (0,lib_public_api.domel)(this.slot)
24255
24459
  .addChildElement(this.columnsBlock);
24256
- var query = this.context.getQuery();
24257
- var columns = query.getColumns().concat(query.getJustSortedColumns());
24460
+ var query = this.getQuery();
24461
+ var columns = query.getSortedColumns(); // .getColumns().concat(query.getJustSortedColumns());
24258
24462
  columns.forEach(function (column, index) {
24259
24463
  var slot = _this.renderColumn(column);
24260
24464
  _this.columnsBlock.appendChild(slot);
@@ -24262,8 +24466,8 @@ var SortingBar = /** @class */ (function (_super) {
24262
24466
  };
24263
24467
  SortingBar.prototype.addNewColumn = function (attrId) {
24264
24468
  var _this = this;
24265
- var model = this.getContext().getModel();
24266
- var query = this.getContext().getQuery();
24469
+ var model = this.getModel();
24470
+ var query = this.getQuery();
24267
24471
  var getColumnByAttrId = function (attrid) {
24268
24472
  var attribute = model.getAttributeById(attrid);
24269
24473
  if (!attribute) {
@@ -24282,60 +24486,28 @@ var SortingBar = /** @class */ (function (_super) {
24282
24486
  }
24283
24487
  var column = query.createColumn(true);
24284
24488
  column.caption = _this.getDefaultColumnCaption(attribute);
24285
- column.sorting = SortDirection.Ascending;
24286
- column.sortIndex = _this.getQuery().getColumnSortIndex(column);
24489
+ column._sorting = SortDirection.Ascending;
24490
+ //column.sortIndex = this.getQuery().getColumnSortIndex(column);
24287
24491
  column.expr.tag = ExprTag.EntityAttribute;
24492
+ column.expr.dataType = attribute.dataType;
24288
24493
  //column.expr.id = attrid;
24289
24494
  column.expr.setValue(attrid, true);
24290
24495
  column.params.concat(attribute.params);
24291
24496
  return column;
24292
24497
  };
24293
- if (!this.getContext().getQuery()) {
24498
+ if (!this.getQuery()) {
24294
24499
  return;
24295
24500
  }
24296
- return this.addColumn(getColumnByAttrId(attrId));
24501
+ var newCol = getColumnByAttrId(attrId);
24502
+ return this.getQuery().addColumn({
24503
+ column: newCol
24504
+ });
24297
24505
  };
24298
24506
  SortingBar.prototype.getDefaultColumnCaption = function (attr) {
24299
24507
  var format = this.options.titleElementFormat || this.options.attrElementFormat;
24300
- var model = this.getContext().getModel();
24508
+ var model = this.getModel();
24301
24509
  return model.getAttributeText(attr, format);
24302
24510
  };
24303
- SortingBar.prototype.addColumn = function (column) {
24304
- var query = this.getContext().getQuery();
24305
- if (!query) {
24306
- return;
24307
- }
24308
- column = this.checkColumn(column);
24309
- if (!column) {
24310
- return;
24311
- }
24312
- column = query.addColumn({
24313
- caption: column.caption,
24314
- attributeId: column.expr.value,
24315
- sorting: column.sorting,
24316
- sortIndex: column.sortIndex,
24317
- justsorted: true
24318
- });
24319
- query.fireChangedEvent({
24320
- part: QueryChangePart.SortingColumns,
24321
- action: QueryChangeAction.Add,
24322
- changee: column
24323
- });
24324
- return column;
24325
- };
24326
- SortingBar.prototype.checkColumn = function (col) {
24327
- var query = this.getContext().getQuery();
24328
- var columns = query.getColumns()
24329
- .concat(query.getJustSortedColumns());
24330
- var colJson = JSON.stringify(col.expr.saveToData());
24331
- for (var i = 0; i < columns.length; i++) {
24332
- var qcolJson = JSON.stringify(columns[i].expr.saveToData());
24333
- if (qcolJson === colJson) {
24334
- return null;
24335
- }
24336
- }
24337
- return col;
24338
- };
24339
24511
  SortingBar.prototype.renderColumn = function (column, elem) {
24340
24512
  var renderer = new ColumnRendererSB(this, column, elem);
24341
24513
  if (renderer) {
@@ -24344,17 +24516,84 @@ var SortingBar = /** @class */ (function (_super) {
24344
24516
  }
24345
24517
  return null;
24346
24518
  };
24347
- //adds one column to the bar on the specified position
24348
- SortingBar.prototype.addColumnElement = function (column) {
24349
- var newColBlock = this.renderColumn(column);
24350
- this.columnsBlock.appendChild(newColBlock);
24351
- if (this.options.columnRenderedCallback) {
24352
- this.options.columnRenderedCallback(newColBlock);
24353
- }
24354
- };
24355
24519
  SortingBar.prototype.clear = function () {
24356
24520
  this.slot.innerHTML = '';
24357
24521
  };
24522
+ SortingBar.prototype.moveColumn = function (column, direction) {
24523
+ var query = this.getQuery();
24524
+ var columns = query.getSortedColumns();
24525
+ var index = query.getColumnSortIndex(column);
24526
+ if (index >= 0) {
24527
+ switch (direction) {
24528
+ case 'MoveTop':
24529
+ query.setColumnSortIndex(column, 0);
24530
+ break;
24531
+ case 'MoveUp':
24532
+ query.setColumnSortIndex(column, index > 0 ? index - 1 : 0);
24533
+ break;
24534
+ case 'MoveDown':
24535
+ query.setColumnSortIndex(column, index < columns.length - 1 ? index + 1 : columns.length - 1);
24536
+ break;
24537
+ case 'MoveBottom':
24538
+ query.setColumnSortIndex(column, columns.length - 1);
24539
+ break;
24540
+ }
24541
+ ;
24542
+ }
24543
+ };
24544
+ SortingBar.prototype.showLandingSlot = function (pageX, pageY) {
24545
+ var elements = this.columnsBlock.querySelectorAll("[class*=".concat(this.cssPrefix, "-row]"));
24546
+ var columnSlots = [];
24547
+ for (var i = 0; i < elements.length; i++) {
24548
+ if (elements[i].style.display !== 'none') {
24549
+ columnSlots.push(elements[i]);
24550
+ }
24551
+ }
24552
+ if (columnSlots.length === 0) {
24553
+ this.landingIndex = 0;
24554
+ return;
24555
+ }
24556
+ var landingPos = (0,lib_public_api.getElementAbsolutePos)(this.landingSlot);
24557
+ if (pageX >= landingPos.x && pageX <= landingPos.x + this.landingSlot.offsetWidth
24558
+ && pageY >= landingPos.y && pageY <= landingPos.y + this.landingSlot.offsetHeight) {
24559
+ return;
24560
+ }
24561
+ var newLandingIndex = this.landingIndex;
24562
+ for (var i = 0; i < columnSlots.length; i++) {
24563
+ var colSlot = columnSlots[i];
24564
+ var absPos = (0,lib_public_api.getElementAbsolutePos)(colSlot);
24565
+ var colWidth = colSlot.offsetWidth;
24566
+ var colHeight = colSlot.offsetHeight;
24567
+ var paddingWidth = 0.2 * colWidth;
24568
+ var paddingHeight = 2;
24569
+ if (pageX >= absPos.x + paddingWidth && pageX <= absPos.x + colWidth - paddingWidth
24570
+ && pageY >= absPos.y + paddingHeight && pageY <= absPos.y + colHeight - paddingHeight) {
24571
+ if (pageX > landingPos.x)
24572
+ newLandingIndex = i + 1;
24573
+ else
24574
+ newLandingIndex = i;
24575
+ break;
24576
+ }
24577
+ }
24578
+ if (newLandingIndex != this.landingIndex || this.landingSlot.parentElement) {
24579
+ this.landingIndex = newLandingIndex;
24580
+ if (this.landingIndex <= 0) {
24581
+ this.columnsBlock.insertBefore(this.landingSlot, columnSlots[0]);
24582
+ }
24583
+ if (this.landingIndex < columnSlots.length) {
24584
+ this.columnsBlock.insertBefore(this.landingSlot, columnSlots[this.landingIndex]);
24585
+ }
24586
+ else {
24587
+ this.columnsBlock.appendChild(this.landingSlot);
24588
+ }
24589
+ }
24590
+ };
24591
+ SortingBar.prototype.hideLandingSlot = function () {
24592
+ this.landingIndex = -1;
24593
+ if (this.landingSlot.parentElement) {
24594
+ this.landingSlot.parentElement.removeChild(this.landingSlot);
24595
+ }
24596
+ };
24358
24597
  return SortingBar;
24359
24598
  }(Widget));
24360
24599
 
@@ -28254,7 +28493,8 @@ var ManageDrillDownWidget = /** @class */ (function (_super) {
28254
28493
  }
28255
28494
  }, null);
28256
28495
  this.ddQuery = new Query(model, null, {
28257
- parent: query
28496
+ parent: query,
28497
+ context: this.context
28258
28498
  });
28259
28499
  var dds = this.context.getQuery().getDrillDowns();
28260
28500
  if (dds.length) {