@easyquery/ui 7.2.4-beta03 → 7.2.4-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.
@@ -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-rc01 (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
@@ -9008,10 +9008,20 @@ var ColumnRendererCP = /** @class */ (function () {
9008
9008
  enumerable: false,
9009
9009
  configurable: true
9010
9010
  });
9011
+ Object.defineProperty(ColumnRendererCP.prototype, "columnEnabled", {
9012
+ get: function () {
9013
+ return this.column.enabled;
9014
+ },
9015
+ set: function (value) {
9016
+ this.column.enabled = value;
9017
+ },
9018
+ enumerable: false,
9019
+ configurable: true
9020
+ });
9011
9021
  ColumnRendererCP.prototype.render = function () {
9012
9022
  var _this = this;
9013
9023
  this.baseAttr = this.getAttribute();
9014
- if (this.getButtonsToShow().indexOf("sorting") >= 0 && this.column.enabled) {
9024
+ if (this.getButtonsToShow().indexOf("sorting") >= 0 && this.columnEnabled) {
9015
9025
  this.sortingButton = this.renderSoringButton(this.column.sorting);
9016
9026
  if (this.column.sorting !== external_easyqueryCore_.SortDirection.None) {
9017
9027
  this.sortingButton.style.display = 'block';
@@ -9081,12 +9091,12 @@ var ColumnRendererCP = /** @class */ (function () {
9081
9091
  }
9082
9092
  //end enable button
9083
9093
  //start aggr func button
9084
- if (_this.getButtonsToShow().indexOf("type") >= 0 && _this.column.enabled) {
9094
+ if (_this.getButtonsToShow().indexOf("type") >= 0 && _this.columnEnabled) {
9085
9095
  builder.addChildElement(_this.renderColumnTypeButton());
9086
9096
  }
9087
9097
  //end aggr func button
9088
9098
  //start format selector button
9089
- if (_this.getButtonsToShow().indexOf("format") >= 0 && _this.column.enabled) {
9099
+ if (_this.getButtonsToShow().indexOf("format") >= 0 && _this.columnEnabled) {
9090
9100
  builder.addChildElement(_this.renderColumnFormatButton());
9091
9101
  }
9092
9102
  //end format selector button
@@ -9299,9 +9309,9 @@ var ColumnRendererCP = /** @class */ (function () {
9299
9309
  .title(external_easyqueryCore_.i18n.getText('CmdToggleEnable'))
9300
9310
  .attr('tabIndex', '0')
9301
9311
  .addClass("".concat(this.cssPrefix, "-colelement ").concat(this.cssPrefix, "-column-checkbox"))
9302
- .addClass("".concat(this.column.enabled ? 'enabled' : ''))
9312
+ .addClass("".concat(this.columnEnabled ? 'enabled' : ''))
9303
9313
  .on('click', function () {
9304
- _this.column.enabled = !_this.column.enabled;
9314
+ _this.columnEnabled = !_this.columnEnabled;
9305
9315
  _this.column.fireChangedEvent();
9306
9316
  return false;
9307
9317
  })
@@ -9357,8 +9367,8 @@ var ColumnRendererCP = /** @class */ (function () {
9357
9367
  };
9358
9368
  ColumnRendererCP.prototype.getClassesToAdd = function () {
9359
9369
  var result = "";
9360
- result += this.column.enabled ? '' : " ".concat(this.cssPrefix, "-disabled");
9361
- if (this.column.enabled) {
9370
+ result += this.columnEnabled ? '' : " ".concat(this.cssPrefix, "-disabled");
9371
+ if (this.columnEnabled) {
9362
9372
  result += this.column.isReadOnly() ? " ".concat(this.cssPrefix, "-readonly") : '';
9363
9373
  }
9364
9374
  result += this.column.isHidden() ? " ".concat(this.cssPrefix, "-hidden") : '';
@@ -9415,7 +9425,7 @@ var ColumnRendererCP = /** @class */ (function () {
9415
9425
  .addChild('div', function (b) { return b
9416
9426
  .addClass("".concat(utils/* eqCssPrefix */.YR, "-button"), "".concat(utils/* eqCssPrefix */.YR, "-column-button"), "".concat(utils/* eqCssPrefix */.YR, "-column-button-enable"))
9417
9427
  .title(external_easyqueryCore_.i18n.getText('CmdToggleEnable'))
9418
- .addClass(_this.column.enabled ? 'enabled' : '')
9428
+ .addClass(_this.columnEnabled ? 'enabled' : '')
9419
9429
  .attr('tabIndex', '0')
9420
9430
  .on('click', function (evt) { return _this.buttonMenuHandler(ColumnAction.Enable, evt); }) //touchstart
9421
9431
  .on('keypress', function (evt) { if (evt.keyCode == 13) {
@@ -9423,7 +9433,7 @@ var ColumnRendererCP = /** @class */ (function () {
9423
9433
  } }); }).toDOM();
9424
9434
  };
9425
9435
  ColumnRendererCP.prototype.isEditable = function () {
9426
- return this.column.enabled && !this.column.isReadOnly();
9436
+ return this.columnEnabled && !this.column.isReadOnly();
9427
9437
  };
9428
9438
  ColumnRendererCP.prototype.changeFormatHandler = function (ev) {
9429
9439
  var _this = this;
@@ -9589,7 +9599,7 @@ var ColumnRendererCP = /** @class */ (function () {
9589
9599
  curQuery.fireColumnsChangedEvent(external_easyqueryCore_.QueryChangeAction.Delete, this.column);
9590
9600
  break;
9591
9601
  case ColumnAction.Enable:
9592
- this.column.enabled = !this.column.enabled;
9602
+ this.columnEnabled = !this.columnEnabled;
9593
9603
  this.fireColumnChanged();
9594
9604
  break;
9595
9605
  case ColumnAction.Hidden:
@@ -9663,7 +9673,7 @@ var ColumnRendererCP = /** @class */ (function () {
9663
9673
  _this.buttonMenuHandler(action, evt);
9664
9674
  },
9665
9675
  itemFilterCallback: function (item) {
9666
- var result = _this.column.enabled || item.id === "__group" || item.id === "enable" || item.id === "delete";
9676
+ var result = _this.columnEnabled || item.id === "__group" || item.id === "enable" || item.id === "delete";
9667
9677
  return result;
9668
9678
  },
9669
9679
  menuClosedCallback: function () {
@@ -9756,7 +9766,7 @@ var ColumnRendererCP = /** @class */ (function () {
9756
9766
  ColumnRendererCP.prototype.getButtonMenuSelectedItems = function () {
9757
9767
  var _this = this;
9758
9768
  var arrSelected = [];
9759
- if (this.column.enabled) {
9769
+ if (this.columnEnabled) {
9760
9770
  arrSelected.push("enable");
9761
9771
  }
9762
9772
  ;
@@ -10172,13 +10182,6 @@ var CustomSqlColumnRendererCP = /** @class */ (function (_super) {
10172
10182
  _this.dataTypeMenu = null;
10173
10183
  return _this;
10174
10184
  }
10175
- CustomSqlColumnRendererCP.prototype.render = function () {
10176
- if (!this.panel.areCustomExpressionsAllowed() && this.column.enabled) {
10177
- this.column.enabled = false;
10178
- this.fireColumnChanged();
10179
- }
10180
- return _super.prototype.render.call(this);
10181
- };
10182
10185
  CustomSqlColumnRendererCP.prototype.renderEnabledButton = function () {
10183
10186
  var elem = _super.prototype.renderEnabledButton.call(this);
10184
10187
  var child = elem.children[0];
@@ -10736,6 +10739,7 @@ var ColumnsPanel = /** @class */ (function (_super) {
10736
10739
  };
10737
10740
  ColumnsPanel.prototype.setOptions = function (options) {
10738
10741
  public_api/* utils.assignDeep */.P6.assignDeep(this.options, options);
10742
+ this.getContext().options.allowCustomExpressions = options.allowCustomExpressions;
10739
10743
  if (browser_utils/* browserUtils.isMobileMode */.z.isMobileMode()) {
10740
10744
  this.options.buttons = ["menu"];
10741
10745
  this.options.showHeader = false;
@@ -10955,7 +10959,7 @@ var ColumnsPanel = /** @class */ (function (_super) {
10955
10959
  };
10956
10960
  ColumnsPanel.prototype.areCustomExpressionsAllowed = function () {
10957
10961
  var query = this.getQuery();
10958
- return query.isEx() && this.options.allowCustomExpressions;
10962
+ return query.isEx() && this.getContext().options.allowCustomExpressions;
10959
10963
  };
10960
10964
  ColumnsPanel.prototype.addAllColumnsToEntitiesList = function (list) {
10961
10965
  var _this = this;
@@ -12796,66 +12800,21 @@ var SortingBar = /** @class */ (function (_super) {
12796
12800
  && edata.part != external_easyqueryCore_.QueryChangePart.Columns && edata.part != external_easyqueryCore_.QueryChangePart.All)) {
12797
12801
  return;
12798
12802
  }
12799
- switch (edata.action) {
12800
- case external_easyqueryCore_.QueryChangeAction.Modify: {
12801
- var columns = edata.changee;
12802
- var modifyColumn_1 = function (column) {
12803
- var colEl = _this.columnsBlock.querySelector("div[data-id='".concat(column.id, "']"));
12804
- if (colEl) {
12805
- _this.renderColumn(column, colEl);
12806
- }
12807
- };
12808
- if (Array.isArray(columns)) {
12809
- columns.forEach(function (col) { return modifyColumn_1(col); });
12810
- }
12811
- else {
12812
- modifyColumn_1(columns);
12813
- }
12814
- break;
12815
- }
12816
- case external_easyqueryCore_.QueryChangeAction.Add: {
12817
- var columns = edata.changee;
12818
- var addColumn_1 = function (column) {
12819
- _this.addColumnElement(column);
12820
- };
12821
- if (Array.isArray(columns)) {
12822
- columns.forEach(function (col) { return addColumn_1(col); });
12823
- }
12824
- else {
12825
- addColumn_1(columns);
12826
- }
12827
- break;
12828
- }
12829
- case external_easyqueryCore_.QueryChangeAction.Delete: {
12830
- var columns = edata.changee;
12831
- var deleteColumn_1 = function (column) {
12832
- var colEl = _this.columnsBlock.querySelector("div[data-id='".concat(column.id, "']"));
12833
- if (colEl)
12834
- _this.columnsBlock.removeChild(colEl);
12835
- };
12836
- if (Array.isArray(columns)) {
12837
- columns.forEach(function (col) { return deleteColumn_1(col); });
12838
- }
12839
- else {
12840
- deleteColumn_1(columns);
12841
- }
12842
- break;
12843
- }
12844
- default:
12845
- _this.refresh();
12846
- break;
12847
- }
12803
+ _this.refresh();
12848
12804
  });
12849
12805
  };
12850
12806
  SortingBar.prototype.detachQueryObserver = function () {
12851
12807
  if (this.queryEventCallbackId) {
12852
- var query = this.getContext().getQuery();
12808
+ var query = this.getQuery();
12853
12809
  query.removeChangedCallback(this.queryEventCallbackId);
12854
12810
  }
12855
12811
  };
12856
12812
  SortingBar.prototype.getQuery = function () {
12857
12813
  return this.getContext().getQuery();
12858
12814
  };
12815
+ SortingBar.prototype.getModel = function () {
12816
+ return this.getContext().getModel();
12817
+ };
12859
12818
  SortingBar.prototype.destroyCore = function () {
12860
12819
  this.detachQueryObserver();
12861
12820
  this.clear();
@@ -12893,7 +12852,7 @@ var SortingBar = /** @class */ (function (_super) {
12893
12852
  this.entitiesMenu.showMenu(menuOptions);
12894
12853
  };
12895
12854
  SortingBar.prototype.createEntitiesMenu = function () {
12896
- var model = this.getContext().getModel();
12855
+ var model = this.getModel();
12897
12856
  if (!model || model.isEmpty())
12898
12857
  return null;
12899
12858
  var menuId = this.slot.id;
@@ -12906,7 +12865,7 @@ var SortingBar = /** @class */ (function (_super) {
12906
12865
  this.entitiesMenu = new PopupMenu(options);
12907
12866
  };
12908
12867
  SortingBar.prototype.createSortMenu = function () {
12909
- var model = this.getContext().getModel();
12868
+ var model = this.getModel();
12910
12869
  if (!model || model.isEmpty())
12911
12870
  return null;
12912
12871
  var menuId = this.slot.id;
@@ -12943,8 +12902,8 @@ var SortingBar = /** @class */ (function (_super) {
12943
12902
  }
12944
12903
  (0,lib_public_api/* domel */.uC)(this.slot)
12945
12904
  .addChildElement(this.columnsBlock);
12946
- var query = this.context.getQuery();
12947
- var columns = query.getColumns().concat(query.getJustSortedColumns());
12905
+ var query = this.getQuery();
12906
+ var columns = query.getSortedColumns(); // .getColumns().concat(query.getJustSortedColumns());
12948
12907
  columns.forEach(function (column, index) {
12949
12908
  var slot = _this.renderColumn(column);
12950
12909
  _this.columnsBlock.appendChild(slot);
@@ -12952,8 +12911,8 @@ var SortingBar = /** @class */ (function (_super) {
12952
12911
  };
12953
12912
  SortingBar.prototype.addNewColumn = function (attrId) {
12954
12913
  var _this = this;
12955
- var model = this.getContext().getModel();
12956
- var query = this.getContext().getQuery();
12914
+ var model = this.getModel();
12915
+ var query = this.getQuery();
12957
12916
  var getColumnByAttrId = function (attrid) {
12958
12917
  var attribute = model.getAttributeById(attrid);
12959
12918
  if (!attribute) {
@@ -12972,60 +12931,28 @@ var SortingBar = /** @class */ (function (_super) {
12972
12931
  }
12973
12932
  var column = query.createColumn(true);
12974
12933
  column.caption = _this.getDefaultColumnCaption(attribute);
12975
- column.sorting = external_easyqueryCore_.SortDirection.Ascending;
12976
- column.sortIndex = _this.getQuery().getColumnSortIndex(column);
12934
+ column._sorting = external_easyqueryCore_.SortDirection.Ascending;
12935
+ //column.sortIndex = this.getQuery().getColumnSortIndex(column);
12977
12936
  column.expr.tag = external_easyqueryCore_.ExprTag.EntityAttribute;
12937
+ column.expr.dataType = attribute.dataType;
12978
12938
  //column.expr.id = attrid;
12979
12939
  column.expr.setValue(attrid, true);
12980
12940
  column.params.concat(attribute.params);
12981
12941
  return column;
12982
12942
  };
12983
- if (!this.getContext().getQuery()) {
12943
+ if (!this.getQuery()) {
12984
12944
  return;
12985
12945
  }
12986
- return this.addColumn(getColumnByAttrId(attrId));
12946
+ var newCol = getColumnByAttrId(attrId);
12947
+ return this.getQuery().addColumn({
12948
+ column: newCol
12949
+ });
12987
12950
  };
12988
12951
  SortingBar.prototype.getDefaultColumnCaption = function (attr) {
12989
12952
  var format = this.options.titleElementFormat || this.options.attrElementFormat;
12990
- var model = this.getContext().getModel();
12953
+ var model = this.getModel();
12991
12954
  return model.getAttributeText(attr, format);
12992
12955
  };
12993
- SortingBar.prototype.addColumn = function (column) {
12994
- var query = this.getContext().getQuery();
12995
- if (!query) {
12996
- return;
12997
- }
12998
- column = this.checkColumn(column);
12999
- if (!column) {
13000
- return;
13001
- }
13002
- column = query.addColumn({
13003
- caption: column.caption,
13004
- attributeId: column.expr.value,
13005
- sorting: column.sorting,
13006
- sortIndex: column.sortIndex,
13007
- justsorted: true
13008
- });
13009
- query.fireChangedEvent({
13010
- part: external_easyqueryCore_.QueryChangePart.SortingColumns,
13011
- action: external_easyqueryCore_.QueryChangeAction.Add,
13012
- changee: column
13013
- });
13014
- return column;
13015
- };
13016
- SortingBar.prototype.checkColumn = function (col) {
13017
- var query = this.getContext().getQuery();
13018
- var columns = query.getColumns()
13019
- .concat(query.getJustSortedColumns());
13020
- var colJson = JSON.stringify(col.expr.saveToData());
13021
- for (var i = 0; i < columns.length; i++) {
13022
- var qcolJson = JSON.stringify(columns[i].expr.saveToData());
13023
- if (qcolJson === colJson) {
13024
- return null;
13025
- }
13026
- }
13027
- return col;
13028
- };
13029
12956
  SortingBar.prototype.renderColumn = function (column, elem) {
13030
12957
  var renderer = new ColumnRendererSB(this, column, elem);
13031
12958
  if (renderer) {
@@ -13034,14 +12961,6 @@ var SortingBar = /** @class */ (function (_super) {
13034
12961
  }
13035
12962
  return null;
13036
12963
  };
13037
- //adds one column to the bar on the specified position
13038
- SortingBar.prototype.addColumnElement = function (column) {
13039
- var newColBlock = this.renderColumn(column);
13040
- this.columnsBlock.appendChild(newColBlock);
13041
- if (this.options.columnRenderedCallback) {
13042
- this.options.columnRenderedCallback(newColBlock);
13043
- }
13044
- };
13045
12964
  SortingBar.prototype.clear = function () {
13046
12965
  this.slot.innerHTML = '';
13047
12966
  };