@easyquery/enterprise 7.2.4-rc04 → 7.2.4-rc05

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 Enterprise 7.2.4-rc04 (https://korzh.com/easyquery/javascript)
2
+ * EasyQuery.JS Enterprise 7.2.4-rc05 (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
@@ -13137,6 +13137,8 @@ __webpack_require__.d(lib_public_api_namespaceObject, {
13137
13137
  AggrSettingsDialog: () => (AggrSettingsDialog),
13138
13138
  AggrSettingsRenderer: () => (AggrSettingsRenderer),
13139
13139
  AggregationBar: () => (AggregationBar),
13140
+ AttrColumnRendererCB: () => (AttrColumnRendererCB),
13141
+ AttrColumnRendererCP: () => (AttrColumnRendererCP),
13140
13142
  AttributeExpressionRenderer: () => (AttributeExpressionRenderer),
13141
13143
  BaseElementRenderer: () => (BaseElementRenderer),
13142
13144
  ChartFacet: () => (ChartFacet),
@@ -13152,6 +13154,7 @@ __webpack_require__.d(lib_public_api_namespaceObject, {
13152
13154
  ConditionGroupRenderer: () => (ConditionGroupRenderer),
13153
13155
  ConditionGroupRowRenderer: () => (ConditionGroupRowRenderer),
13154
13156
  ConditionRenderer: () => (ConditionRenderer),
13157
+ ConstColumnRendererCP: () => (ConstColumnRendererCP),
13155
13158
  CustomListExpressionRenderer: () => (CustomListExpressionRenderer),
13156
13159
  CustomSqlColumnRendererCP: () => (CustomSqlColumnRendererCP),
13157
13160
  DataFilterView: () => (DataFilterView),
@@ -13183,8 +13186,6 @@ __webpack_require__.d(lib_public_api_namespaceObject, {
13183
13186
  ReportView: () => (ReportView),
13184
13187
  ResultFacet: () => (ResultFacet),
13185
13188
  ResultFacetsPanel: () => (ResultFacetsPanel),
13186
- SimpleColumnRendererCB: () => (SimpleColumnRendererCB),
13187
- SimpleColumnRendererCP: () => (SimpleColumnRendererCP),
13188
13189
  SimpleConditionRenderer: () => (SimpleConditionRenderer),
13189
13190
  SortingBar: () => (SortingBar),
13190
13191
  SqlListExpressionRenderer: () => (SqlListExpressionRenderer),
@@ -16445,7 +16446,6 @@ var Query = /** @class */ (function () {
16445
16446
  }
16446
16447
  public_api.utils.moveArrayItem(this.sortedColumns, colIdx, index);
16447
16448
  this.fixupSortingIndices();
16448
- this.fireColumnsChangedEvent(QueryChangeAction.All);
16449
16449
  };
16450
16450
  Query.prototype.getColumnSorting = function (col) {
16451
16451
  var idx = this.getColumnSortIndex(col);
@@ -16472,7 +16472,6 @@ var Query = /** @class */ (function () {
16472
16472
  }
16473
16473
  }
16474
16474
  this.adjustColumnsSorting();
16475
- this.fireColumnsChangedEvent(QueryChangeAction.Modify, col, col.isJustSorted());
16476
16475
  };
16477
16476
  Query.prototype.fixupSortingIndices = function () {
16478
16477
  this.sortedColumns.forEach(function (col, index) {
@@ -16521,10 +16520,8 @@ var Query = /** @class */ (function () {
16521
16520
  * sortIndex: SortDirection.Ascending
16522
16521
  * }});
16523
16522
  */
16524
- Query.prototype.addColumn = function (descriptor, author) {
16525
- // let columns = (descriptor.justsorted)
16526
- // ? this.justsorted
16527
- // : this.columns;
16523
+ Query.prototype.addColumn = function (descriptor, silent) {
16524
+ if (silent === void 0) { silent = false; }
16528
16525
  var newColumn;
16529
16526
  if (descriptor.column) {
16530
16527
  newColumn = descriptor.column;
@@ -16541,10 +16538,10 @@ var Query = /** @class */ (function () {
16541
16538
  throw new Error("Incorrect attribute id (".concat(descriptor.attributeId, "): addColumn"));
16542
16539
  }
16543
16540
  }
16544
- else {
16545
- throw new Error('Not enought data for addColumn operation. Need attribute or attributeId');
16541
+ else if (typeof descriptor.constValue === 'undefined' && !descriptor.customSql) {
16542
+ throw new Error('Not enought data for addColumn operation. One of the following options must be defined: attribute, attributeId, constValue or customSlq');
16546
16543
  }
16547
- if (!attr.useInResult) {
16544
+ if (attr && !attr.useInResult) {
16548
16545
  if (attr.lookupAttr) {
16549
16546
  attr = this.model.getAttributeById(attr.lookupAttr);
16550
16547
  }
@@ -16552,22 +16549,29 @@ var Query = /** @class */ (function () {
16552
16549
  throw new Error("Can't use this attribute for a column");
16553
16550
  }
16554
16551
  }
16555
- if (descriptor.aggrFuncId && descriptor.cusomtSql) {
16552
+ if (descriptor.aggrFuncId && descriptor.customSql) {
16556
16553
  console.warn("Column cannot be created using aggrFuncId and customSql at the same time. " +
16557
16554
  "cusomSql will be used.");
16558
16555
  }
16559
- if (descriptor.cusomtSql) {
16556
+ if (typeof descriptor.constValue !== 'undefined') {
16557
+ newColumn.expr.tag = ExprTag.Constant;
16558
+ newColumn.expr.setValue(descriptor.constValue);
16559
+ newColumn.expr.kind = DataKind.Scalar;
16560
+ newColumn.expr.dataType = descriptor.constType || public_api.DataType.String;
16561
+ }
16562
+ else if (descriptor.customSql) {
16560
16563
  newColumn.caption = 'Custom SQL Column';
16561
16564
  newColumn.expr.tag = ExprTag.CustomSql;
16562
- newColumn.expr.baseAttrId = attr.id;
16563
- newColumn.expr.sql = descriptor.cusomtSql;
16565
+ newColumn.expr.sql = descriptor.customSql;
16564
16566
  newColumn.expr.kind = DataKind.Query;
16565
16567
  newColumn.expr.dataType = public_api.DataType.Unknown;
16568
+ newColumn.expr.baseAttrId = descriptor.attributeId;
16569
+ if (!this.context.options.allowCustomExpressions) {
16570
+ newColumn.enabled = false;
16571
+ }
16566
16572
  }
16567
16573
  else if (descriptor.aggrFuncId) {
16568
16574
  var funcId = descriptor.aggrFuncId;
16569
- newColumn.caption = attr.caption + ' '
16570
- + this.model.getAggrFunctionCaption(descriptor.aggrFuncId);
16571
16575
  newColumn.expr.tag = ExprTag.AggregateFunction;
16572
16576
  newColumn.expr.func = descriptor.aggrFuncId;
16573
16577
  newColumn.expr.kind = DataKind.Scalar;
@@ -16576,16 +16580,18 @@ var Query = /** @class */ (function () {
16576
16580
  var arg = new Expression(newColumn);
16577
16581
  arg.setValue(attr.id, true);
16578
16582
  arg.tag = ExprTag.EntityAttribute;
16583
+ arg.kind = DataKind.Attribute;
16579
16584
  arg.dataType = attr.dataType;
16580
16585
  newColumn.expr.args.push(arg);
16581
16586
  }
16582
16587
  else {
16583
- newColumn.caption = attr.caption;
16584
16588
  newColumn.expr.setValue(attr.id, true);
16585
16589
  newColumn.expr.tag = ExprTag.EntityAttribute;
16590
+ newColumn.expr.kind = DataKind.Attribute;
16586
16591
  newColumn.expr.dataType = attr.dataType;
16592
+ newColumn.params.concat(attr.params);
16587
16593
  }
16588
- newColumn.caption = descriptor.caption || newColumn.caption;
16594
+ newColumn.caption = descriptor.caption || this.context.getDefaultColumnCaption(newColumn);
16589
16595
  newColumn._sorting = descriptor.sorting || SortDirection.None;
16590
16596
  newColumn._sortIndex = descriptor.sortIndex || -1;
16591
16597
  newColumn.enabled = public_api.utils.getIfDefined(descriptor.enabled, true);
@@ -16601,7 +16607,9 @@ var Query = /** @class */ (function () {
16601
16607
  }
16602
16608
  }
16603
16609
  this.setColumnSorting(newColumn, newColumn._sorting);
16604
- this.fireColumnsChangedEvent(QueryChangeAction.Add, newColumn, justsorted);
16610
+ if (!silent) {
16611
+ this.fireColumnsChangedEvent(QueryChangeAction.Add, newColumn, justsorted);
16612
+ }
16605
16613
  return newColumn;
16606
16614
  };
16607
16615
  /**
@@ -16655,9 +16663,6 @@ var Query = /** @class */ (function () {
16655
16663
  if (column.isJustSorted())
16656
16664
  return;
16657
16665
  args = args || {};
16658
- column.caption = (typeof args.caption !== 'undefined')
16659
- ? args.caption
16660
- : '';
16661
16666
  if (tag === ExprTag.AggregateFunction) {
16662
16667
  if (!args.funcId)
16663
16668
  throw Error('"funcId" argument is not defined');
@@ -16695,22 +16700,24 @@ var Query = /** @class */ (function () {
16695
16700
  || column.expr.tag === ExprTag.ParentEntityAttribute) {
16696
16701
  return;
16697
16702
  }
16698
- var exprId = (column.expr.tag === ExprTag.CustomSql)
16699
- ? column.expr.baseAttrId
16700
- : column.expr.args[0].value;
16701
- var attr = this.model.getAttributeById(exprId);
16703
+ var attrId = (column.expr.tag == ExprTag.AggregateFunction)
16704
+ ? column.expr.args[0].value
16705
+ : column.expr.baseAttrId;
16706
+ var attr = attrId
16707
+ ? this.model.getAttributeById(attrId)
16708
+ : this.model.getFirstUICAttr();
16702
16709
  var expr = new Expression(column);
16703
16710
  expr.tag = ExprTag.EntityAttribute;
16704
- expr.dataType = attr != null ? attr.dataType : public_api.DataType.Unknown;
16705
- expr.setValue(exprId, true);
16711
+ expr.dataType = attr.dataType;
16712
+ expr.setValue(attr.id, true);
16706
16713
  column.expr = expr;
16707
16714
  }
16715
+ column.caption = this.context.getDefaultColumnCaption(column);
16708
16716
  };
16709
16717
  /**
16710
16718
  * Moves the column with specified index to another position.
16711
16719
  * @param index1 The index of the column that should be moved.
16712
16720
  * @param index2 The index of the position the column should be moved to
16713
- * @param author The author
16714
16721
  */
16715
16722
  Query.prototype.moveColumn = function (index1, index2) {
16716
16723
  var columns = this.getColumns();
@@ -16720,12 +16727,8 @@ var Query = /** @class */ (function () {
16720
16727
  /**
16721
16728
  * Removes the column.
16722
16729
  * @param column The column to be removed.
16723
- * @param author The author
16724
16730
  */
16725
- Query.prototype.removeColumn = function (column, author) {
16726
- // const columns = (column.isJustSorted())
16727
- // ? this.getJustSortedColumns()
16728
- // : this.getColumns();
16731
+ Query.prototype.removeColumn = function (column) {
16729
16732
  public_api.utils.removeArrayItem(this.columns, column);
16730
16733
  public_api.utils.removeArrayItem(this.sortedColumns, column);
16731
16734
  };
@@ -17844,13 +17847,6 @@ var InMemoryModelStorage = /** @class */ (function () {
17844
17847
  }());
17845
17848
 
17846
17849
  //# sourceMappingURL=model_storage.js.map
17847
- ;// CONCATENATED MODULE: ../core/dist/lib/main/action.js
17848
- var EqActionResult;
17849
- (function (EqActionResult) {
17850
- EqActionResult[EqActionResult["Error"] = 0] = "Error";
17851
- EqActionResult[EqActionResult["Success"] = 1] = "Success";
17852
- })(EqActionResult || (EqActionResult = {}));
17853
- //# sourceMappingURL=action.js.map
17854
17850
  ;// CONCATENATED MODULE: ../core/dist/lib/eqs/eqs_exporter.js
17855
17851
 
17856
17852
  var EqServerExporter = /** @class */ (function () {
@@ -17912,6 +17908,13 @@ var EqServerExporter = /** @class */ (function () {
17912
17908
  }());
17913
17909
 
17914
17910
  //# sourceMappingURL=eqs_exporter.js.map
17911
+ ;// CONCATENATED MODULE: ../core/dist/lib/main/action.js
17912
+ var EqActionResult;
17913
+ (function (EqActionResult) {
17914
+ EqActionResult[EqActionResult["Error"] = 0] = "Error";
17915
+ EqActionResult[EqActionResult["Success"] = 1] = "Success";
17916
+ })(EqActionResult || (EqActionResult = {}));
17917
+ //# sourceMappingURL=action.js.map
17915
17918
  ;// CONCATENATED MODULE: ../core/dist/lib/main/context.js
17916
17919
  var context_assign = (undefined && undefined.__assign) || function () {
17917
17920
  context_assign = Object.assign || function(t) {
@@ -17949,7 +17952,9 @@ var EqContext = /** @class */ (function () {
17949
17952
  function EqContext() {
17950
17953
  var _this = this;
17951
17954
  this.options = {
17952
- syncSortOrderWithColumnsOrder: true
17955
+ syncSortOrderWithColumnsOrder: true,
17956
+ attributeFormat: '{entity} {attr}',
17957
+ columnTitleFormat: null //means it will be the same as attributeFormat
17953
17958
  };
17954
17959
  this.servicesInitialized = false;
17955
17960
  this.internalListCache = {};
@@ -19368,6 +19373,37 @@ var EqContext = /** @class */ (function () {
19368
19373
  });
19369
19374
  }
19370
19375
  };
19376
+ EqContext.prototype.getAttributeTitle = function (attr) {
19377
+ var format = this.options.attributeFormat;
19378
+ return this.getModel().getAttributeText(attr, format);
19379
+ };
19380
+ EqContext.prototype.getColumnTitle = function (attr) {
19381
+ var format = this.options.columnTitleFormat || this.options.attributeFormat;
19382
+ return this.getModel().getAttributeText(attr, format);
19383
+ };
19384
+ EqContext.prototype.getDefaultColumnCaption = function (column) {
19385
+ var attr;
19386
+ var model = this.getModel();
19387
+ switch (column.expr.tag) {
19388
+ case ExprTag.Constant:
19389
+ return "Contant Column";
19390
+ case ExprTag.CustomSql:
19391
+ return "SQL Column";
19392
+ case ExprTag.ParentColumn:
19393
+ return "Parent Column";
19394
+ case ExprTag.Query:
19395
+ return "Query Column";
19396
+ case ExprTag.EntityAttribute:
19397
+ case ExprTag.ParentEntityAttribute:
19398
+ attr = model.getAttributeById(column.expr.value);
19399
+ return this.getColumnTitle(attr);
19400
+ case ExprTag.AggregateFunction:
19401
+ attr = model.getAttributeById(column.expr.args[0].value);
19402
+ return this.getColumnTitle(attr) + ' ' + model.getAggrFunctionCaption(column.expr.func);
19403
+ default:
19404
+ return 'Column';
19405
+ }
19406
+ };
19371
19407
  return EqContext;
19372
19408
  }());
19373
19409
 
@@ -19687,7 +19723,6 @@ var EntitiesPanel = /** @class */ (function (_super) {
19687
19723
  autoClearSelection: true,
19688
19724
  entityRenderedCallback: null,
19689
19725
  attributeRenderedCallback: null,
19690
- columnTitleFormat: '{attr}'
19691
19726
  };
19692
19727
  if (options) {
19693
19728
  public_api.utils.assignDeep(this.options, options);
@@ -19816,10 +19851,8 @@ var EntitiesPanel = /** @class */ (function (_super) {
19816
19851
  if (model.checkAttrProperty(attrId, "useInResult")) {
19817
19852
  if (checkbox.checked) {
19818
19853
  var attr = model.getAttributeById(attrId);
19819
- var caption = model.getAttributeText(attr, _this.options.columnTitleFormat);
19820
19854
  var column = query.addColumn({
19821
- attribute: attr,
19822
- caption: caption
19855
+ attribute: attr
19823
19856
  });
19824
19857
  query.fireColumnsChangedEvent(QueryChangeAction.Add, column);
19825
19858
  }
@@ -19828,7 +19861,7 @@ var EntitiesPanel = /** @class */ (function (_super) {
19828
19861
  .filter(function (col) { return col.expr.tag === ExprTag.EntityAttribute
19829
19862
  && col.expr.value === attrId; });
19830
19863
  if (columns.length > 0) {
19831
- query.removeColumn(columns[0], null);
19864
+ query.removeColumn(columns[0]);
19832
19865
  query.fireColumnsChangedEvent(QueryChangeAction.Delete, columns[0]);
19833
19866
  }
19834
19867
  }
@@ -20042,11 +20075,9 @@ var EntitiesPanel = /** @class */ (function (_super) {
20042
20075
  for (var _i = 0, attrList_3 = attrList; _i < attrList_3.length; _i++) {
20043
20076
  var attrId_1 = attrList_3[_i];
20044
20077
  var attr = model.getAttributeById(attrId_1);
20045
- var caption = model.getAttributeText(attr, _this.options.columnTitleFormat);
20046
20078
  query.addColumn({
20047
- attribute: attr,
20048
- caption: caption
20049
- });
20079
+ attribute: attr
20080
+ }, true);
20050
20081
  }
20051
20082
  query.fireChangedEvent();
20052
20083
  if (_this.options.autoClearSelection) {
@@ -21599,7 +21630,6 @@ var ColumnRendererCP = /** @class */ (function () {
21599
21630
  });
21600
21631
  ColumnRendererCP.prototype.render = function () {
21601
21632
  var _this = this;
21602
- this.baseAttr = this.getAttribute();
21603
21633
  if (this.getButtonsToShow().indexOf("sorting") >= 0 && this.columnEnabled) {
21604
21634
  this.sortingButton = this.renderSoringButton(this.column.sorting);
21605
21635
  if (this.column.sorting !== SortDirection.None) {
@@ -21722,15 +21752,8 @@ var ColumnRendererCP = /** @class */ (function () {
21722
21752
  ColumnRendererCP.prototype.refresh = function () {
21723
21753
  this.render();
21724
21754
  };
21725
- ColumnRendererCP.prototype.getAttribute = function () {
21726
- var model = this.panel.getContext().getModel();
21727
- return model.getAttributeByIdSafe(this.column.expr.value);
21728
- };
21729
21755
  ColumnRendererCP.prototype.renderCaptionBlock = function () {
21730
21756
  var _this = this;
21731
- if (!this.column.caption || this.column.caption == '') {
21732
- this.column.caption = this.getDefaultColumnCaption();
21733
- }
21734
21757
  var builder = (0,lib_public_api.domel)('div')
21735
21758
  .addClass("".concat(this.cssPrefix, "-colelement"), "".concat(this.cssPrefix, "-captionelement"))
21736
21759
  .addClass(browser_utils/* browserUtils.getMobileCssClass */.z.getMobileCssClass());
@@ -21933,17 +21956,6 @@ var ColumnRendererCP = /** @class */ (function () {
21933
21956
  } }); })
21934
21957
  .toDOM();
21935
21958
  };
21936
- ColumnRendererCP.prototype.getDefaultColumnCaption = function () {
21937
- return this.getDefaultTitleText(this.baseAttr);
21938
- };
21939
- ColumnRendererCP.prototype.getDefaultTitleText = function (attr) {
21940
- return this.getAttributeCaption(attr, this.panel.options.titleElementFormat);
21941
- };
21942
- ColumnRendererCP.prototype.getAttributeCaption = function (attr, format) {
21943
- format = format || this.panel.options.attrElementFormat;
21944
- var model = this.panel.getContext().getModel();
21945
- return model.getAttributeText(attr, format);
21946
- };
21947
21959
  ColumnRendererCP.prototype.getClassesToAdd = function () {
21948
21960
  var result = "";
21949
21961
  result += this.columnEnabled ? '' : " ".concat(this.cssPrefix, "-disabled");
@@ -22174,7 +22186,7 @@ var ColumnRendererCP = /** @class */ (function () {
22174
22186
  switch (action) {
22175
22187
  case ColumnAction.Delete:
22176
22188
  var curQuery = this.column.getQuery();
22177
- curQuery.removeColumn(this.column, this.panel);
22189
+ curQuery.removeColumn(this.column);
22178
22190
  curQuery.fireColumnsChangedEvent(QueryChangeAction.Delete, this.column);
22179
22191
  break;
22180
22192
  case ColumnAction.Enable:
@@ -22368,8 +22380,8 @@ var ColumnRendererCP = /** @class */ (function () {
22368
22380
  }());
22369
22381
 
22370
22382
  //# sourceMappingURL=column_renderer_cp.js.map
22371
- ;// CONCATENATED MODULE: ../ui/dist/lib/widgets/renderers/columnspanel/simple_column_renderer.js
22372
- var simple_column_renderer_extends = (undefined && undefined.__extends) || (function () {
22383
+ ;// CONCATENATED MODULE: ../ui/dist/lib/widgets/renderers/columnspanel/attr_column_renderer_cp.js
22384
+ var attr_column_renderer_cp_extends = (undefined && undefined.__extends) || (function () {
22373
22385
  var extendStatics = function (d, b) {
22374
22386
  extendStatics = Object.setPrototypeOf ||
22375
22387
  ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
@@ -22389,15 +22401,15 @@ var simple_column_renderer_extends = (undefined && undefined.__extends) || (func
22389
22401
 
22390
22402
 
22391
22403
 
22392
- var SimpleColumnRendererCP = /** @class */ (function (_super) {
22393
- simple_column_renderer_extends(SimpleColumnRendererCP, _super);
22394
- function SimpleColumnRendererCP() {
22404
+ var AttrColumnRendererCP = /** @class */ (function (_super) {
22405
+ attr_column_renderer_cp_extends(AttrColumnRendererCP, _super);
22406
+ function AttrColumnRendererCP() {
22395
22407
  return _super !== null && _super.apply(this, arguments) || this;
22396
22408
  }
22397
- SimpleColumnRendererCP.prototype.getClassesToAdd = function () {
22409
+ AttrColumnRendererCP.prototype.getClassesToAdd = function () {
22398
22410
  return "".concat(_super.prototype.getClassesToAdd.call(this), " ").concat(this.cssPrefix, "-row ").concat(this.cssPrefix, "-row-column-entattr");
22399
22411
  };
22400
- SimpleColumnRendererCP.prototype.renderExpressionBlock = function () {
22412
+ AttrColumnRendererCP.prototype.renderExpressionBlock = function () {
22401
22413
  var _this = this;
22402
22414
  return (0,lib_public_api.domel)("div")
22403
22415
  .addClass("".concat(this.cssPrefix, "-expr-block"))
@@ -22408,9 +22420,14 @@ var SimpleColumnRendererCP = /** @class */ (function (_super) {
22408
22420
  .addChildElement(_this.renderBaseExpression()); })
22409
22421
  .toDOM();
22410
22422
  };
22411
- SimpleColumnRendererCP.prototype.renderBaseExpression = function () {
22423
+ AttrColumnRendererCP.prototype.getAttribute = function () {
22424
+ var model = this.panel.getContext().getModel();
22425
+ return model.getAttributeByIdSafe(this.column.expr.value);
22426
+ };
22427
+ AttrColumnRendererCP.prototype.renderBaseExpression = function () {
22412
22428
  var _this = this;
22413
- var attrCaption = this.getAttributeCaption(this.baseAttr);
22429
+ var baseAttr = this.getAttribute();
22430
+ var attrCaption = this.panel.getContext().getAttributeTitle(baseAttr);
22414
22431
  if (this.isEditable()) {
22415
22432
  return (0,lib_public_api.domel)('a')
22416
22433
  .attr('href', 'javascript:void(0)')
@@ -22433,14 +22450,21 @@ var SimpleColumnRendererCP = /** @class */ (function (_super) {
22433
22450
  .title(attrCaption)
22434
22451
  .toDOM();
22435
22452
  };
22436
- SimpleColumnRendererCP.prototype.baseExpressionItemSelectedCallback = function (data, item) {
22453
+ AttrColumnRendererCP.prototype.baseExpressionItemSelectedCallback = function (data, item) {
22437
22454
  var attrid = data.id;
22438
- this.column.expr.setValue(attrid, true);
22439
- this.column.caption = '';
22455
+ var context = this.panel.getContext();
22456
+ var attr = context.getModel().getAttributeById(attrid);
22457
+ this.updateBaseAttr(attr);
22458
+ this.column.caption = context.getDefaultColumnCaption(this.column);
22440
22459
  this.fireColumnChanged();
22441
22460
  return false;
22442
22461
  };
22443
- SimpleColumnRendererCP.prototype.getUIS = function () {
22462
+ AttrColumnRendererCP.prototype.updateBaseAttr = function (attr) {
22463
+ this.column.expr.setValue(attr.id, true);
22464
+ this.column.expr.baseAttrId = attr.id;
22465
+ this.column.expr.dataType = attr.dataType;
22466
+ };
22467
+ AttrColumnRendererCP.prototype.getUIS = function () {
22444
22468
  var arg = this.column.expr.args[0];
22445
22469
  if (arg) {
22446
22470
  var model = this.panel.getContext().getModel();
@@ -22450,7 +22474,7 @@ var SimpleColumnRendererCP = /** @class */ (function (_super) {
22450
22474
  return true;
22451
22475
  }
22452
22476
  };
22453
- SimpleColumnRendererCP.prototype.changeTypeHandler = function (ev) {
22477
+ AttrColumnRendererCP.prototype.changeTypeHandler = function (ev) {
22454
22478
  var _this = this;
22455
22479
  this.keepShowingButtons = true;
22456
22480
  this.functionMenu.showMenu({
@@ -22468,7 +22492,7 @@ var SimpleColumnRendererCP = /** @class */ (function (_super) {
22468
22492
  }
22469
22493
  });
22470
22494
  };
22471
- SimpleColumnRendererCP.prototype.changeTypeToCustomSql = function () {
22495
+ AttrColumnRendererCP.prototype.changeTypeToCustomSql = function () {
22472
22496
  var _this = this;
22473
22497
  var query = this.column.getQuery();
22474
22498
  query.changeColumnType(this.column, ExprTag.CustomSql);
@@ -22481,12 +22505,12 @@ var SimpleColumnRendererCP = /** @class */ (function (_super) {
22481
22505
  }, 500);
22482
22506
  this.fireColumnChanged();
22483
22507
  };
22484
- SimpleColumnRendererCP.prototype.changeTypeToAggr = function (funcId) {
22508
+ AttrColumnRendererCP.prototype.changeTypeToAggr = function (funcId) {
22485
22509
  var query = this.column.getQuery();
22486
22510
  query.changeColumnType(this.column, ExprTag.AggregateFunction, { funcId: funcId });
22487
22511
  this.fireColumnChanged();
22488
22512
  };
22489
- SimpleColumnRendererCP.prototype.processExtraButtonMenuItems = function (action, evt) {
22513
+ AttrColumnRendererCP.prototype.processExtraButtonMenuItems = function (action, evt) {
22490
22514
  if (action === "CUSTOMSQL") {
22491
22515
  this.changeTypeToCustomSql();
22492
22516
  }
@@ -22495,7 +22519,7 @@ var SimpleColumnRendererCP = /** @class */ (function (_super) {
22495
22519
  }
22496
22520
  return true;
22497
22521
  };
22498
- SimpleColumnRendererCP.prototype.getExtraButtonMenuItems = function () {
22522
+ AttrColumnRendererCP.prototype.getExtraButtonMenuItems = function () {
22499
22523
  var items = [];
22500
22524
  var funcs = this.panel.getContext().getModel().getAggrFunctions();
22501
22525
  var toInclude = true;
@@ -22546,12 +22570,12 @@ var SimpleColumnRendererCP = /** @class */ (function (_super) {
22546
22570
  items: items
22547
22571
  }];
22548
22572
  };
22549
- return SimpleColumnRendererCP;
22573
+ return AttrColumnRendererCP;
22550
22574
  }(ColumnRendererCP));
22551
22575
 
22552
- //# sourceMappingURL=simple_column_renderer.js.map
22553
- ;// CONCATENATED MODULE: ../ui/dist/lib/widgets/renderers/columnspanel/aggrfunc_column_renderer.js
22554
- var aggrfunc_column_renderer_extends = (undefined && undefined.__extends) || (function () {
22576
+ //# sourceMappingURL=attr_column_renderer_cp.js.map
22577
+ ;// CONCATENATED MODULE: ../ui/dist/lib/widgets/renderers/columnspanel/aggrfunc_column_renderer_cp.js
22578
+ var aggrfunc_column_renderer_cp_extends = (undefined && undefined.__extends) || (function () {
22555
22579
  var extendStatics = function (d, b) {
22556
22580
  extendStatics = Object.setPrototypeOf ||
22557
22581
  ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
@@ -22574,7 +22598,7 @@ var aggrfunc_column_renderer_extends = (undefined && undefined.__extends) || (fu
22574
22598
 
22575
22599
 
22576
22600
  var AggrFuncColumnRendererCP = /** @class */ (function (_super) {
22577
- aggrfunc_column_renderer_extends(AggrFuncColumnRendererCP, _super);
22601
+ aggrfunc_column_renderer_cp_extends(AggrFuncColumnRendererCP, _super);
22578
22602
  function AggrFuncColumnRendererCP() {
22579
22603
  var _this = _super !== null && _super.apply(this, arguments) || this;
22580
22604
  _this.displayFormatParser = new DisplayFormatParser();
@@ -22589,10 +22613,6 @@ var AggrFuncColumnRendererCP = /** @class */ (function (_super) {
22589
22613
  .getModel()
22590
22614
  .getAttributeByIdSafe(this.column.expr.args[0].value);
22591
22615
  };
22592
- AggrFuncColumnRendererCP.prototype.getDefaultColumnCaption = function () {
22593
- return this.getDefaultTitleText(this.baseAttr) + ' '
22594
- + this.panel.getContext().getModel().getAggrFunctionCaption(this.column.expr.func);
22595
- };
22596
22616
  AggrFuncColumnRendererCP.prototype.renderExpressionBlock = function () {
22597
22617
  var _this = this;
22598
22618
  var model = this.panel.getContext().getModel();
@@ -22677,14 +22697,6 @@ var AggrFuncColumnRendererCP = /** @class */ (function (_super) {
22677
22697
  }
22678
22698
  return button;
22679
22699
  };
22680
- AggrFuncColumnRendererCP.prototype.baseExpressionItemSelectedCallback = function (data, item) {
22681
- var attrid = data.id;
22682
- //this.column.expr.args[0].id = attrid;
22683
- this.column.expr.args[0].setValue(attrid, true);
22684
- this.column.caption = '';
22685
- this.fireColumnChanged();
22686
- return false;
22687
- };
22688
22700
  AggrFuncColumnRendererCP.prototype.changeTypeToSimple = function () {
22689
22701
  var query = this.column.getQuery();
22690
22702
  query.changeColumnType(this.column, ExprTag.EntityAttribute);
@@ -22711,6 +22723,10 @@ var AggrFuncColumnRendererCP = /** @class */ (function (_super) {
22711
22723
  }
22712
22724
  return result;
22713
22725
  };
22726
+ AggrFuncColumnRendererCP.prototype.updateBaseAttr = function (attr) {
22727
+ this.column.expr.args[0].setValue(attr.id, true);
22728
+ this.column.expr.baseAttrId = attr.id;
22729
+ };
22714
22730
  AggrFuncColumnRendererCP.prototype.changeTypeHandler = function (ev) {
22715
22731
  this.changeTypeToSimple();
22716
22732
  };
@@ -22729,11 +22745,11 @@ var AggrFuncColumnRendererCP = /** @class */ (function (_super) {
22729
22745
  }];
22730
22746
  };
22731
22747
  return AggrFuncColumnRendererCP;
22732
- }(SimpleColumnRendererCP));
22748
+ }(AttrColumnRendererCP));
22733
22749
 
22734
- //# sourceMappingURL=aggrfunc_column_renderer.js.map
22735
- ;// CONCATENATED MODULE: ../ui/dist/lib/widgets/renderers/columnspanel/customsql_column_renderer.js
22736
- var customsql_column_renderer_extends = (undefined && undefined.__extends) || (function () {
22750
+ //# sourceMappingURL=aggrfunc_column_renderer_cp.js.map
22751
+ ;// CONCATENATED MODULE: ../ui/dist/lib/widgets/renderers/columnspanel/editable_column_renderer_cp.js
22752
+ var editable_column_renderer_cp_extends = (undefined && undefined.__extends) || (function () {
22737
22753
  var extendStatics = function (d, b) {
22738
22754
  extendStatics = Object.setPrototypeOf ||
22739
22755
  ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
@@ -22754,51 +22770,25 @@ var customsql_column_renderer_extends = (undefined && undefined.__extends) || (f
22754
22770
 
22755
22771
 
22756
22772
 
22757
- var CustomSqlColumnRendererCP = /** @class */ (function (_super) {
22758
- customsql_column_renderer_extends(CustomSqlColumnRendererCP, _super);
22759
- function CustomSqlColumnRendererCP() {
22773
+ var EditableColumnRendererCP = /** @class */ (function (_super) {
22774
+ editable_column_renderer_cp_extends(EditableColumnRendererCP, _super);
22775
+ function EditableColumnRendererCP() {
22760
22776
  var _this = _super !== null && _super.apply(this, arguments) || this;
22761
22777
  _this.dataTypeMenu = null;
22762
22778
  return _this;
22763
22779
  }
22764
- CustomSqlColumnRendererCP.prototype.renderEnabledButton = function () {
22780
+ EditableColumnRendererCP.prototype.renderEnabledButton = function () {
22765
22781
  var elem = _super.prototype.renderEnabledButton.call(this);
22766
22782
  var child = elem.children[0];
22767
22783
  child.title = public_api.i18n.getText('CmdToggleEnableCustom');
22768
22784
  return elem;
22769
22785
  };
22770
22786
  ;
22771
- CustomSqlColumnRendererCP.prototype.getClassesToAdd = function () {
22787
+ EditableColumnRendererCP.prototype.getClassesToAdd = function () {
22772
22788
  return "".concat(this.cssPrefix, "-row ").concat(this.cssPrefix, "-row-column-entattr") + _super.prototype.getClassesToAdd.call(this);
22773
22789
  };
22774
- Object.defineProperty(CustomSqlColumnRendererCP.prototype, "columnEnabled", {
22775
- get: function () {
22776
- return this.panel.areCustomExpressionsAllowed() ? this.column.enabled : false;
22777
- },
22778
- set: function (value) {
22779
- if (this.panel.areCustomExpressionsAllowed()) {
22780
- this.column.enabled = value;
22781
- }
22782
- else {
22783
- this.column.enabled = false;
22784
- }
22785
- },
22786
- enumerable: false,
22787
- configurable: true
22788
- });
22789
- CustomSqlColumnRendererCP.prototype.renderColumnTypeButton = function () {
22790
- var button = _super.prototype.renderColumnTypeButton.call(this);
22791
- if (button) {
22792
- button.firstElementChild.classList.add('aggregated');
22793
- button.firstElementChild.setAttribute('title', public_api.i18n.getText('ButtonToSimple'));
22794
- }
22795
- return button;
22796
- };
22797
- CustomSqlColumnRendererCP.prototype.renderExpressionBlock = function () {
22790
+ EditableColumnRendererCP.prototype.renderExpressionBlock = function () {
22798
22791
  var _this = this;
22799
- if (!this.column.caption || this.column.caption == '') {
22800
- this.column.caption = this.getDefaultColumnCaption();
22801
- }
22802
22792
  var exprBlock = (0,lib_public_api.domel)("div")
22803
22793
  .addClass("".concat(this.cssPrefix, "-expr-block"))
22804
22794
  .addClass(browser_utils/* browserUtils.getMobileCssClass */.z.getMobileCssClass())
@@ -22828,7 +22818,7 @@ var CustomSqlColumnRendererCP = /** @class */ (function (_super) {
22828
22818
  )
22829
22819
  .addChild('input', function (b) { return b
22830
22820
  .hide()
22831
- .value(_this.column.expr.sql)
22821
+ .value(_this.getColumnValue())
22832
22822
  .on('blur keydown', function (ev) {
22833
22823
  var isEndEvent = false;
22834
22824
  var save = true;
@@ -22853,12 +22843,13 @@ var CustomSqlColumnRendererCP = /** @class */ (function (_super) {
22853
22843
  aEl.style.removeProperty('display');
22854
22844
  inputEl.style.display = 'none';
22855
22845
  }
22856
- if (save && _this.column.expr.sql !== inputEl.value) {
22857
- _this.column.expr.sql = inputEl.value;
22846
+ var colVal = _this.getColumnValue();
22847
+ if (save && colVal !== inputEl.value) {
22848
+ _this.setColumnValue(inputEl.value);
22858
22849
  _this.fireColumnChanged();
22859
22850
  }
22860
22851
  else {
22861
- inputEl.value = _this.column.expr.sql;
22852
+ inputEl.value = colVal;
22862
22853
  }
22863
22854
  _this.element.removeAttribute(lib_public_api.eqDragManager.DRAG_DISABLED_ATTR);
22864
22855
  }
@@ -22911,31 +22902,30 @@ var CustomSqlColumnRendererCP = /** @class */ (function (_super) {
22911
22902
  }
22912
22903
  return exprBlock;
22913
22904
  };
22914
- CustomSqlColumnRendererCP.prototype.changeTypeToSimple = function () {
22905
+ EditableColumnRendererCP.prototype.changeTypeToSimple = function () {
22915
22906
  var query = this.column.getQuery();
22916
22907
  query.changeColumnType(this.column, ExprTag.EntityAttribute);
22917
22908
  this.fireColumnChanged();
22918
22909
  };
22919
- CustomSqlColumnRendererCP.prototype.getDefaultColumnCaption = function () {
22920
- return "Custom SQL Column";
22910
+ EditableColumnRendererCP.prototype.getColumnValue = function () {
22911
+ return '';
22921
22912
  };
22922
- CustomSqlColumnRendererCP.prototype.getDefaultValue = function () {
22923
- return this.column.expr.sql;
22913
+ EditableColumnRendererCP.prototype.setColumnValue = function (value) {
22924
22914
  };
22925
- CustomSqlColumnRendererCP.prototype.getUIS = function () {
22915
+ EditableColumnRendererCP.prototype.getUIS = function () {
22926
22916
  return true;
22927
22917
  };
22928
- CustomSqlColumnRendererCP.prototype.changeTypeHandler = function (ev) {
22918
+ EditableColumnRendererCP.prototype.changeTypeHandler = function (ev) {
22929
22919
  this.changeTypeToSimple();
22930
22920
  };
22931
- CustomSqlColumnRendererCP.prototype.processExtraButtonMenuItems = function (action, evt) {
22921
+ EditableColumnRendererCP.prototype.processExtraButtonMenuItems = function (action, evt) {
22932
22922
  this.changeTypeToSimple();
22933
22923
  return true;
22934
22924
  };
22935
- CustomSqlColumnRendererCP.prototype.createFunctionMenu = function () {
22925
+ EditableColumnRendererCP.prototype.createFunctionMenu = function () {
22936
22926
  // Nothing TO DO
22937
22927
  };
22938
- CustomSqlColumnRendererCP.prototype.getExtraButtonMenuItems = function () {
22928
+ EditableColumnRendererCP.prototype.getExtraButtonMenuItems = function () {
22939
22929
  return [{
22940
22930
  id: '__group',
22941
22931
  text: public_api.i18n.getText('ColTypeGroup'),
@@ -22945,7 +22935,7 @@ var CustomSqlColumnRendererCP = /** @class */ (function (_super) {
22945
22935
  }]
22946
22936
  }];
22947
22937
  };
22948
- CustomSqlColumnRendererCP.prototype.createDataTypeMenu = function () {
22938
+ EditableColumnRendererCP.prototype.createDataTypeMenu = function () {
22949
22939
  var items = [];
22950
22940
  for (var typeItem in public_api.DataType) {
22951
22941
  if (!isNaN(Number(typeItem))) {
@@ -22968,10 +22958,74 @@ var CustomSqlColumnRendererCP = /** @class */ (function (_super) {
22968
22958
  };
22969
22959
  this.dataTypeMenu = new PopupMenu(menuOptions);
22970
22960
  };
22961
+ return EditableColumnRendererCP;
22962
+ }(AttrColumnRendererCP));
22963
+ var CustomSqlColumnRendererCP = /** @class */ (function (_super) {
22964
+ editable_column_renderer_cp_extends(CustomSqlColumnRendererCP, _super);
22965
+ function CustomSqlColumnRendererCP() {
22966
+ return _super !== null && _super.apply(this, arguments) || this;
22967
+ }
22968
+ Object.defineProperty(CustomSqlColumnRendererCP.prototype, "columnEnabled", {
22969
+ get: function () {
22970
+ return this.panel.areCustomExpressionsAllowed() ? this.column.enabled : false;
22971
+ },
22972
+ set: function (value) {
22973
+ if (this.panel.areCustomExpressionsAllowed()) {
22974
+ this.column.enabled = value;
22975
+ }
22976
+ else {
22977
+ this.column.enabled = false;
22978
+ }
22979
+ },
22980
+ enumerable: false,
22981
+ configurable: true
22982
+ });
22983
+ CustomSqlColumnRendererCP.prototype.renderColumnTypeButton = function () {
22984
+ var button = _super.prototype.renderColumnTypeButton.call(this);
22985
+ if (button) {
22986
+ button.firstElementChild.classList.add('aggregated');
22987
+ button.firstElementChild.setAttribute('title', public_api.i18n.getText('ButtonToSimple'));
22988
+ }
22989
+ return button;
22990
+ };
22991
+ CustomSqlColumnRendererCP.prototype.getColumnValue = function () {
22992
+ return this.column.expr.sql;
22993
+ };
22994
+ CustomSqlColumnRendererCP.prototype.setColumnValue = function (value) {
22995
+ this.column.expr.sql = value;
22996
+ };
22997
+ CustomSqlColumnRendererCP.prototype.getDefaultValue = function () {
22998
+ return this.column.expr.sql;
22999
+ };
22971
23000
  return CustomSqlColumnRendererCP;
22972
- }(SimpleColumnRendererCP));
23001
+ }(EditableColumnRendererCP));
23002
+
23003
+ var ConstColumnRendererCP = /** @class */ (function (_super) {
23004
+ editable_column_renderer_cp_extends(ConstColumnRendererCP, _super);
23005
+ function ConstColumnRendererCP() {
23006
+ return _super !== null && _super.apply(this, arguments) || this;
23007
+ }
23008
+ ConstColumnRendererCP.prototype.renderColumnTypeButton = function () {
23009
+ var button = _super.prototype.renderColumnTypeButton.call(this);
23010
+ if (button) {
23011
+ button.firstElementChild.classList.add('aggregated');
23012
+ button.firstElementChild.setAttribute('title', public_api.i18n.getText('ButtonToSimple'));
23013
+ }
23014
+ return button;
23015
+ };
23016
+ ConstColumnRendererCP.prototype.getColumnValue = function () {
23017
+ return this.column.expr.value;
23018
+ };
23019
+ ConstColumnRendererCP.prototype.setColumnValue = function (value) {
23020
+ this.column.expr.setValue(value);
23021
+ };
23022
+ ConstColumnRendererCP.prototype.getDefaultValue = function () {
23023
+ return this.column.expr.value;
23024
+ };
23025
+ return ConstColumnRendererCP;
23026
+ }(EditableColumnRendererCP));
22973
23027
 
22974
- //# sourceMappingURL=customsql_column_renderer.js.map
23028
+ //# sourceMappingURL=editable_column_renderer_cp.js.map
22975
23029
  ;// CONCATENATED MODULE: ../ui/dist/lib/widgets/columns_panel.js
22976
23030
  var columns_panel_extends = (undefined && undefined.__extends) || (function () {
22977
23031
  var extendStatics = function (d, b) {
@@ -23218,7 +23272,15 @@ var ColumnsPanel = /** @class */ (function (_super) {
23218
23272
  var index = query.getColumns().indexOf(column);
23219
23273
  var newEl = _this.addColumnElement(column, index);
23220
23274
  if (isFocusInside) {
23221
- newEl.querySelector("a").focus();
23275
+ var focusElem = newEl.querySelector('a');
23276
+ if (focusElem) {
23277
+ try {
23278
+ focusElem.focus();
23279
+ }
23280
+ catch (_a) {
23281
+ //do nothing
23282
+ }
23283
+ }
23222
23284
  }
23223
23285
  };
23224
23286
  if (Array.isArray(columns)) {
@@ -23318,7 +23380,13 @@ var ColumnsPanel = /** @class */ (function (_super) {
23318
23380
  };
23319
23381
  ColumnsPanel.prototype.setOptions = function (options) {
23320
23382
  public_api.utils.assignDeep(this.options, options);
23321
- this.getContext().options.allowCustomExpressions = options.allowCustomExpressions;
23383
+ this.context.options.allowCustomExpressions = options.allowCustomExpressions;
23384
+ if (options.attrElementFormat) {
23385
+ this.context.options.attributeFormat = options.attrElementFormat;
23386
+ }
23387
+ if (options.titleElementFormat) {
23388
+ this.context.options.columnTitleFormat = options.titleElementFormat;
23389
+ }
23322
23390
  if (browser_utils/* browserUtils.isMobileMode */.z.isMobileMode()) {
23323
23391
  this.options.buttons = ["menu"];
23324
23392
  this.options.showHeader = false;
@@ -23407,66 +23475,36 @@ var ColumnsPanel = /** @class */ (function (_super) {
23407
23475
  .data("show-buttons", "");
23408
23476
  }
23409
23477
  };
23410
- ColumnsPanel.prototype.addNewColumn = function (attrId, index) {
23411
- var _this = this;
23478
+ ColumnsPanel.prototype.addNewColumn = function (attrs, index) {
23412
23479
  var model = this.getContext().getModel();
23413
23480
  var query = this.getQuery();
23414
- var getColumnByAttrId = function (attrid) {
23415
- var attribute = model.getAttributeById(attrid);
23416
- if (!attribute) {
23417
- return null;
23418
- }
23419
- if (!attribute.useInResult) {
23420
- if (attribute.lookupAttr) {
23421
- attrid = attribute.lookupAttr;
23422
- attribute = model.getAttributeById(attrid);
23423
- if (!attribute || !attribute.useInResult) {
23424
- return null;
23425
- }
23426
- }
23427
- else
23428
- return null;
23429
- }
23430
- var column = query.createColumn();
23431
- column.caption = _this.getDefaultColumnCaption(attribute);
23432
- column.sorting = SortDirection.None;
23433
- column.sortIndex = -1;
23434
- column.expr.tag = ExprTag.EntityAttribute;
23435
- column.expr.kind = DataKind.Attribute;
23436
- column.expr.dataType = attribute.dataType;
23437
- column.expr.setValue(attrid, true);
23438
- column.params.concat(attribute.params);
23439
- return column;
23440
- };
23441
- var colToAdd, col;
23442
- if (Array.isArray(attrId)) {
23443
- colToAdd = [];
23444
- for (var i = 0; i < attrId.length; i++) {
23445
- col = getColumnByAttrId(attrId[i]);
23481
+ if (Array.isArray(attrs)) {
23482
+ var col = null;
23483
+ var cols = [];
23484
+ for (var i = 0; i < attrs.length; i++) {
23485
+ col = query.addColumn({
23486
+ attributeId: attrs[i],
23487
+ index: index
23488
+ }, true);
23446
23489
  if (col) {
23447
- colToAdd.push(col);
23490
+ cols.push(col);
23448
23491
  }
23449
23492
  }
23493
+ query.fireChangedEvent({
23494
+ part: QueryChangePart.Columns,
23495
+ action: QueryChangeAction.Add,
23496
+ changee: cols,
23497
+ source: this
23498
+ });
23499
+ return cols;
23450
23500
  }
23451
- else
23452
- colToAdd = getColumnByAttrId(attrId);
23453
- this.addColumn(colToAdd, index);
23454
- return colToAdd;
23455
- };
23456
- ColumnsPanel.prototype.addColumn = function (column, index) {
23457
- var query = this.getQuery();
23458
- if (!query) {
23459
- return;
23460
- }
23461
- if (Array.isArray(column))
23462
- column = this.checkColumnsArray(column);
23463
- else
23464
- column = this.checkColumn(column);
23465
- if (!column || (Array.isArray(column) && column.length == 0)) {
23466
- return;
23501
+ else {
23502
+ var col = query.addColumn({
23503
+ attributeId: attrs,
23504
+ index: index
23505
+ });
23506
+ return col;
23467
23507
  }
23468
- query.addColumnObj(column, index, self);
23469
- query.fireColumnsChangedEvent(QueryChangeAction.Add, column);
23470
23508
  };
23471
23509
  //adds one column to the panel on the specified position
23472
23510
  ColumnsPanel.prototype.addColumnElement = function (column, index) {
@@ -23516,23 +23554,19 @@ var ColumnsPanel = /** @class */ (function (_super) {
23516
23554
  }
23517
23555
  return col;
23518
23556
  };
23519
- ColumnsPanel.prototype.getDefaultColumnCaption = function (attr) {
23520
- var format = this.options.titleElementFormat || this.options.attrElementFormat;
23521
- var model = this.getContext().getModel();
23522
- return model.getAttributeText(attr, format);
23523
- };
23524
23557
  ColumnsPanel.prototype.getColumnsBlock = function () {
23525
23558
  return this.columnsBlock;
23526
23559
  };
23527
23560
  ColumnsPanel.prototype.getColumnRenderer = function (column, slot) {
23528
23561
  switch (column.expr.tag) {
23562
+ case ExprTag.Constant:
23563
+ return new ConstColumnRendererCP(this, column, slot);
23529
23564
  case ExprTag.AggregateFunction:
23530
23565
  return new AggrFuncColumnRendererCP(this, column, slot);
23531
23566
  case ExprTag.CustomSql:
23532
23567
  return new CustomSqlColumnRendererCP(this, column, slot);
23533
- case ExprTag.EntityAttribute:
23534
- case ExprTag.ParentEntityAttribute:
23535
- return new SimpleColumnRendererCP(this, column, slot);
23568
+ default:
23569
+ return new AttrColumnRendererCP(this, column, slot);
23536
23570
  }
23537
23571
  return null;
23538
23572
  };
@@ -23741,7 +23775,6 @@ var ColumnRendererCB = /** @class */ (function () {
23741
23775
  });
23742
23776
  ColumnRendererCB.prototype.render = function () {
23743
23777
  var _this = this;
23744
- this.baseAttr = this.getAttribute();
23745
23778
  var builder = (0,lib_public_api.domel)('div');
23746
23779
  builder.data('id', this.column.id);
23747
23780
  if (this.element) {
@@ -23798,10 +23831,6 @@ var ColumnRendererCB = /** @class */ (function () {
23798
23831
  ColumnRendererCB.prototype.refresh = function () {
23799
23832
  this.render();
23800
23833
  };
23801
- ColumnRendererCB.prototype.getAttribute = function () {
23802
- var model = this.bar.getContext().getModel();
23803
- return model.getAttributeByIdSafe(this.column.expr.value);
23804
- };
23805
23834
  ColumnRendererCB.prototype.isEditable = function () {
23806
23835
  return this.column.enabled && !this.column.isReadOnly();
23807
23836
  };
@@ -23816,19 +23845,13 @@ var ColumnRendererCB = /** @class */ (function () {
23816
23845
  };
23817
23846
  ColumnRendererCB.prototype.renderCaptionBlock = function () {
23818
23847
  var _this = this;
23819
- if (!this.column.caption || this.column.caption == '') {
23820
- this.column.caption = this.getDefaultCaption();
23821
- }
23822
- var model = this.column.getModel();
23823
- var caption = this.baseAttr !== model.nullAttribute
23824
- ? this.column.caption
23825
- : model.getAttributeText(model.nullAttribute, '{attr}');
23848
+ var caption = this.column.caption;
23826
23849
  if (!this.isEditable()) {
23827
23850
  return (0,lib_public_api.domel)('div')
23828
23851
  .addClass("".concat(this.cssPrefix, "-colelement"), "".concat(this.cssPrefix, "-captionelement"))
23829
23852
  .addClass(browser_utils/* browserUtils.getMobileCssClass */.z.getMobileCssClass())
23830
23853
  .addChild('div', function (b) { return b
23831
- .title(_this.column.caption)
23854
+ .title(caption)
23832
23855
  .text(caption)
23833
23856
  .attr('tabIndex', '0'); })
23834
23857
  .toDOM();
@@ -24001,7 +24024,7 @@ var ColumnRendererCB = /** @class */ (function () {
24001
24024
  ColumnRendererCB.prototype.buttonDeleteClickHandler = function (ev) {
24002
24025
  ev.stopPropagation();
24003
24026
  var query = this.bar.getQuery();
24004
- query.removeColumn(this.column, this.bar);
24027
+ query.removeColumn(this.column);
24005
24028
  query.fireColumnsChangedEvent(QueryChangeAction.Delete, this.column);
24006
24029
  return false;
24007
24030
  };
@@ -24020,14 +24043,6 @@ var ColumnRendererCB = /** @class */ (function () {
24020
24043
  } })
24021
24044
  .toDOM();
24022
24045
  };
24023
- ColumnRendererCB.prototype.getDefaultCaption = function () {
24024
- return this.getDefaultTitleText(this.baseAttr);
24025
- };
24026
- ColumnRendererCB.prototype.getDefaultTitleText = function (attr) {
24027
- var format = this.bar.options.titleElementFormat || this.bar.options.attrElementFormat;
24028
- var model = this.bar.getContext().getModel();
24029
- return model.getAttributeText(attr, format);
24030
- };
24031
24046
  ColumnRendererCB.prototype.getClassesToAdd = function () {
24032
24047
  var result = "";
24033
24048
  result += this.column.enabled ? '' : " ".concat(this.cssPrefix, "-disabled");
@@ -24266,8 +24281,8 @@ var ColumnRendererCB = /** @class */ (function () {
24266
24281
  }());
24267
24282
 
24268
24283
  //# sourceMappingURL=column_renderer_cb.js.map
24269
- ;// CONCATENATED MODULE: ../ui/dist/lib/widgets/renderers/columnsbar/simple_column_renderer.js
24270
- var columnsbar_simple_column_renderer_extends = (undefined && undefined.__extends) || (function () {
24284
+ ;// CONCATENATED MODULE: ../ui/dist/lib/widgets/renderers/columnsbar/attr_column_renderer_cb.js
24285
+ var attr_column_renderer_cb_extends = (undefined && undefined.__extends) || (function () {
24271
24286
  var extendStatics = function (d, b) {
24272
24287
  extendStatics = Object.setPrototypeOf ||
24273
24288
  ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
@@ -24285,23 +24300,29 @@ var columnsbar_simple_column_renderer_extends = (undefined && undefined.__extend
24285
24300
 
24286
24301
 
24287
24302
 
24288
- var SimpleColumnRendererCB = /** @class */ (function (_super) {
24289
- columnsbar_simple_column_renderer_extends(SimpleColumnRendererCB, _super);
24290
- function SimpleColumnRendererCB() {
24303
+ var AttrColumnRendererCB = /** @class */ (function (_super) {
24304
+ attr_column_renderer_cb_extends(AttrColumnRendererCB, _super);
24305
+ function AttrColumnRendererCB() {
24291
24306
  return _super !== null && _super.apply(this, arguments) || this;
24292
24307
  }
24293
- SimpleColumnRendererCB.prototype.getClassesToAdd = function () {
24308
+ AttrColumnRendererCB.prototype.getClassesToAdd = function () {
24294
24309
  return "".concat(_super.prototype.getClassesToAdd.call(this), " ").concat(this.cssPrefix, "-row ").concat(this.cssPrefix, "-row-column-entattr");
24295
24310
  };
24296
- SimpleColumnRendererCB.prototype.baseExpressionItemSelectedCallback = function (data, item) {
24311
+ AttrColumnRendererCB.prototype.baseExpressionItemSelectedCallback = function (data, item) {
24297
24312
  var attrid = data.id;
24298
- //this.column.expr.id = attrid;
24299
- this.column.expr.setValue(attrid, true);
24300
- this.column.caption = '';
24301
- this.refresh();
24313
+ var context = this.bar.getContext();
24314
+ var attr = context.getModel().getAttributeById(attrid);
24315
+ this.updateBaseAttr(attr);
24316
+ this.column.caption = context.getDefaultColumnCaption(this.column);
24302
24317
  this.fireColumnChanged();
24318
+ return false;
24319
+ };
24320
+ AttrColumnRendererCB.prototype.updateBaseAttr = function (attr) {
24321
+ this.column.expr.setValue(attr.id, true);
24322
+ this.column.expr.baseAttrId = attr.id;
24323
+ this.column.expr.dataType = attr.dataType;
24303
24324
  };
24304
- SimpleColumnRendererCB.prototype.getUIS = function () {
24325
+ AttrColumnRendererCB.prototype.getUIS = function () {
24305
24326
  var arg = this.column.expr.args[0];
24306
24327
  if (arg) {
24307
24328
  var model = this.bar.getContext().getModel();
@@ -24311,17 +24332,17 @@ var SimpleColumnRendererCB = /** @class */ (function (_super) {
24311
24332
  return true;
24312
24333
  }
24313
24334
  };
24314
- SimpleColumnRendererCB.prototype.changeTypeToCustomSql = function () {
24335
+ AttrColumnRendererCB.prototype.changeTypeToCustomSql = function () {
24315
24336
  var query = this.column.getQuery();
24316
24337
  query.changeColumnType(this.column, ExprTag.CustomSql);
24317
24338
  this.fireColumnChanged();
24318
24339
  };
24319
- SimpleColumnRendererCB.prototype.changeTypeToAggr = function (funcId) {
24340
+ AttrColumnRendererCB.prototype.changeTypeToAggr = function (funcId) {
24320
24341
  var query = this.column.getQuery();
24321
24342
  query.changeColumnType(this.column, ExprTag.AggregateFunction, { funcId: funcId });
24322
24343
  this.fireColumnChanged();
24323
24344
  };
24324
- SimpleColumnRendererCB.prototype.changeColumnTypeHandler = function (ev) {
24345
+ AttrColumnRendererCB.prototype.changeColumnTypeHandler = function (ev) {
24325
24346
  var _this = this;
24326
24347
  this.functionMenu.showMenu({
24327
24348
  anchor: ev.target,
@@ -24343,12 +24364,12 @@ var SimpleColumnRendererCB = /** @class */ (function (_super) {
24343
24364
  }
24344
24365
  });
24345
24366
  };
24346
- return SimpleColumnRendererCB;
24367
+ return AttrColumnRendererCB;
24347
24368
  }(ColumnRendererCB));
24348
24369
 
24349
- //# sourceMappingURL=simple_column_renderer.js.map
24350
- ;// CONCATENATED MODULE: ../ui/dist/lib/widgets/renderers/columnsbar/aggrfunc_column_renderer.js
24351
- var columnsbar_aggrfunc_column_renderer_extends = (undefined && undefined.__extends) || (function () {
24370
+ //# sourceMappingURL=attr_column_renderer_cb.js.map
24371
+ ;// CONCATENATED MODULE: ../ui/dist/lib/widgets/renderers/columnsbar/aggrfunc_column_renderer_cb.js
24372
+ var aggrfunc_column_renderer_cb_extends = (undefined && undefined.__extends) || (function () {
24352
24373
  var extendStatics = function (d, b) {
24353
24374
  extendStatics = Object.setPrototypeOf ||
24354
24375
  ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
@@ -24367,23 +24388,13 @@ var columnsbar_aggrfunc_column_renderer_extends = (undefined && undefined.__exte
24367
24388
 
24368
24389
 
24369
24390
  var AggrFuncColumnRendererCB = /** @class */ (function (_super) {
24370
- columnsbar_aggrfunc_column_renderer_extends(AggrFuncColumnRendererCB, _super);
24391
+ aggrfunc_column_renderer_cb_extends(AggrFuncColumnRendererCB, _super);
24371
24392
  function AggrFuncColumnRendererCB() {
24372
24393
  return _super !== null && _super.apply(this, arguments) || this;
24373
24394
  }
24374
24395
  AggrFuncColumnRendererCB.prototype.getClassesToAdd = function () {
24375
24396
  return "".concat(_super.prototype.getClassesToAdd.call(this), " ").concat(this.cssPrefix, "-row ").concat(this.cssPrefix, "-row-column-aggr");
24376
24397
  };
24377
- AggrFuncColumnRendererCB.prototype.getAttribute = function () {
24378
- return this.bar
24379
- .getContext()
24380
- .getModel()
24381
- .getAttributeByIdSafe(this.column.expr.args[0].value);
24382
- };
24383
- AggrFuncColumnRendererCB.prototype.getDefaultCaption = function () {
24384
- return this.getDefaultTitleText(this.baseAttr) + ' '
24385
- + this.bar.getContext().getModel().getAggrFunctionCaption(this.column.expr.func);
24386
- };
24387
24398
  AggrFuncColumnRendererCB.prototype.renderColumnTypeButton = function () {
24388
24399
  var button = _super.prototype.renderColumnTypeButton.call(this);
24389
24400
  if (button) {
@@ -24392,12 +24403,9 @@ var AggrFuncColumnRendererCB = /** @class */ (function (_super) {
24392
24403
  }
24393
24404
  return button;
24394
24405
  };
24395
- AggrFuncColumnRendererCB.prototype.baseExpressionItemSelectedCallback = function (data, item) {
24396
- var attrid = data.id;
24397
- //this.column.expr.args[0].id = attrid;
24398
- this.column.expr.args[0].setValue(attrid, true);
24399
- this.column.caption = '';
24400
- this.fireColumnChanged();
24406
+ AggrFuncColumnRendererCB.prototype.updateBaseAttr = function (attr) {
24407
+ this.column.expr.args[0].setValue(attr.id, true);
24408
+ this.column.expr.baseAttrId = attr.id;
24401
24409
  };
24402
24410
  AggrFuncColumnRendererCB.prototype.changeTypeToSimple = function () {
24403
24411
  var query = this.column.getQuery();
@@ -24408,9 +24416,112 @@ var AggrFuncColumnRendererCB = /** @class */ (function (_super) {
24408
24416
  this.changeTypeToSimple();
24409
24417
  };
24410
24418
  return AggrFuncColumnRendererCB;
24411
- }(SimpleColumnRendererCB));
24419
+ }(AttrColumnRendererCB));
24420
+
24421
+ //# sourceMappingURL=aggrfunc_column_renderer_cb.js.map
24422
+ ;// CONCATENATED MODULE: ../ui/dist/lib/widgets/renderers/columnsbar/editable_column_renderer_cb.js
24423
+ var editable_column_renderer_cb_extends = (undefined && undefined.__extends) || (function () {
24424
+ var extendStatics = function (d, b) {
24425
+ extendStatics = Object.setPrototypeOf ||
24426
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
24427
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
24428
+ return extendStatics(d, b);
24429
+ };
24430
+ return function (d, b) {
24431
+ if (typeof b !== "function" && b !== null)
24432
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
24433
+ extendStatics(d, b);
24434
+ function __() { this.constructor = d; }
24435
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
24436
+ };
24437
+ })();
24438
+
24439
+
24440
+ var EditableColumnRendererCB = /** @class */ (function (_super) {
24441
+ editable_column_renderer_cb_extends(EditableColumnRendererCB, _super);
24442
+ function EditableColumnRendererCB() {
24443
+ return _super !== null && _super.apply(this, arguments) || this;
24444
+ }
24445
+ EditableColumnRendererCB.prototype.getClassesToAdd = function () {
24446
+ return "".concat(this.cssPrefix, "-row ").concat(this.cssPrefix, "-row-column-entattr") + _super.prototype.getClassesToAdd.call(this);
24447
+ };
24448
+ EditableColumnRendererCB.prototype.renderColumnTypeButton = function () {
24449
+ var button = _super.prototype.renderColumnTypeButton.call(this);
24450
+ if (button) {
24451
+ button.classList.add('aggregated');
24452
+ button.title = public_api.i18n.getText('ButtonToSimple');
24453
+ }
24454
+ return button;
24455
+ };
24456
+ EditableColumnRendererCB.prototype.changeTypeToSimple = function () {
24457
+ var query = this.column.getQuery();
24458
+ query.changeColumnType(this.column, ExprTag.EntityAttribute);
24459
+ this.fireColumnChanged();
24460
+ };
24461
+ EditableColumnRendererCB.prototype.getColumnValue = function () {
24462
+ return '';
24463
+ };
24464
+ EditableColumnRendererCB.prototype.setColumnValue = function (value) {
24465
+ };
24466
+ EditableColumnRendererCB.prototype.getUIS = function () {
24467
+ return true;
24468
+ };
24469
+ EditableColumnRendererCB.prototype.changeColumnTypeHandler = function (ev) {
24470
+ this.changeTypeToSimple();
24471
+ };
24472
+ return EditableColumnRendererCB;
24473
+ }(ColumnRendererCB));
24474
+
24475
+ var CustomSqlColumnRendererCB = /** @class */ (function (_super) {
24476
+ editable_column_renderer_cb_extends(CustomSqlColumnRendererCB, _super);
24477
+ function CustomSqlColumnRendererCB() {
24478
+ return _super !== null && _super.apply(this, arguments) || this;
24479
+ }
24480
+ Object.defineProperty(CustomSqlColumnRendererCB.prototype, "columnEnabled", {
24481
+ get: function () {
24482
+ return this.bar.areCustomExpressionsAllowed() ? this.column.enabled : false;
24483
+ },
24484
+ set: function (value) {
24485
+ if (this.bar.areCustomExpressionsAllowed()) {
24486
+ this.column.enabled = value;
24487
+ }
24488
+ else {
24489
+ this.column.enabled = false;
24490
+ }
24491
+ },
24492
+ enumerable: false,
24493
+ configurable: true
24494
+ });
24495
+ CustomSqlColumnRendererCB.prototype.getColumnValue = function () {
24496
+ return this.column.expr.sql;
24497
+ };
24498
+ CustomSqlColumnRendererCB.prototype.setColumnValue = function (value) {
24499
+ this.column.expr.sql = value;
24500
+ };
24501
+ CustomSqlColumnRendererCB.prototype.getDefaultValue = function () {
24502
+ return this.column.expr.sql;
24503
+ };
24504
+ return CustomSqlColumnRendererCB;
24505
+ }(EditableColumnRendererCB));
24412
24506
 
24413
- //# sourceMappingURL=aggrfunc_column_renderer.js.map
24507
+ var ConstColumnRendererCB = /** @class */ (function (_super) {
24508
+ editable_column_renderer_cb_extends(ConstColumnRendererCB, _super);
24509
+ function ConstColumnRendererCB() {
24510
+ return _super !== null && _super.apply(this, arguments) || this;
24511
+ }
24512
+ ConstColumnRendererCB.prototype.getColumnValue = function () {
24513
+ return this.column.expr.value;
24514
+ };
24515
+ ConstColumnRendererCB.prototype.setColumnValue = function (value) {
24516
+ this.column.expr.setValue(value);
24517
+ };
24518
+ ConstColumnRendererCB.prototype.getDefaultValue = function () {
24519
+ return this.column.expr.value;
24520
+ };
24521
+ return ConstColumnRendererCB;
24522
+ }(EditableColumnRendererCB));
24523
+
24524
+ //# sourceMappingURL=editable_column_renderer_cb.js.map
24414
24525
  ;// CONCATENATED MODULE: ../ui/dist/lib/widgets/columns_bar.js
24415
24526
  var columns_bar_extends = (undefined && undefined.__extends) || (function () {
24416
24527
  var extendStatics = function (d, b) {
@@ -24436,6 +24547,7 @@ var columns_bar_extends = (undefined && undefined.__extends) || (function () {
24436
24547
 
24437
24548
 
24438
24549
 
24550
+
24439
24551
  var ColumnsBar = /** @class */ (function (_super) {
24440
24552
  columns_bar_extends(ColumnsBar, _super);
24441
24553
  function ColumnsBar(slot, customQuery) {
@@ -24450,8 +24562,6 @@ var ColumnsBar = /** @class */ (function (_super) {
24450
24562
  allowDuplicates: true,
24451
24563
  allowCustomExpressions: false,
24452
24564
  allowSorting: true,
24453
- attrElementFormat: '{entity} {attr}',
24454
- titleElementFormat: null,
24455
24565
  alwaysShowButtons: false,
24456
24566
  accentActiveColumn: true,
24457
24567
  allowDragDrop: true,
@@ -24504,6 +24614,12 @@ var ColumnsBar = /** @class */ (function (_super) {
24504
24614
  var _this = this;
24505
24615
  _super.prototype.init.call(this, context, options);
24506
24616
  this.setOptions(options);
24617
+ if (options.attrElementFormat) {
24618
+ this.context.options.attributeFormat = options.attrElementFormat;
24619
+ }
24620
+ if (options.titleElementFormat) {
24621
+ this.context.options.columnTitleFormat = options.titleElementFormat;
24622
+ }
24507
24623
  this.detachQueryObserver();
24508
24624
  this.attachQueryObserver();
24509
24625
  lib_public_api.eqDragManager.removeDropContainer(this.slot);
@@ -24634,6 +24750,7 @@ var ColumnsBar = /** @class */ (function (_super) {
24634
24750
  };
24635
24751
  ColumnsBar.prototype.setOptions = function (options) {
24636
24752
  this.options = public_api.utils.assignDeep(this.options, options);
24753
+ this.getContext().options.allowCustomExpressions = options.allowCustomExpressions;
24637
24754
  };
24638
24755
  ColumnsBar.prototype.showLandingSlot = function (pageX, pageY) {
24639
24756
  var elements = this.columnsBlock.querySelectorAll("[class*=".concat(this.cssPrefix, "-row]"));
@@ -24885,64 +25002,41 @@ var ColumnsBar = /** @class */ (function (_super) {
24885
25002
  };
24886
25003
  ColumnsBar.prototype.getColumnRenderer = function (column, slot) {
24887
25004
  switch (column.expr.tag) {
25005
+ case ExprTag.Constant:
25006
+ return new ConstColumnRendererCB(this, column, slot);
24888
25007
  case ExprTag.AggregateFunction:
24889
25008
  return new AggrFuncColumnRendererCB(this, column, slot);
24890
25009
  case ExprTag.CustomSql:
24891
- // return new CustomSqlColumnRendererCB(this, column, slot);
24892
- case ExprTag.EntityAttribute:
24893
- case ExprTag.ParentEntityAttribute:
24894
- return new SimpleColumnRendererCB(this, column, slot);
25010
+ return new CustomSqlColumnRendererCB(this, column, slot);
25011
+ default:
25012
+ return new AttrColumnRendererCB(this, column, slot);
24895
25013
  }
24896
25014
  return null;
24897
25015
  };
24898
- ColumnsBar.prototype.addNewColumn = function (attrId, index) {
24899
- var _this = this;
25016
+ ColumnsBar.prototype.addNewColumn = function (attrs, index) {
24900
25017
  var model = this.getContext().getModel();
24901
25018
  var query = this.getQuery();
24902
- var getColumnByAttrId = function (attrid) {
24903
- var attribute = model.getAttributeById(attrid);
24904
- if (!attribute) {
24905
- return null;
24906
- }
24907
- if (!attribute.useInResult) {
24908
- if (attribute.lookupAttr) {
24909
- attrid = attribute.lookupAttr;
24910
- attribute = model.getAttributeById(attrid);
24911
- if (!attribute || !attribute.useInResult) {
24912
- return null;
24913
- }
24914
- }
24915
- else
24916
- return null;
24917
- }
24918
- var column = query.createColumn();
24919
- column.caption = _this.getDefaultColumnCaption(attribute);
24920
- column.sorting = SortDirection.None;
24921
- column.sortIndex = -1;
24922
- column.expr.tag = ExprTag.EntityAttribute;
24923
- column.expr.kind = DataKind.Attribute;
24924
- column.expr.dataType = attribute.dataType;
24925
- column.expr.setValue(attrid, true);
24926
- column.params.concat(attribute.params);
24927
- return column;
24928
- };
24929
- if (!this.getQuery()) {
24930
- return;
24931
- }
24932
- var colToAdd, col;
24933
- if (Array.isArray(attrId)) {
24934
- colToAdd = [];
24935
- for (var i = 0; i < attrId.length; i++) {
24936
- col = getColumnByAttrId(attrId[i]);
25019
+ if (Array.isArray(attrs)) {
25020
+ var col = null;
25021
+ var cols = [];
25022
+ for (var i = 0; i < attrs.length; i++) {
25023
+ col = query.addColumn({
25024
+ attributeId: attrs[i],
25025
+ index: index
25026
+ }, true);
24937
25027
  if (col) {
24938
- colToAdd.push(col);
25028
+ cols.push(col);
24939
25029
  }
24940
25030
  }
25031
+ return cols;
25032
+ }
25033
+ else {
25034
+ var col = query.addColumn({
25035
+ attributeId: attrs,
25036
+ index: index
25037
+ });
25038
+ return col;
24941
25039
  }
24942
- else
24943
- colToAdd = getColumnByAttrId(attrId);
24944
- this.addColumn(colToAdd, index);
24945
- return colToAdd;
24946
25040
  };
24947
25041
  ColumnsBar.prototype.toggleColumnPicked = function (column) {
24948
25042
  var el;
@@ -24967,25 +25061,6 @@ var ColumnsBar = /** @class */ (function (_super) {
24967
25061
  .data("show-buttons", "");
24968
25062
  }
24969
25063
  };
24970
- ColumnsBar.prototype.addColumn = function (column, index) {
24971
- var query = this.getQuery();
24972
- if (!query) {
24973
- return;
24974
- }
24975
- if (Array.isArray(column))
24976
- column = this.checkColumnsArray(column);
24977
- else
24978
- column = this.checkColumn(column);
24979
- if (!column || (Array.isArray(column) && column.length == 0)) {
24980
- return;
24981
- }
24982
- query.addColumnObj(column, index, self);
24983
- query.fireChangedEvent({
24984
- part: QueryChangePart.Columns,
24985
- action: QueryChangeAction.Add,
24986
- changee: column
24987
- });
24988
- };
24989
25064
  //adds one column to the bar on the specified position
24990
25065
  ColumnsBar.prototype.addColumnElement = function (column, index) {
24991
25066
  var rows = this.columnsBlock.querySelectorAll("[class*=".concat(this.cssPrefix, "-row]"));
@@ -25028,11 +25103,6 @@ var ColumnsBar = /** @class */ (function (_super) {
25028
25103
  }
25029
25104
  return col;
25030
25105
  };
25031
- ColumnsBar.prototype.getDefaultColumnCaption = function (attr) {
25032
- var format = this.options.titleElementFormat || this.options.attrElementFormat;
25033
- var model = this.getContext().getModel();
25034
- return model.getAttributeText(attr, format);
25035
- };
25036
25106
  ColumnsBar.prototype.getColumnsBlock = function () {
25037
25107
  return this.columnsBlock;
25038
25108
  };
@@ -25134,13 +25204,13 @@ var ColumnsBar = /** @class */ (function (_super) {
25134
25204
  };
25135
25205
  ColumnsBar.prototype.areCustomExpressionsAllowed = function () {
25136
25206
  var query = this.getQuery();
25137
- return query.isEx() && this.options.allowCustomExpressions;
25207
+ return query.isEx() && this.getContext().options.allowCustomExpressions;
25138
25208
  };
25139
25209
  ColumnsBar.globalCounter = 0;
25140
25210
  return ColumnsBar;
25141
25211
  }(Widget));
25142
25212
  //# sourceMappingURL=columns_bar.js.map
25143
- ;// CONCATENATED MODULE: ../ui/dist/lib/widgets/renderers/sortingbar/column_renderer_sp.js
25213
+ ;// CONCATENATED MODULE: ../ui/dist/lib/widgets/renderers/sortingbar/column_renderer_sb.js
25144
25214
 
25145
25215
 
25146
25216
 
@@ -25164,7 +25234,6 @@ var ColumnRendererSB = /** @class */ (function () {
25164
25234
  });
25165
25235
  ColumnRendererSB.prototype.render = function () {
25166
25236
  var _this = this;
25167
- this.baseAttr = this.getAttribute();
25168
25237
  var builder = (0,lib_public_api.domel)('div');
25169
25238
  builder.data('id', this.column.id);
25170
25239
  if (this.element) {
@@ -25215,9 +25284,6 @@ var ColumnRendererSB = /** @class */ (function () {
25215
25284
  };
25216
25285
  ColumnRendererSB.prototype.renderCaptionBlock = function () {
25217
25286
  var _this = this;
25218
- if (!this.column.caption || this.column.caption == '') {
25219
- this.column.caption = this.getDefaultCaption();
25220
- }
25221
25287
  function getArrow(sd) {
25222
25288
  switch (sd) {
25223
25289
  case SortDirection.Ascending:
@@ -25287,7 +25353,7 @@ var ColumnRendererSB = /** @class */ (function () {
25287
25353
  if (data.id == 'None' || data.id == "Ascending" || data.id == "Descending") {
25288
25354
  var query = _this.bar.getContext().getQuery();
25289
25355
  if (_this.column.isJustSorted() && data.id == 'None') {
25290
- query.removeColumn(_this.column, _this.bar);
25356
+ query.removeColumn(_this.column);
25291
25357
  query.fireColumnsChangedEvent(QueryChangeAction.Delete, _this.column, true);
25292
25358
  }
25293
25359
  else {
@@ -25306,14 +25372,6 @@ var ColumnRendererSB = /** @class */ (function () {
25306
25372
  });
25307
25373
  return false;
25308
25374
  };
25309
- ColumnRendererSB.prototype.getDefaultCaption = function () {
25310
- return this.getDefaultTitleText(this.baseAttr);
25311
- };
25312
- ColumnRendererSB.prototype.getDefaultTitleText = function (attr) {
25313
- var format = this.bar.options.titleElementFormat || this.bar.options.attrElementFormat;
25314
- var model = this.bar.getContext().getModel();
25315
- return model.getAttributeText(attr, format);
25316
- };
25317
25375
  ColumnRendererSB.prototype.getClassesToAdd = function () {
25318
25376
  return "".concat(this.cssPrefix, "-row ").concat(this.cssPrefix, "-row-column-entattr");
25319
25377
  };
@@ -25325,7 +25383,7 @@ var ColumnRendererSB = /** @class */ (function () {
25325
25383
  return ColumnRendererSB;
25326
25384
  }());
25327
25385
 
25328
- //# sourceMappingURL=column_renderer_sp.js.map
25386
+ //# sourceMappingURL=column_renderer_sb.js.map
25329
25387
  ;// CONCATENATED MODULE: ../ui/dist/lib/widgets/sorting_bar.js
25330
25388
  var sorting_bar_extends = (undefined && undefined.__extends) || (function () {
25331
25389
  var extendStatics = function (d, b) {
@@ -25355,8 +25413,6 @@ var SortingBar = /** @class */ (function (_super) {
25355
25413
  var _this = _super.call(this, slot) || this;
25356
25414
  _this.options = {
25357
25415
  showAddRow: true,
25358
- attrElementFormat: '{entity} {attr}',
25359
- titleElementFormat: null,
25360
25416
  allowDragDrop: true,
25361
25417
  menuOptions: {
25362
25418
  showSearchBoxAfter: 30,
@@ -25400,6 +25456,12 @@ var SortingBar = /** @class */ (function (_super) {
25400
25456
  var _this = this;
25401
25457
  _super.prototype.init.call(this, context, options);
25402
25458
  this.setOptions(options);
25459
+ if (options.attrElementFormat) {
25460
+ this.context.options.attributeFormat = options.attrElementFormat;
25461
+ }
25462
+ if (options.titleElementFormat) {
25463
+ this.context.options.columnTitleFormat = options.titleElementFormat;
25464
+ }
25403
25465
  this.destroyCore();
25404
25466
  this.attachQueryObserver();
25405
25467
  lib_public_api.eqDragManager.removeDropContainer(this.slot);
@@ -25552,48 +25614,20 @@ var SortingBar = /** @class */ (function (_super) {
25552
25614
  });
25553
25615
  };
25554
25616
  SortingBar.prototype.addNewColumn = function (attrId) {
25555
- var _this = this;
25556
25617
  var model = this.getModel();
25557
25618
  var query = this.getQuery();
25558
- var getColumnByAttrId = function (attrid) {
25559
- var attribute = model.getAttributeById(attrid);
25560
- if (!attribute) {
25561
- return null;
25562
- }
25563
- if (!attribute.useInSorting) {
25564
- if (attribute.lookupAttr) {
25565
- attrid = attribute.lookupAttr;
25566
- attribute = model.getAttributeById(attrid);
25567
- if (!attribute || !attribute.useInSorting) {
25568
- return null;
25569
- }
25570
- }
25571
- else
25572
- return null;
25573
- }
25574
- var column = query.createColumn(true);
25575
- column.caption = _this.getDefaultColumnCaption(attribute);
25576
- column._sorting = SortDirection.Ascending;
25577
- //column.sortIndex = this.getQuery().getColumnSortIndex(column);
25578
- column.expr.tag = ExprTag.EntityAttribute;
25579
- column.expr.dataType = attribute.dataType;
25580
- //column.expr.id = attrid;
25581
- column.expr.setValue(attrid, true);
25582
- column.params.concat(attribute.params);
25583
- return column;
25584
- };
25585
- if (!this.getQuery()) {
25586
- return;
25587
- }
25588
- var newCol = getColumnByAttrId(attrId);
25589
- return this.getQuery().addColumn({
25590
- column: newCol
25619
+ var col = query.addColumn({
25620
+ attributeId: attrId,
25621
+ justsorted: true,
25622
+ sorting: SortDirection.Ascending
25591
25623
  });
25592
- };
25593
- SortingBar.prototype.getDefaultColumnCaption = function (attr) {
25594
- var format = this.options.titleElementFormat || this.options.attrElementFormat;
25595
- var model = this.getModel();
25596
- return model.getAttributeText(attr, format);
25624
+ query.fireChangedEvent({
25625
+ part: QueryChangePart.SortingColumns,
25626
+ action: QueryChangeAction.Add,
25627
+ changee: col,
25628
+ source: this
25629
+ });
25630
+ return col;
25597
25631
  };
25598
25632
  SortingBar.prototype.renderColumn = function (column, elem) {
25599
25633
  var renderer = new ColumnRendererSB(this, column, elem);
@@ -29315,78 +29349,17 @@ var EasyGridWidget = /** @class */ (function (_super) {
29315
29349
  }
29316
29350
  };
29317
29351
  EasyGridWidget.prototype.addNewColumn = function (attrId) {
29318
- var _this = this;
29319
- var model = this.getContext().getModel();
29320
- var query = this.getContext().getQuery();
29321
- var getColumnByAttrId = function (attrid) {
29322
- var attribute = model.getAttributeById(attrid);
29323
- if (!attribute) {
29324
- return null;
29325
- }
29326
- if (!attribute.useInSorting) {
29327
- if (attribute.lookupAttr) {
29328
- attrid = attribute.lookupAttr;
29329
- attribute = model.getAttributeById(attrid);
29330
- if (!attribute || !attribute.useInSorting) {
29331
- return null;
29332
- }
29333
- }
29334
- else
29335
- return null;
29336
- }
29337
- var column = query.createColumn();
29338
- column.caption = _this.getDefaultColumnCaption(attribute);
29339
- column.sorting = SortDirection.None;
29340
- column.sortIndex = -1;
29341
- column.expr.tag = ExprTag.EntityAttribute;
29342
- //column.expr.id = attrid;
29343
- column.expr.setValue(attrid, true);
29344
- column.params.concat(attribute.params);
29345
- return column;
29346
- };
29347
- if (!this.getContext().getQuery()) {
29348
- return;
29349
- }
29350
- return this.addColumn(getColumnByAttrId(attrId));
29351
- };
29352
- EasyGridWidget.prototype.getDefaultColumnCaption = function (attr) {
29353
- var format = this.options.titleElementFormat || this.options.attrElementFormat;
29354
29352
  var model = this.getContext().getModel();
29355
- return model.getAttributeText(attr, format);
29356
- };
29357
- EasyGridWidget.prototype.addColumn = function (column) {
29358
29353
  var query = this.getContext().getQuery();
29359
- if (!query) {
29360
- return;
29361
- }
29362
- column = this.checkColumn(column);
29363
- if (!column) {
29364
- return;
29365
- }
29366
- column = query.addColumn({
29367
- caption: column.caption,
29368
- attributeId: column.expr.value,
29369
- sorting: column.sorting,
29370
- sortIndex: column.sortIndex
29354
+ var col = query.addColumn({
29355
+ attributeId: attrId
29371
29356
  });
29372
29357
  query.fireChangedEvent({
29373
29358
  part: QueryChangePart.Columns,
29374
29359
  action: QueryChangeAction.Add,
29375
- changee: column,
29360
+ changee: col,
29376
29361
  source: this
29377
29362
  });
29378
- return column;
29379
- };
29380
- EasyGridWidget.prototype.checkColumn = function (col) {
29381
- var query = this.getContext().getQuery();
29382
- var columns = query.getColumns();
29383
- var colJson = JSON.stringify(col.expr.saveToData());
29384
- for (var i = 0; i < columns.length; i++) {
29385
- var qcolJson = JSON.stringify(columns[i].expr.saveToData());
29386
- if (qcolJson === colJson) {
29387
- return null;
29388
- }
29389
- }
29390
29363
  return col;
29391
29364
  };
29392
29365
  return EasyGridWidget;
@@ -33336,12 +33309,7 @@ var View = /** @class */ (function () {
33336
33309
  }
33337
33310
  // map columnTitleFormat option to widgets that have similar option
33338
33311
  if (options.columnTitleFormat) {
33339
- options.widgets.entitiesPanel = options.widgets.entitiesPanel || {};
33340
- options.widgets.entitiesPanel.columnTitleFormat = options.widgets.entitiesPanel.columnTitleFormat || options.columnTitleFormat;
33341
- options.widgets.columnsBar = options.widgets.columnsBar || {};
33342
- options.widgets.columnsBar.titleElementFormat = options.widgets.columnsBar.titleElementFormat || options.columnTitleFormat;
33343
- options.widgets.columnsPanel = options.widgets.columnsPanel || {};
33344
- options.widgets.columnsPanel.titleElementFormat = options.widgets.columnsPanel.titleElementFormat || options.columnTitleFormat;
33312
+ this.context.options.columnTitleFormat = options.columnTitleFormat;
33345
33313
  }
33346
33314
  //to support old paging options (should be removed in the next versions)
33347
33315
  options.widgets.easyGrid.paging =