@easyquery/ui 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.
Files changed (65) hide show
  1. package/dist/browser/eq.community.js +451 -483
  2. package/dist/browser/eq.community.js.map +1 -1
  3. package/dist/browser/eq.community.min.js +1 -1
  4. package/dist/browser/eq.community.min.js.map +1 -1
  5. package/dist/browser/eq.core.css +1 -1
  6. package/dist/browser/eq.view.css +1 -1
  7. package/dist/bundles/easyquery.ui.js +368 -435
  8. package/dist/bundles/easyquery.ui.js.map +1 -1
  9. package/dist/bundles/easyquery.ui.min.js +1 -1
  10. package/dist/bundles/easyquery.ui.min.js.map +1 -1
  11. package/dist/lib/public_api.d.ts +5 -5
  12. package/dist/lib/public_api.js +5 -5
  13. package/dist/lib/public_api.js.map +1 -1
  14. package/dist/lib/views/view.js +1 -6
  15. package/dist/lib/views/view.js.map +1 -1
  16. package/dist/lib/widgets/columns_bar.d.ts +2 -4
  17. package/dist/lib/widgets/columns_bar.js +35 -76
  18. package/dist/lib/widgets/columns_bar.js.map +1 -1
  19. package/dist/lib/widgets/columns_panel.d.ts +2 -4
  20. package/dist/lib/widgets/columns_panel.js +47 -67
  21. package/dist/lib/widgets/columns_panel.js.map +1 -1
  22. package/dist/lib/widgets/easy_grid_widget.d.ts +0 -3
  23. package/dist/lib/widgets/easy_grid_widget.js +4 -65
  24. package/dist/lib/widgets/easy_grid_widget.js.map +1 -1
  25. package/dist/lib/widgets/entities_panel.js +4 -9
  26. package/dist/lib/widgets/entities_panel.js.map +1 -1
  27. package/dist/lib/widgets/renderers/columnsbar/aggrfunc_column_renderer_cb.d.ts +9 -0
  28. package/dist/lib/widgets/renderers/columnsbar/{aggrfunc_column_renderer.js → aggrfunc_column_renderer_cb.js} +6 -19
  29. package/dist/lib/widgets/renderers/columnsbar/aggrfunc_column_renderer_cb.js.map +1 -0
  30. package/dist/lib/widgets/renderers/columnsbar/{simple_column_renderer.d.ts → attr_column_renderer_cb.d.ts} +4 -2
  31. package/dist/lib/widgets/renderers/columnsbar/{simple_column_renderer.js → attr_column_renderer_cb.js} +22 -16
  32. package/dist/lib/widgets/renderers/columnsbar/attr_column_renderer_cb.js.map +1 -0
  33. package/dist/lib/widgets/renderers/columnsbar/column_renderer_cb.d.ts +1 -5
  34. package/dist/lib/widgets/renderers/columnsbar/column_renderer_cb.js +3 -22
  35. package/dist/lib/widgets/renderers/columnsbar/column_renderer_cb.js.map +1 -1
  36. package/dist/lib/widgets/renderers/columnsbar/editable_column_renderer_cb.d.ts +22 -0
  37. package/dist/lib/widgets/renderers/columnsbar/editable_column_renderer_cb.js +102 -0
  38. package/dist/lib/widgets/renderers/columnsbar/editable_column_renderer_cb.js.map +1 -0
  39. package/dist/lib/widgets/renderers/columnspanel/{aggrfunc_column_renderer.d.ts → aggrfunc_column_renderer_cp.d.ts} +3 -4
  40. package/dist/lib/widgets/renderers/columnspanel/{aggrfunc_column_renderer.js → aggrfunc_column_renderer_cp.js} +7 -15
  41. package/dist/lib/widgets/renderers/columnspanel/aggrfunc_column_renderer_cp.js.map +1 -0
  42. package/dist/lib/widgets/renderers/columnspanel/{simple_column_renderer.d.ts → attr_column_renderer_cp.d.ts} +4 -1
  43. package/dist/lib/widgets/renderers/columnspanel/{simple_column_renderer.js → attr_column_renderer_cp.js} +31 -19
  44. package/dist/lib/widgets/renderers/columnspanel/attr_column_renderer_cp.js.map +1 -0
  45. package/dist/lib/widgets/renderers/columnspanel/column_renderer_cp.d.ts +1 -6
  46. package/dist/lib/widgets/renderers/columnspanel/column_renderer_cp.js +1 -20
  47. package/dist/lib/widgets/renderers/columnspanel/column_renderer_cp.js.map +1 -1
  48. package/dist/lib/widgets/renderers/columnspanel/{customsql_column_renderer.d.ts → editable_column_renderer_cp.d.ts} +19 -7
  49. package/dist/lib/widgets/renderers/columnspanel/{customsql_column_renderer.js → editable_column_renderer_cp.js} +88 -50
  50. package/dist/lib/widgets/renderers/columnspanel/editable_column_renderer_cp.js.map +1 -0
  51. package/dist/lib/widgets/renderers/querypanel/condition_renderer.js.map +1 -1
  52. package/dist/lib/widgets/renderers/sortingbar/{column_renderer_sp.d.ts → column_renderer_sb.d.ts} +0 -3
  53. package/dist/lib/widgets/renderers/sortingbar/{column_renderer_sp.js → column_renderer_sb.js} +2 -14
  54. package/dist/lib/widgets/renderers/sortingbar/column_renderer_sb.js.map +1 -0
  55. package/dist/lib/widgets/sorting_bar.d.ts +0 -1
  56. package/dist/lib/widgets/sorting_bar.js +19 -43
  57. package/dist/lib/widgets/sorting_bar.js.map +1 -1
  58. package/package.json +2 -2
  59. package/dist/lib/widgets/renderers/columnsbar/aggrfunc_column_renderer.d.ts +0 -11
  60. package/dist/lib/widgets/renderers/columnsbar/aggrfunc_column_renderer.js.map +0 -1
  61. package/dist/lib/widgets/renderers/columnsbar/simple_column_renderer.js.map +0 -1
  62. package/dist/lib/widgets/renderers/columnspanel/aggrfunc_column_renderer.js.map +0 -1
  63. package/dist/lib/widgets/renderers/columnspanel/customsql_column_renderer.js.map +0 -1
  64. package/dist/lib/widgets/renderers/columnspanel/simple_column_renderer.js.map +0 -1
  65. package/dist/lib/widgets/renderers/sortingbar/column_renderer_sp.js.map +0 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * EasyQuery.JS Community 7.2.4-rc04 (https://korzh.com/easyquery/javascript)
2
+ * EasyQuery.JS Community 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
@@ -12058,6 +12058,8 @@ __webpack_require__.d(lib_public_api_namespaceObject, {
12058
12058
  AggrSettingsDialog: function() { return AggrSettingsDialog; },
12059
12059
  AggrSettingsRenderer: function() { return AggrSettingsRenderer; },
12060
12060
  AggregationBar: function() { return AggregationBar; },
12061
+ AttrColumnRendererCB: function() { return AttrColumnRendererCB; },
12062
+ AttrColumnRendererCP: function() { return AttrColumnRendererCP; },
12061
12063
  AttributeExpressionRenderer: function() { return AttributeExpressionRenderer; },
12062
12064
  BaseElementRenderer: function() { return BaseElementRenderer; },
12063
12065
  ChartFacet: function() { return ChartFacet; },
@@ -12073,6 +12075,7 @@ __webpack_require__.d(lib_public_api_namespaceObject, {
12073
12075
  ConditionGroupRenderer: function() { return ConditionGroupRenderer; },
12074
12076
  ConditionGroupRowRenderer: function() { return ConditionGroupRowRenderer; },
12075
12077
  ConditionRenderer: function() { return ConditionRenderer; },
12078
+ ConstColumnRendererCP: function() { return ConstColumnRendererCP; },
12076
12079
  CustomListExpressionRenderer: function() { return CustomListExpressionRenderer; },
12077
12080
  CustomSqlColumnRendererCP: function() { return CustomSqlColumnRendererCP; },
12078
12081
  DataFilterView: function() { return DataFilterView; },
@@ -12104,8 +12107,6 @@ __webpack_require__.d(lib_public_api_namespaceObject, {
12104
12107
  ReportView: function() { return ReportView; },
12105
12108
  ResultFacet: function() { return ResultFacet; },
12106
12109
  ResultFacetsPanel: function() { return ResultFacetsPanel; },
12107
- SimpleColumnRendererCB: function() { return SimpleColumnRendererCB; },
12108
- SimpleColumnRendererCP: function() { return SimpleColumnRendererCP; },
12109
12110
  SimpleConditionRenderer: function() { return SimpleConditionRenderer; },
12110
12111
  SortingBar: function() { return SortingBar; },
12111
12112
  SqlListExpressionRenderer: function() { return SqlListExpressionRenderer; },
@@ -15354,7 +15355,6 @@ var Query = /** @class */ (function () {
15354
15355
  }
15355
15356
  public_api.utils.moveArrayItem(this.sortedColumns, colIdx, index);
15356
15357
  this.fixupSortingIndices();
15357
- this.fireColumnsChangedEvent(QueryChangeAction.All);
15358
15358
  };
15359
15359
  Query.prototype.getColumnSorting = function (col) {
15360
15360
  var idx = this.getColumnSortIndex(col);
@@ -15381,7 +15381,6 @@ var Query = /** @class */ (function () {
15381
15381
  }
15382
15382
  }
15383
15383
  this.adjustColumnsSorting();
15384
- this.fireColumnsChangedEvent(QueryChangeAction.Modify, col, col.isJustSorted());
15385
15384
  };
15386
15385
  Query.prototype.fixupSortingIndices = function () {
15387
15386
  this.sortedColumns.forEach(function (col, index) {
@@ -15430,10 +15429,8 @@ var Query = /** @class */ (function () {
15430
15429
  * sortIndex: SortDirection.Ascending
15431
15430
  * }});
15432
15431
  */
15433
- Query.prototype.addColumn = function (descriptor, author) {
15434
- // let columns = (descriptor.justsorted)
15435
- // ? this.justsorted
15436
- // : this.columns;
15432
+ Query.prototype.addColumn = function (descriptor, silent) {
15433
+ if (silent === void 0) { silent = false; }
15437
15434
  var newColumn;
15438
15435
  if (descriptor.column) {
15439
15436
  newColumn = descriptor.column;
@@ -15450,10 +15447,10 @@ var Query = /** @class */ (function () {
15450
15447
  throw new Error("Incorrect attribute id (".concat(descriptor.attributeId, "): addColumn"));
15451
15448
  }
15452
15449
  }
15453
- else {
15454
- throw new Error('Not enought data for addColumn operation. Need attribute or attributeId');
15450
+ else if (typeof descriptor.constValue === 'undefined' && !descriptor.customSql) {
15451
+ throw new Error('Not enought data for addColumn operation. One of the following options must be defined: attribute, attributeId, constValue or customSlq');
15455
15452
  }
15456
- if (!attr.useInResult) {
15453
+ if (attr && !attr.useInResult) {
15457
15454
  if (attr.lookupAttr) {
15458
15455
  attr = this.model.getAttributeById(attr.lookupAttr);
15459
15456
  }
@@ -15461,22 +15458,29 @@ var Query = /** @class */ (function () {
15461
15458
  throw new Error("Can't use this attribute for a column");
15462
15459
  }
15463
15460
  }
15464
- if (descriptor.aggrFuncId && descriptor.cusomtSql) {
15461
+ if (descriptor.aggrFuncId && descriptor.customSql) {
15465
15462
  console.warn("Column cannot be created using aggrFuncId and customSql at the same time. " +
15466
15463
  "cusomSql will be used.");
15467
15464
  }
15468
- if (descriptor.cusomtSql) {
15465
+ if (typeof descriptor.constValue !== 'undefined') {
15466
+ newColumn.expr.tag = ExprTag.Constant;
15467
+ newColumn.expr.setValue(descriptor.constValue);
15468
+ newColumn.expr.kind = DataKind.Scalar;
15469
+ newColumn.expr.dataType = descriptor.constType || public_api.DataType.String;
15470
+ }
15471
+ else if (descriptor.customSql) {
15469
15472
  newColumn.caption = 'Custom SQL Column';
15470
15473
  newColumn.expr.tag = ExprTag.CustomSql;
15471
- newColumn.expr.baseAttrId = attr.id;
15472
- newColumn.expr.sql = descriptor.cusomtSql;
15474
+ newColumn.expr.sql = descriptor.customSql;
15473
15475
  newColumn.expr.kind = DataKind.Query;
15474
15476
  newColumn.expr.dataType = public_api.DataType.Unknown;
15477
+ newColumn.expr.baseAttrId = descriptor.attributeId;
15478
+ if (!this.context.options.allowCustomExpressions) {
15479
+ newColumn.enabled = false;
15480
+ }
15475
15481
  }
15476
15482
  else if (descriptor.aggrFuncId) {
15477
15483
  var funcId = descriptor.aggrFuncId;
15478
- newColumn.caption = attr.caption + ' '
15479
- + this.model.getAggrFunctionCaption(descriptor.aggrFuncId);
15480
15484
  newColumn.expr.tag = ExprTag.AggregateFunction;
15481
15485
  newColumn.expr.func = descriptor.aggrFuncId;
15482
15486
  newColumn.expr.kind = DataKind.Scalar;
@@ -15485,16 +15489,18 @@ var Query = /** @class */ (function () {
15485
15489
  var arg = new Expression(newColumn);
15486
15490
  arg.setValue(attr.id, true);
15487
15491
  arg.tag = ExprTag.EntityAttribute;
15492
+ arg.kind = DataKind.Attribute;
15488
15493
  arg.dataType = attr.dataType;
15489
15494
  newColumn.expr.args.push(arg);
15490
15495
  }
15491
15496
  else {
15492
- newColumn.caption = attr.caption;
15493
15497
  newColumn.expr.setValue(attr.id, true);
15494
15498
  newColumn.expr.tag = ExprTag.EntityAttribute;
15499
+ newColumn.expr.kind = DataKind.Attribute;
15495
15500
  newColumn.expr.dataType = attr.dataType;
15501
+ newColumn.params.concat(attr.params);
15496
15502
  }
15497
- newColumn.caption = descriptor.caption || newColumn.caption;
15503
+ newColumn.caption = descriptor.caption || this.context.getDefaultColumnCaption(newColumn);
15498
15504
  newColumn._sorting = descriptor.sorting || SortDirection.None;
15499
15505
  newColumn._sortIndex = descriptor.sortIndex || -1;
15500
15506
  newColumn.enabled = public_api.utils.getIfDefined(descriptor.enabled, true);
@@ -15510,7 +15516,9 @@ var Query = /** @class */ (function () {
15510
15516
  }
15511
15517
  }
15512
15518
  this.setColumnSorting(newColumn, newColumn._sorting);
15513
- this.fireColumnsChangedEvent(QueryChangeAction.Add, newColumn, justsorted);
15519
+ if (!silent) {
15520
+ this.fireColumnsChangedEvent(QueryChangeAction.Add, newColumn, justsorted);
15521
+ }
15514
15522
  return newColumn;
15515
15523
  };
15516
15524
  /**
@@ -15564,9 +15572,6 @@ var Query = /** @class */ (function () {
15564
15572
  if (column.isJustSorted())
15565
15573
  return;
15566
15574
  args = args || {};
15567
- column.caption = (typeof args.caption !== 'undefined')
15568
- ? args.caption
15569
- : '';
15570
15575
  if (tag === ExprTag.AggregateFunction) {
15571
15576
  if (!args.funcId)
15572
15577
  throw Error('"funcId" argument is not defined');
@@ -15604,22 +15609,24 @@ var Query = /** @class */ (function () {
15604
15609
  || column.expr.tag === ExprTag.ParentEntityAttribute) {
15605
15610
  return;
15606
15611
  }
15607
- var exprId = (column.expr.tag === ExprTag.CustomSql)
15608
- ? column.expr.baseAttrId
15609
- : column.expr.args[0].value;
15610
- var attr = this.model.getAttributeById(exprId);
15612
+ var attrId = (column.expr.tag == ExprTag.AggregateFunction)
15613
+ ? column.expr.args[0].value
15614
+ : column.expr.baseAttrId;
15615
+ var attr = attrId
15616
+ ? this.model.getAttributeById(attrId)
15617
+ : this.model.getFirstUICAttr();
15611
15618
  var expr = new Expression(column);
15612
15619
  expr.tag = ExprTag.EntityAttribute;
15613
- expr.dataType = attr != null ? attr.dataType : public_api.DataType.Unknown;
15614
- expr.setValue(exprId, true);
15620
+ expr.dataType = attr.dataType;
15621
+ expr.setValue(attr.id, true);
15615
15622
  column.expr = expr;
15616
15623
  }
15624
+ column.caption = this.context.getDefaultColumnCaption(column);
15617
15625
  };
15618
15626
  /**
15619
15627
  * Moves the column with specified index to another position.
15620
15628
  * @param index1 The index of the column that should be moved.
15621
15629
  * @param index2 The index of the position the column should be moved to
15622
- * @param author The author
15623
15630
  */
15624
15631
  Query.prototype.moveColumn = function (index1, index2) {
15625
15632
  var columns = this.getColumns();
@@ -15629,12 +15636,8 @@ var Query = /** @class */ (function () {
15629
15636
  /**
15630
15637
  * Removes the column.
15631
15638
  * @param column The column to be removed.
15632
- * @param author The author
15633
15639
  */
15634
- Query.prototype.removeColumn = function (column, author) {
15635
- // const columns = (column.isJustSorted())
15636
- // ? this.getJustSortedColumns()
15637
- // : this.getColumns();
15640
+ Query.prototype.removeColumn = function (column) {
15638
15641
  public_api.utils.removeArrayItem(this.columns, column);
15639
15642
  public_api.utils.removeArrayItem(this.sortedColumns, column);
15640
15643
  };
@@ -16753,13 +16756,6 @@ var InMemoryModelStorage = /** @class */ (function () {
16753
16756
  }());
16754
16757
 
16755
16758
  //# sourceMappingURL=model_storage.js.map
16756
- ;// CONCATENATED MODULE: ../core/dist/lib/main/action.js
16757
- var EqActionResult;
16758
- (function (EqActionResult) {
16759
- EqActionResult[EqActionResult["Error"] = 0] = "Error";
16760
- EqActionResult[EqActionResult["Success"] = 1] = "Success";
16761
- })(EqActionResult || (EqActionResult = {}));
16762
- //# sourceMappingURL=action.js.map
16763
16759
  ;// CONCATENATED MODULE: ../core/dist/lib/eqs/eqs_exporter.js
16764
16760
 
16765
16761
  var EqServerExporter = /** @class */ (function () {
@@ -16821,6 +16817,13 @@ var EqServerExporter = /** @class */ (function () {
16821
16817
  }());
16822
16818
 
16823
16819
  //# sourceMappingURL=eqs_exporter.js.map
16820
+ ;// CONCATENATED MODULE: ../core/dist/lib/main/action.js
16821
+ var EqActionResult;
16822
+ (function (EqActionResult) {
16823
+ EqActionResult[EqActionResult["Error"] = 0] = "Error";
16824
+ EqActionResult[EqActionResult["Success"] = 1] = "Success";
16825
+ })(EqActionResult || (EqActionResult = {}));
16826
+ //# sourceMappingURL=action.js.map
16824
16827
  ;// CONCATENATED MODULE: ../core/dist/lib/main/context.js
16825
16828
  var context_assign = (undefined && undefined.__assign) || function () {
16826
16829
  context_assign = Object.assign || function(t) {
@@ -16858,7 +16861,9 @@ var EqContext = /** @class */ (function () {
16858
16861
  function EqContext() {
16859
16862
  var _this = this;
16860
16863
  this.options = {
16861
- syncSortOrderWithColumnsOrder: true
16864
+ syncSortOrderWithColumnsOrder: true,
16865
+ attributeFormat: '{entity} {attr}',
16866
+ columnTitleFormat: null //means it will be the same as attributeFormat
16862
16867
  };
16863
16868
  this.servicesInitialized = false;
16864
16869
  this.internalListCache = {};
@@ -18277,6 +18282,37 @@ var EqContext = /** @class */ (function () {
18277
18282
  });
18278
18283
  }
18279
18284
  };
18285
+ EqContext.prototype.getAttributeTitle = function (attr) {
18286
+ var format = this.options.attributeFormat;
18287
+ return this.getModel().getAttributeText(attr, format);
18288
+ };
18289
+ EqContext.prototype.getColumnTitle = function (attr) {
18290
+ var format = this.options.columnTitleFormat || this.options.attributeFormat;
18291
+ return this.getModel().getAttributeText(attr, format);
18292
+ };
18293
+ EqContext.prototype.getDefaultColumnCaption = function (column) {
18294
+ var attr;
18295
+ var model = this.getModel();
18296
+ switch (column.expr.tag) {
18297
+ case ExprTag.Constant:
18298
+ return "Contant Column";
18299
+ case ExprTag.CustomSql:
18300
+ return "SQL Column";
18301
+ case ExprTag.ParentColumn:
18302
+ return "Parent Column";
18303
+ case ExprTag.Query:
18304
+ return "Query Column";
18305
+ case ExprTag.EntityAttribute:
18306
+ case ExprTag.ParentEntityAttribute:
18307
+ attr = model.getAttributeById(column.expr.value);
18308
+ return this.getColumnTitle(attr);
18309
+ case ExprTag.AggregateFunction:
18310
+ attr = model.getAttributeById(column.expr.args[0].value);
18311
+ return this.getColumnTitle(attr) + ' ' + model.getAggrFunctionCaption(column.expr.func);
18312
+ default:
18313
+ return 'Column';
18314
+ }
18315
+ };
18280
18316
  return EqContext;
18281
18317
  }());
18282
18318
 
@@ -18596,7 +18632,6 @@ var EntitiesPanel = /** @class */ (function (_super) {
18596
18632
  autoClearSelection: true,
18597
18633
  entityRenderedCallback: null,
18598
18634
  attributeRenderedCallback: null,
18599
- columnTitleFormat: '{attr}'
18600
18635
  };
18601
18636
  if (options) {
18602
18637
  public_api.utils.assignDeep(this.options, options);
@@ -18725,10 +18760,8 @@ var EntitiesPanel = /** @class */ (function (_super) {
18725
18760
  if (model.checkAttrProperty(attrId, "useInResult")) {
18726
18761
  if (checkbox.checked) {
18727
18762
  var attr = model.getAttributeById(attrId);
18728
- var caption = model.getAttributeText(attr, _this.options.columnTitleFormat);
18729
18763
  var column = query.addColumn({
18730
- attribute: attr,
18731
- caption: caption
18764
+ attribute: attr
18732
18765
  });
18733
18766
  query.fireColumnsChangedEvent(QueryChangeAction.Add, column);
18734
18767
  }
@@ -18737,7 +18770,7 @@ var EntitiesPanel = /** @class */ (function (_super) {
18737
18770
  .filter(function (col) { return col.expr.tag === ExprTag.EntityAttribute
18738
18771
  && col.expr.value === attrId; });
18739
18772
  if (columns.length > 0) {
18740
- query.removeColumn(columns[0], null);
18773
+ query.removeColumn(columns[0]);
18741
18774
  query.fireColumnsChangedEvent(QueryChangeAction.Delete, columns[0]);
18742
18775
  }
18743
18776
  }
@@ -18951,11 +18984,9 @@ var EntitiesPanel = /** @class */ (function (_super) {
18951
18984
  for (var _i = 0, attrList_3 = attrList; _i < attrList_3.length; _i++) {
18952
18985
  var attrId_1 = attrList_3[_i];
18953
18986
  var attr = model.getAttributeById(attrId_1);
18954
- var caption = model.getAttributeText(attr, _this.options.columnTitleFormat);
18955
18987
  query.addColumn({
18956
- attribute: attr,
18957
- caption: caption
18958
- });
18988
+ attribute: attr
18989
+ }, true);
18959
18990
  }
18960
18991
  query.fireChangedEvent();
18961
18992
  if (_this.options.autoClearSelection) {
@@ -20508,7 +20539,6 @@ var ColumnRendererCP = /** @class */ (function () {
20508
20539
  });
20509
20540
  ColumnRendererCP.prototype.render = function () {
20510
20541
  var _this = this;
20511
- this.baseAttr = this.getAttribute();
20512
20542
  if (this.getButtonsToShow().indexOf("sorting") >= 0 && this.columnEnabled) {
20513
20543
  this.sortingButton = this.renderSoringButton(this.column.sorting);
20514
20544
  if (this.column.sorting !== SortDirection.None) {
@@ -20631,15 +20661,8 @@ var ColumnRendererCP = /** @class */ (function () {
20631
20661
  ColumnRendererCP.prototype.refresh = function () {
20632
20662
  this.render();
20633
20663
  };
20634
- ColumnRendererCP.prototype.getAttribute = function () {
20635
- var model = this.panel.getContext().getModel();
20636
- return model.getAttributeByIdSafe(this.column.expr.value);
20637
- };
20638
20664
  ColumnRendererCP.prototype.renderCaptionBlock = function () {
20639
20665
  var _this = this;
20640
- if (!this.column.caption || this.column.caption == '') {
20641
- this.column.caption = this.getDefaultColumnCaption();
20642
- }
20643
20666
  var builder = (0,lib_public_api.domel)('div')
20644
20667
  .addClass("".concat(this.cssPrefix, "-colelement"), "".concat(this.cssPrefix, "-captionelement"))
20645
20668
  .addClass(browser_utils/* browserUtils.getMobileCssClass */.z.getMobileCssClass());
@@ -20842,17 +20865,6 @@ var ColumnRendererCP = /** @class */ (function () {
20842
20865
  } }); })
20843
20866
  .toDOM();
20844
20867
  };
20845
- ColumnRendererCP.prototype.getDefaultColumnCaption = function () {
20846
- return this.getDefaultTitleText(this.baseAttr);
20847
- };
20848
- ColumnRendererCP.prototype.getDefaultTitleText = function (attr) {
20849
- return this.getAttributeCaption(attr, this.panel.options.titleElementFormat);
20850
- };
20851
- ColumnRendererCP.prototype.getAttributeCaption = function (attr, format) {
20852
- format = format || this.panel.options.attrElementFormat;
20853
- var model = this.panel.getContext().getModel();
20854
- return model.getAttributeText(attr, format);
20855
- };
20856
20868
  ColumnRendererCP.prototype.getClassesToAdd = function () {
20857
20869
  var result = "";
20858
20870
  result += this.columnEnabled ? '' : " ".concat(this.cssPrefix, "-disabled");
@@ -21083,7 +21095,7 @@ var ColumnRendererCP = /** @class */ (function () {
21083
21095
  switch (action) {
21084
21096
  case ColumnAction.Delete:
21085
21097
  var curQuery = this.column.getQuery();
21086
- curQuery.removeColumn(this.column, this.panel);
21098
+ curQuery.removeColumn(this.column);
21087
21099
  curQuery.fireColumnsChangedEvent(QueryChangeAction.Delete, this.column);
21088
21100
  break;
21089
21101
  case ColumnAction.Enable:
@@ -21277,8 +21289,8 @@ var ColumnRendererCP = /** @class */ (function () {
21277
21289
  }());
21278
21290
 
21279
21291
  //# sourceMappingURL=column_renderer_cp.js.map
21280
- ;// CONCATENATED MODULE: ./dist/lib/widgets/renderers/columnspanel/simple_column_renderer.js
21281
- var simple_column_renderer_extends = (undefined && undefined.__extends) || (function () {
21292
+ ;// CONCATENATED MODULE: ./dist/lib/widgets/renderers/columnspanel/attr_column_renderer_cp.js
21293
+ var attr_column_renderer_cp_extends = (undefined && undefined.__extends) || (function () {
21282
21294
  var extendStatics = function (d, b) {
21283
21295
  extendStatics = Object.setPrototypeOf ||
21284
21296
  ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
@@ -21298,15 +21310,15 @@ var simple_column_renderer_extends = (undefined && undefined.__extends) || (func
21298
21310
 
21299
21311
 
21300
21312
 
21301
- var SimpleColumnRendererCP = /** @class */ (function (_super) {
21302
- simple_column_renderer_extends(SimpleColumnRendererCP, _super);
21303
- function SimpleColumnRendererCP() {
21313
+ var AttrColumnRendererCP = /** @class */ (function (_super) {
21314
+ attr_column_renderer_cp_extends(AttrColumnRendererCP, _super);
21315
+ function AttrColumnRendererCP() {
21304
21316
  return _super !== null && _super.apply(this, arguments) || this;
21305
21317
  }
21306
- SimpleColumnRendererCP.prototype.getClassesToAdd = function () {
21318
+ AttrColumnRendererCP.prototype.getClassesToAdd = function () {
21307
21319
  return "".concat(_super.prototype.getClassesToAdd.call(this), " ").concat(this.cssPrefix, "-row ").concat(this.cssPrefix, "-row-column-entattr");
21308
21320
  };
21309
- SimpleColumnRendererCP.prototype.renderExpressionBlock = function () {
21321
+ AttrColumnRendererCP.prototype.renderExpressionBlock = function () {
21310
21322
  var _this = this;
21311
21323
  return (0,lib_public_api.domel)("div")
21312
21324
  .addClass("".concat(this.cssPrefix, "-expr-block"))
@@ -21317,9 +21329,14 @@ var SimpleColumnRendererCP = /** @class */ (function (_super) {
21317
21329
  .addChildElement(_this.renderBaseExpression()); })
21318
21330
  .toDOM();
21319
21331
  };
21320
- SimpleColumnRendererCP.prototype.renderBaseExpression = function () {
21332
+ AttrColumnRendererCP.prototype.getAttribute = function () {
21333
+ var model = this.panel.getContext().getModel();
21334
+ return model.getAttributeByIdSafe(this.column.expr.value);
21335
+ };
21336
+ AttrColumnRendererCP.prototype.renderBaseExpression = function () {
21321
21337
  var _this = this;
21322
- var attrCaption = this.getAttributeCaption(this.baseAttr);
21338
+ var baseAttr = this.getAttribute();
21339
+ var attrCaption = this.panel.getContext().getAttributeTitle(baseAttr);
21323
21340
  if (this.isEditable()) {
21324
21341
  return (0,lib_public_api.domel)('a')
21325
21342
  .attr('href', 'javascript:void(0)')
@@ -21342,14 +21359,21 @@ var SimpleColumnRendererCP = /** @class */ (function (_super) {
21342
21359
  .title(attrCaption)
21343
21360
  .toDOM();
21344
21361
  };
21345
- SimpleColumnRendererCP.prototype.baseExpressionItemSelectedCallback = function (data, item) {
21362
+ AttrColumnRendererCP.prototype.baseExpressionItemSelectedCallback = function (data, item) {
21346
21363
  var attrid = data.id;
21347
- this.column.expr.setValue(attrid, true);
21348
- this.column.caption = '';
21364
+ var context = this.panel.getContext();
21365
+ var attr = context.getModel().getAttributeById(attrid);
21366
+ this.updateBaseAttr(attr);
21367
+ this.column.caption = context.getDefaultColumnCaption(this.column);
21349
21368
  this.fireColumnChanged();
21350
21369
  return false;
21351
21370
  };
21352
- SimpleColumnRendererCP.prototype.getUIS = function () {
21371
+ AttrColumnRendererCP.prototype.updateBaseAttr = function (attr) {
21372
+ this.column.expr.setValue(attr.id, true);
21373
+ this.column.expr.baseAttrId = attr.id;
21374
+ this.column.expr.dataType = attr.dataType;
21375
+ };
21376
+ AttrColumnRendererCP.prototype.getUIS = function () {
21353
21377
  var arg = this.column.expr.args[0];
21354
21378
  if (arg) {
21355
21379
  var model = this.panel.getContext().getModel();
@@ -21359,7 +21383,7 @@ var SimpleColumnRendererCP = /** @class */ (function (_super) {
21359
21383
  return true;
21360
21384
  }
21361
21385
  };
21362
- SimpleColumnRendererCP.prototype.changeTypeHandler = function (ev) {
21386
+ AttrColumnRendererCP.prototype.changeTypeHandler = function (ev) {
21363
21387
  var _this = this;
21364
21388
  this.keepShowingButtons = true;
21365
21389
  this.functionMenu.showMenu({
@@ -21377,7 +21401,7 @@ var SimpleColumnRendererCP = /** @class */ (function (_super) {
21377
21401
  }
21378
21402
  });
21379
21403
  };
21380
- SimpleColumnRendererCP.prototype.changeTypeToCustomSql = function () {
21404
+ AttrColumnRendererCP.prototype.changeTypeToCustomSql = function () {
21381
21405
  var _this = this;
21382
21406
  var query = this.column.getQuery();
21383
21407
  query.changeColumnType(this.column, ExprTag.CustomSql);
@@ -21390,12 +21414,12 @@ var SimpleColumnRendererCP = /** @class */ (function (_super) {
21390
21414
  }, 500);
21391
21415
  this.fireColumnChanged();
21392
21416
  };
21393
- SimpleColumnRendererCP.prototype.changeTypeToAggr = function (funcId) {
21417
+ AttrColumnRendererCP.prototype.changeTypeToAggr = function (funcId) {
21394
21418
  var query = this.column.getQuery();
21395
21419
  query.changeColumnType(this.column, ExprTag.AggregateFunction, { funcId: funcId });
21396
21420
  this.fireColumnChanged();
21397
21421
  };
21398
- SimpleColumnRendererCP.prototype.processExtraButtonMenuItems = function (action, evt) {
21422
+ AttrColumnRendererCP.prototype.processExtraButtonMenuItems = function (action, evt) {
21399
21423
  if (action === "CUSTOMSQL") {
21400
21424
  this.changeTypeToCustomSql();
21401
21425
  }
@@ -21404,7 +21428,7 @@ var SimpleColumnRendererCP = /** @class */ (function (_super) {
21404
21428
  }
21405
21429
  return true;
21406
21430
  };
21407
- SimpleColumnRendererCP.prototype.getExtraButtonMenuItems = function () {
21431
+ AttrColumnRendererCP.prototype.getExtraButtonMenuItems = function () {
21408
21432
  var items = [];
21409
21433
  var funcs = this.panel.getContext().getModel().getAggrFunctions();
21410
21434
  var toInclude = true;
@@ -21455,12 +21479,12 @@ var SimpleColumnRendererCP = /** @class */ (function (_super) {
21455
21479
  items: items
21456
21480
  }];
21457
21481
  };
21458
- return SimpleColumnRendererCP;
21482
+ return AttrColumnRendererCP;
21459
21483
  }(ColumnRendererCP));
21460
21484
 
21461
- //# sourceMappingURL=simple_column_renderer.js.map
21462
- ;// CONCATENATED MODULE: ./dist/lib/widgets/renderers/columnspanel/aggrfunc_column_renderer.js
21463
- var aggrfunc_column_renderer_extends = (undefined && undefined.__extends) || (function () {
21485
+ //# sourceMappingURL=attr_column_renderer_cp.js.map
21486
+ ;// CONCATENATED MODULE: ./dist/lib/widgets/renderers/columnspanel/aggrfunc_column_renderer_cp.js
21487
+ var aggrfunc_column_renderer_cp_extends = (undefined && undefined.__extends) || (function () {
21464
21488
  var extendStatics = function (d, b) {
21465
21489
  extendStatics = Object.setPrototypeOf ||
21466
21490
  ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
@@ -21483,7 +21507,7 @@ var aggrfunc_column_renderer_extends = (undefined && undefined.__extends) || (fu
21483
21507
 
21484
21508
 
21485
21509
  var AggrFuncColumnRendererCP = /** @class */ (function (_super) {
21486
- aggrfunc_column_renderer_extends(AggrFuncColumnRendererCP, _super);
21510
+ aggrfunc_column_renderer_cp_extends(AggrFuncColumnRendererCP, _super);
21487
21511
  function AggrFuncColumnRendererCP() {
21488
21512
  var _this = _super !== null && _super.apply(this, arguments) || this;
21489
21513
  _this.displayFormatParser = new DisplayFormatParser();
@@ -21498,10 +21522,6 @@ var AggrFuncColumnRendererCP = /** @class */ (function (_super) {
21498
21522
  .getModel()
21499
21523
  .getAttributeByIdSafe(this.column.expr.args[0].value);
21500
21524
  };
21501
- AggrFuncColumnRendererCP.prototype.getDefaultColumnCaption = function () {
21502
- return this.getDefaultTitleText(this.baseAttr) + ' '
21503
- + this.panel.getContext().getModel().getAggrFunctionCaption(this.column.expr.func);
21504
- };
21505
21525
  AggrFuncColumnRendererCP.prototype.renderExpressionBlock = function () {
21506
21526
  var _this = this;
21507
21527
  var model = this.panel.getContext().getModel();
@@ -21586,14 +21606,6 @@ var AggrFuncColumnRendererCP = /** @class */ (function (_super) {
21586
21606
  }
21587
21607
  return button;
21588
21608
  };
21589
- AggrFuncColumnRendererCP.prototype.baseExpressionItemSelectedCallback = function (data, item) {
21590
- var attrid = data.id;
21591
- //this.column.expr.args[0].id = attrid;
21592
- this.column.expr.args[0].setValue(attrid, true);
21593
- this.column.caption = '';
21594
- this.fireColumnChanged();
21595
- return false;
21596
- };
21597
21609
  AggrFuncColumnRendererCP.prototype.changeTypeToSimple = function () {
21598
21610
  var query = this.column.getQuery();
21599
21611
  query.changeColumnType(this.column, ExprTag.EntityAttribute);
@@ -21620,6 +21632,10 @@ var AggrFuncColumnRendererCP = /** @class */ (function (_super) {
21620
21632
  }
21621
21633
  return result;
21622
21634
  };
21635
+ AggrFuncColumnRendererCP.prototype.updateBaseAttr = function (attr) {
21636
+ this.column.expr.args[0].setValue(attr.id, true);
21637
+ this.column.expr.baseAttrId = attr.id;
21638
+ };
21623
21639
  AggrFuncColumnRendererCP.prototype.changeTypeHandler = function (ev) {
21624
21640
  this.changeTypeToSimple();
21625
21641
  };
@@ -21638,11 +21654,11 @@ var AggrFuncColumnRendererCP = /** @class */ (function (_super) {
21638
21654
  }];
21639
21655
  };
21640
21656
  return AggrFuncColumnRendererCP;
21641
- }(SimpleColumnRendererCP));
21657
+ }(AttrColumnRendererCP));
21642
21658
 
21643
- //# sourceMappingURL=aggrfunc_column_renderer.js.map
21644
- ;// CONCATENATED MODULE: ./dist/lib/widgets/renderers/columnspanel/customsql_column_renderer.js
21645
- var customsql_column_renderer_extends = (undefined && undefined.__extends) || (function () {
21659
+ //# sourceMappingURL=aggrfunc_column_renderer_cp.js.map
21660
+ ;// CONCATENATED MODULE: ./dist/lib/widgets/renderers/columnspanel/editable_column_renderer_cp.js
21661
+ var editable_column_renderer_cp_extends = (undefined && undefined.__extends) || (function () {
21646
21662
  var extendStatics = function (d, b) {
21647
21663
  extendStatics = Object.setPrototypeOf ||
21648
21664
  ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
@@ -21663,51 +21679,25 @@ var customsql_column_renderer_extends = (undefined && undefined.__extends) || (f
21663
21679
 
21664
21680
 
21665
21681
 
21666
- var CustomSqlColumnRendererCP = /** @class */ (function (_super) {
21667
- customsql_column_renderer_extends(CustomSqlColumnRendererCP, _super);
21668
- function CustomSqlColumnRendererCP() {
21682
+ var EditableColumnRendererCP = /** @class */ (function (_super) {
21683
+ editable_column_renderer_cp_extends(EditableColumnRendererCP, _super);
21684
+ function EditableColumnRendererCP() {
21669
21685
  var _this = _super !== null && _super.apply(this, arguments) || this;
21670
21686
  _this.dataTypeMenu = null;
21671
21687
  return _this;
21672
21688
  }
21673
- CustomSqlColumnRendererCP.prototype.renderEnabledButton = function () {
21689
+ EditableColumnRendererCP.prototype.renderEnabledButton = function () {
21674
21690
  var elem = _super.prototype.renderEnabledButton.call(this);
21675
21691
  var child = elem.children[0];
21676
21692
  child.title = public_api.i18n.getText('CmdToggleEnableCustom');
21677
21693
  return elem;
21678
21694
  };
21679
21695
  ;
21680
- CustomSqlColumnRendererCP.prototype.getClassesToAdd = function () {
21696
+ EditableColumnRendererCP.prototype.getClassesToAdd = function () {
21681
21697
  return "".concat(this.cssPrefix, "-row ").concat(this.cssPrefix, "-row-column-entattr") + _super.prototype.getClassesToAdd.call(this);
21682
21698
  };
21683
- Object.defineProperty(CustomSqlColumnRendererCP.prototype, "columnEnabled", {
21684
- get: function () {
21685
- return this.panel.areCustomExpressionsAllowed() ? this.column.enabled : false;
21686
- },
21687
- set: function (value) {
21688
- if (this.panel.areCustomExpressionsAllowed()) {
21689
- this.column.enabled = value;
21690
- }
21691
- else {
21692
- this.column.enabled = false;
21693
- }
21694
- },
21695
- enumerable: false,
21696
- configurable: true
21697
- });
21698
- CustomSqlColumnRendererCP.prototype.renderColumnTypeButton = function () {
21699
- var button = _super.prototype.renderColumnTypeButton.call(this);
21700
- if (button) {
21701
- button.firstElementChild.classList.add('aggregated');
21702
- button.firstElementChild.setAttribute('title', public_api.i18n.getText('ButtonToSimple'));
21703
- }
21704
- return button;
21705
- };
21706
- CustomSqlColumnRendererCP.prototype.renderExpressionBlock = function () {
21699
+ EditableColumnRendererCP.prototype.renderExpressionBlock = function () {
21707
21700
  var _this = this;
21708
- if (!this.column.caption || this.column.caption == '') {
21709
- this.column.caption = this.getDefaultColumnCaption();
21710
- }
21711
21701
  var exprBlock = (0,lib_public_api.domel)("div")
21712
21702
  .addClass("".concat(this.cssPrefix, "-expr-block"))
21713
21703
  .addClass(browser_utils/* browserUtils.getMobileCssClass */.z.getMobileCssClass())
@@ -21737,7 +21727,7 @@ var CustomSqlColumnRendererCP = /** @class */ (function (_super) {
21737
21727
  )
21738
21728
  .addChild('input', function (b) { return b
21739
21729
  .hide()
21740
- .value(_this.column.expr.sql)
21730
+ .value(_this.getColumnValue())
21741
21731
  .on('blur keydown', function (ev) {
21742
21732
  var isEndEvent = false;
21743
21733
  var save = true;
@@ -21762,12 +21752,13 @@ var CustomSqlColumnRendererCP = /** @class */ (function (_super) {
21762
21752
  aEl.style.removeProperty('display');
21763
21753
  inputEl.style.display = 'none';
21764
21754
  }
21765
- if (save && _this.column.expr.sql !== inputEl.value) {
21766
- _this.column.expr.sql = inputEl.value;
21755
+ var colVal = _this.getColumnValue();
21756
+ if (save && colVal !== inputEl.value) {
21757
+ _this.setColumnValue(inputEl.value);
21767
21758
  _this.fireColumnChanged();
21768
21759
  }
21769
21760
  else {
21770
- inputEl.value = _this.column.expr.sql;
21761
+ inputEl.value = colVal;
21771
21762
  }
21772
21763
  _this.element.removeAttribute(lib_public_api.eqDragManager.DRAG_DISABLED_ATTR);
21773
21764
  }
@@ -21820,31 +21811,30 @@ var CustomSqlColumnRendererCP = /** @class */ (function (_super) {
21820
21811
  }
21821
21812
  return exprBlock;
21822
21813
  };
21823
- CustomSqlColumnRendererCP.prototype.changeTypeToSimple = function () {
21814
+ EditableColumnRendererCP.prototype.changeTypeToSimple = function () {
21824
21815
  var query = this.column.getQuery();
21825
21816
  query.changeColumnType(this.column, ExprTag.EntityAttribute);
21826
21817
  this.fireColumnChanged();
21827
21818
  };
21828
- CustomSqlColumnRendererCP.prototype.getDefaultColumnCaption = function () {
21829
- return "Custom SQL Column";
21819
+ EditableColumnRendererCP.prototype.getColumnValue = function () {
21820
+ return '';
21830
21821
  };
21831
- CustomSqlColumnRendererCP.prototype.getDefaultValue = function () {
21832
- return this.column.expr.sql;
21822
+ EditableColumnRendererCP.prototype.setColumnValue = function (value) {
21833
21823
  };
21834
- CustomSqlColumnRendererCP.prototype.getUIS = function () {
21824
+ EditableColumnRendererCP.prototype.getUIS = function () {
21835
21825
  return true;
21836
21826
  };
21837
- CustomSqlColumnRendererCP.prototype.changeTypeHandler = function (ev) {
21827
+ EditableColumnRendererCP.prototype.changeTypeHandler = function (ev) {
21838
21828
  this.changeTypeToSimple();
21839
21829
  };
21840
- CustomSqlColumnRendererCP.prototype.processExtraButtonMenuItems = function (action, evt) {
21830
+ EditableColumnRendererCP.prototype.processExtraButtonMenuItems = function (action, evt) {
21841
21831
  this.changeTypeToSimple();
21842
21832
  return true;
21843
21833
  };
21844
- CustomSqlColumnRendererCP.prototype.createFunctionMenu = function () {
21834
+ EditableColumnRendererCP.prototype.createFunctionMenu = function () {
21845
21835
  // Nothing TO DO
21846
21836
  };
21847
- CustomSqlColumnRendererCP.prototype.getExtraButtonMenuItems = function () {
21837
+ EditableColumnRendererCP.prototype.getExtraButtonMenuItems = function () {
21848
21838
  return [{
21849
21839
  id: '__group',
21850
21840
  text: public_api.i18n.getText('ColTypeGroup'),
@@ -21854,7 +21844,7 @@ var CustomSqlColumnRendererCP = /** @class */ (function (_super) {
21854
21844
  }]
21855
21845
  }];
21856
21846
  };
21857
- CustomSqlColumnRendererCP.prototype.createDataTypeMenu = function () {
21847
+ EditableColumnRendererCP.prototype.createDataTypeMenu = function () {
21858
21848
  var items = [];
21859
21849
  for (var typeItem in public_api.DataType) {
21860
21850
  if (!isNaN(Number(typeItem))) {
@@ -21877,10 +21867,74 @@ var CustomSqlColumnRendererCP = /** @class */ (function (_super) {
21877
21867
  };
21878
21868
  this.dataTypeMenu = new PopupMenu(menuOptions);
21879
21869
  };
21870
+ return EditableColumnRendererCP;
21871
+ }(AttrColumnRendererCP));
21872
+ var CustomSqlColumnRendererCP = /** @class */ (function (_super) {
21873
+ editable_column_renderer_cp_extends(CustomSqlColumnRendererCP, _super);
21874
+ function CustomSqlColumnRendererCP() {
21875
+ return _super !== null && _super.apply(this, arguments) || this;
21876
+ }
21877
+ Object.defineProperty(CustomSqlColumnRendererCP.prototype, "columnEnabled", {
21878
+ get: function () {
21879
+ return this.panel.areCustomExpressionsAllowed() ? this.column.enabled : false;
21880
+ },
21881
+ set: function (value) {
21882
+ if (this.panel.areCustomExpressionsAllowed()) {
21883
+ this.column.enabled = value;
21884
+ }
21885
+ else {
21886
+ this.column.enabled = false;
21887
+ }
21888
+ },
21889
+ enumerable: false,
21890
+ configurable: true
21891
+ });
21892
+ CustomSqlColumnRendererCP.prototype.renderColumnTypeButton = function () {
21893
+ var button = _super.prototype.renderColumnTypeButton.call(this);
21894
+ if (button) {
21895
+ button.firstElementChild.classList.add('aggregated');
21896
+ button.firstElementChild.setAttribute('title', public_api.i18n.getText('ButtonToSimple'));
21897
+ }
21898
+ return button;
21899
+ };
21900
+ CustomSqlColumnRendererCP.prototype.getColumnValue = function () {
21901
+ return this.column.expr.sql;
21902
+ };
21903
+ CustomSqlColumnRendererCP.prototype.setColumnValue = function (value) {
21904
+ this.column.expr.sql = value;
21905
+ };
21906
+ CustomSqlColumnRendererCP.prototype.getDefaultValue = function () {
21907
+ return this.column.expr.sql;
21908
+ };
21880
21909
  return CustomSqlColumnRendererCP;
21881
- }(SimpleColumnRendererCP));
21910
+ }(EditableColumnRendererCP));
21911
+
21912
+ var ConstColumnRendererCP = /** @class */ (function (_super) {
21913
+ editable_column_renderer_cp_extends(ConstColumnRendererCP, _super);
21914
+ function ConstColumnRendererCP() {
21915
+ return _super !== null && _super.apply(this, arguments) || this;
21916
+ }
21917
+ ConstColumnRendererCP.prototype.renderColumnTypeButton = function () {
21918
+ var button = _super.prototype.renderColumnTypeButton.call(this);
21919
+ if (button) {
21920
+ button.firstElementChild.classList.add('aggregated');
21921
+ button.firstElementChild.setAttribute('title', public_api.i18n.getText('ButtonToSimple'));
21922
+ }
21923
+ return button;
21924
+ };
21925
+ ConstColumnRendererCP.prototype.getColumnValue = function () {
21926
+ return this.column.expr.value;
21927
+ };
21928
+ ConstColumnRendererCP.prototype.setColumnValue = function (value) {
21929
+ this.column.expr.setValue(value);
21930
+ };
21931
+ ConstColumnRendererCP.prototype.getDefaultValue = function () {
21932
+ return this.column.expr.value;
21933
+ };
21934
+ return ConstColumnRendererCP;
21935
+ }(EditableColumnRendererCP));
21882
21936
 
21883
- //# sourceMappingURL=customsql_column_renderer.js.map
21937
+ //# sourceMappingURL=editable_column_renderer_cp.js.map
21884
21938
  ;// CONCATENATED MODULE: ./dist/lib/widgets/columns_panel.js
21885
21939
  var columns_panel_extends = (undefined && undefined.__extends) || (function () {
21886
21940
  var extendStatics = function (d, b) {
@@ -22127,7 +22181,15 @@ var ColumnsPanel = /** @class */ (function (_super) {
22127
22181
  var index = query.getColumns().indexOf(column);
22128
22182
  var newEl = _this.addColumnElement(column, index);
22129
22183
  if (isFocusInside) {
22130
- newEl.querySelector("a").focus();
22184
+ var focusElem = newEl.querySelector('a');
22185
+ if (focusElem) {
22186
+ try {
22187
+ focusElem.focus();
22188
+ }
22189
+ catch (_a) {
22190
+ //do nothing
22191
+ }
22192
+ }
22131
22193
  }
22132
22194
  };
22133
22195
  if (Array.isArray(columns)) {
@@ -22227,7 +22289,13 @@ var ColumnsPanel = /** @class */ (function (_super) {
22227
22289
  };
22228
22290
  ColumnsPanel.prototype.setOptions = function (options) {
22229
22291
  public_api.utils.assignDeep(this.options, options);
22230
- this.getContext().options.allowCustomExpressions = options.allowCustomExpressions;
22292
+ this.context.options.allowCustomExpressions = options.allowCustomExpressions;
22293
+ if (options.attrElementFormat) {
22294
+ this.context.options.attributeFormat = options.attrElementFormat;
22295
+ }
22296
+ if (options.titleElementFormat) {
22297
+ this.context.options.columnTitleFormat = options.titleElementFormat;
22298
+ }
22231
22299
  if (browser_utils/* browserUtils.isMobileMode */.z.isMobileMode()) {
22232
22300
  this.options.buttons = ["menu"];
22233
22301
  this.options.showHeader = false;
@@ -22316,66 +22384,36 @@ var ColumnsPanel = /** @class */ (function (_super) {
22316
22384
  .data("show-buttons", "");
22317
22385
  }
22318
22386
  };
22319
- ColumnsPanel.prototype.addNewColumn = function (attrId, index) {
22320
- var _this = this;
22387
+ ColumnsPanel.prototype.addNewColumn = function (attrs, index) {
22321
22388
  var model = this.getContext().getModel();
22322
22389
  var query = this.getQuery();
22323
- var getColumnByAttrId = function (attrid) {
22324
- var attribute = model.getAttributeById(attrid);
22325
- if (!attribute) {
22326
- return null;
22327
- }
22328
- if (!attribute.useInResult) {
22329
- if (attribute.lookupAttr) {
22330
- attrid = attribute.lookupAttr;
22331
- attribute = model.getAttributeById(attrid);
22332
- if (!attribute || !attribute.useInResult) {
22333
- return null;
22334
- }
22335
- }
22336
- else
22337
- return null;
22338
- }
22339
- var column = query.createColumn();
22340
- column.caption = _this.getDefaultColumnCaption(attribute);
22341
- column.sorting = SortDirection.None;
22342
- column.sortIndex = -1;
22343
- column.expr.tag = ExprTag.EntityAttribute;
22344
- column.expr.kind = DataKind.Attribute;
22345
- column.expr.dataType = attribute.dataType;
22346
- column.expr.setValue(attrid, true);
22347
- column.params.concat(attribute.params);
22348
- return column;
22349
- };
22350
- var colToAdd, col;
22351
- if (Array.isArray(attrId)) {
22352
- colToAdd = [];
22353
- for (var i = 0; i < attrId.length; i++) {
22354
- col = getColumnByAttrId(attrId[i]);
22390
+ if (Array.isArray(attrs)) {
22391
+ var col = null;
22392
+ var cols = [];
22393
+ for (var i = 0; i < attrs.length; i++) {
22394
+ col = query.addColumn({
22395
+ attributeId: attrs[i],
22396
+ index: index
22397
+ }, true);
22355
22398
  if (col) {
22356
- colToAdd.push(col);
22399
+ cols.push(col);
22357
22400
  }
22358
22401
  }
22402
+ query.fireChangedEvent({
22403
+ part: QueryChangePart.Columns,
22404
+ action: QueryChangeAction.Add,
22405
+ changee: cols,
22406
+ source: this
22407
+ });
22408
+ return cols;
22359
22409
  }
22360
- else
22361
- colToAdd = getColumnByAttrId(attrId);
22362
- this.addColumn(colToAdd, index);
22363
- return colToAdd;
22364
- };
22365
- ColumnsPanel.prototype.addColumn = function (column, index) {
22366
- var query = this.getQuery();
22367
- if (!query) {
22368
- return;
22369
- }
22370
- if (Array.isArray(column))
22371
- column = this.checkColumnsArray(column);
22372
- else
22373
- column = this.checkColumn(column);
22374
- if (!column || (Array.isArray(column) && column.length == 0)) {
22375
- return;
22410
+ else {
22411
+ var col = query.addColumn({
22412
+ attributeId: attrs,
22413
+ index: index
22414
+ });
22415
+ return col;
22376
22416
  }
22377
- query.addColumnObj(column, index, self);
22378
- query.fireColumnsChangedEvent(QueryChangeAction.Add, column);
22379
22417
  };
22380
22418
  //adds one column to the panel on the specified position
22381
22419
  ColumnsPanel.prototype.addColumnElement = function (column, index) {
@@ -22425,23 +22463,19 @@ var ColumnsPanel = /** @class */ (function (_super) {
22425
22463
  }
22426
22464
  return col;
22427
22465
  };
22428
- ColumnsPanel.prototype.getDefaultColumnCaption = function (attr) {
22429
- var format = this.options.titleElementFormat || this.options.attrElementFormat;
22430
- var model = this.getContext().getModel();
22431
- return model.getAttributeText(attr, format);
22432
- };
22433
22466
  ColumnsPanel.prototype.getColumnsBlock = function () {
22434
22467
  return this.columnsBlock;
22435
22468
  };
22436
22469
  ColumnsPanel.prototype.getColumnRenderer = function (column, slot) {
22437
22470
  switch (column.expr.tag) {
22471
+ case ExprTag.Constant:
22472
+ return new ConstColumnRendererCP(this, column, slot);
22438
22473
  case ExprTag.AggregateFunction:
22439
22474
  return new AggrFuncColumnRendererCP(this, column, slot);
22440
22475
  case ExprTag.CustomSql:
22441
22476
  return new CustomSqlColumnRendererCP(this, column, slot);
22442
- case ExprTag.EntityAttribute:
22443
- case ExprTag.ParentEntityAttribute:
22444
- return new SimpleColumnRendererCP(this, column, slot);
22477
+ default:
22478
+ return new AttrColumnRendererCP(this, column, slot);
22445
22479
  }
22446
22480
  return null;
22447
22481
  };
@@ -22650,7 +22684,6 @@ var ColumnRendererCB = /** @class */ (function () {
22650
22684
  });
22651
22685
  ColumnRendererCB.prototype.render = function () {
22652
22686
  var _this = this;
22653
- this.baseAttr = this.getAttribute();
22654
22687
  var builder = (0,lib_public_api.domel)('div');
22655
22688
  builder.data('id', this.column.id);
22656
22689
  if (this.element) {
@@ -22707,10 +22740,6 @@ var ColumnRendererCB = /** @class */ (function () {
22707
22740
  ColumnRendererCB.prototype.refresh = function () {
22708
22741
  this.render();
22709
22742
  };
22710
- ColumnRendererCB.prototype.getAttribute = function () {
22711
- var model = this.bar.getContext().getModel();
22712
- return model.getAttributeByIdSafe(this.column.expr.value);
22713
- };
22714
22743
  ColumnRendererCB.prototype.isEditable = function () {
22715
22744
  return this.column.enabled && !this.column.isReadOnly();
22716
22745
  };
@@ -22725,19 +22754,13 @@ var ColumnRendererCB = /** @class */ (function () {
22725
22754
  };
22726
22755
  ColumnRendererCB.prototype.renderCaptionBlock = function () {
22727
22756
  var _this = this;
22728
- if (!this.column.caption || this.column.caption == '') {
22729
- this.column.caption = this.getDefaultCaption();
22730
- }
22731
- var model = this.column.getModel();
22732
- var caption = this.baseAttr !== model.nullAttribute
22733
- ? this.column.caption
22734
- : model.getAttributeText(model.nullAttribute, '{attr}');
22757
+ var caption = this.column.caption;
22735
22758
  if (!this.isEditable()) {
22736
22759
  return (0,lib_public_api.domel)('div')
22737
22760
  .addClass("".concat(this.cssPrefix, "-colelement"), "".concat(this.cssPrefix, "-captionelement"))
22738
22761
  .addClass(browser_utils/* browserUtils.getMobileCssClass */.z.getMobileCssClass())
22739
22762
  .addChild('div', function (b) { return b
22740
- .title(_this.column.caption)
22763
+ .title(caption)
22741
22764
  .text(caption)
22742
22765
  .attr('tabIndex', '0'); })
22743
22766
  .toDOM();
@@ -22910,7 +22933,7 @@ var ColumnRendererCB = /** @class */ (function () {
22910
22933
  ColumnRendererCB.prototype.buttonDeleteClickHandler = function (ev) {
22911
22934
  ev.stopPropagation();
22912
22935
  var query = this.bar.getQuery();
22913
- query.removeColumn(this.column, this.bar);
22936
+ query.removeColumn(this.column);
22914
22937
  query.fireColumnsChangedEvent(QueryChangeAction.Delete, this.column);
22915
22938
  return false;
22916
22939
  };
@@ -22929,14 +22952,6 @@ var ColumnRendererCB = /** @class */ (function () {
22929
22952
  } })
22930
22953
  .toDOM();
22931
22954
  };
22932
- ColumnRendererCB.prototype.getDefaultCaption = function () {
22933
- return this.getDefaultTitleText(this.baseAttr);
22934
- };
22935
- ColumnRendererCB.prototype.getDefaultTitleText = function (attr) {
22936
- var format = this.bar.options.titleElementFormat || this.bar.options.attrElementFormat;
22937
- var model = this.bar.getContext().getModel();
22938
- return model.getAttributeText(attr, format);
22939
- };
22940
22955
  ColumnRendererCB.prototype.getClassesToAdd = function () {
22941
22956
  var result = "";
22942
22957
  result += this.column.enabled ? '' : " ".concat(this.cssPrefix, "-disabled");
@@ -23175,8 +23190,8 @@ var ColumnRendererCB = /** @class */ (function () {
23175
23190
  }());
23176
23191
 
23177
23192
  //# sourceMappingURL=column_renderer_cb.js.map
23178
- ;// CONCATENATED MODULE: ./dist/lib/widgets/renderers/columnsbar/simple_column_renderer.js
23179
- var columnsbar_simple_column_renderer_extends = (undefined && undefined.__extends) || (function () {
23193
+ ;// CONCATENATED MODULE: ./dist/lib/widgets/renderers/columnsbar/attr_column_renderer_cb.js
23194
+ var attr_column_renderer_cb_extends = (undefined && undefined.__extends) || (function () {
23180
23195
  var extendStatics = function (d, b) {
23181
23196
  extendStatics = Object.setPrototypeOf ||
23182
23197
  ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
@@ -23194,23 +23209,29 @@ var columnsbar_simple_column_renderer_extends = (undefined && undefined.__extend
23194
23209
 
23195
23210
 
23196
23211
 
23197
- var SimpleColumnRendererCB = /** @class */ (function (_super) {
23198
- columnsbar_simple_column_renderer_extends(SimpleColumnRendererCB, _super);
23199
- function SimpleColumnRendererCB() {
23212
+ var AttrColumnRendererCB = /** @class */ (function (_super) {
23213
+ attr_column_renderer_cb_extends(AttrColumnRendererCB, _super);
23214
+ function AttrColumnRendererCB() {
23200
23215
  return _super !== null && _super.apply(this, arguments) || this;
23201
23216
  }
23202
- SimpleColumnRendererCB.prototype.getClassesToAdd = function () {
23217
+ AttrColumnRendererCB.prototype.getClassesToAdd = function () {
23203
23218
  return "".concat(_super.prototype.getClassesToAdd.call(this), " ").concat(this.cssPrefix, "-row ").concat(this.cssPrefix, "-row-column-entattr");
23204
23219
  };
23205
- SimpleColumnRendererCB.prototype.baseExpressionItemSelectedCallback = function (data, item) {
23220
+ AttrColumnRendererCB.prototype.baseExpressionItemSelectedCallback = function (data, item) {
23206
23221
  var attrid = data.id;
23207
- //this.column.expr.id = attrid;
23208
- this.column.expr.setValue(attrid, true);
23209
- this.column.caption = '';
23210
- this.refresh();
23222
+ var context = this.bar.getContext();
23223
+ var attr = context.getModel().getAttributeById(attrid);
23224
+ this.updateBaseAttr(attr);
23225
+ this.column.caption = context.getDefaultColumnCaption(this.column);
23211
23226
  this.fireColumnChanged();
23227
+ return false;
23228
+ };
23229
+ AttrColumnRendererCB.prototype.updateBaseAttr = function (attr) {
23230
+ this.column.expr.setValue(attr.id, true);
23231
+ this.column.expr.baseAttrId = attr.id;
23232
+ this.column.expr.dataType = attr.dataType;
23212
23233
  };
23213
- SimpleColumnRendererCB.prototype.getUIS = function () {
23234
+ AttrColumnRendererCB.prototype.getUIS = function () {
23214
23235
  var arg = this.column.expr.args[0];
23215
23236
  if (arg) {
23216
23237
  var model = this.bar.getContext().getModel();
@@ -23220,17 +23241,17 @@ var SimpleColumnRendererCB = /** @class */ (function (_super) {
23220
23241
  return true;
23221
23242
  }
23222
23243
  };
23223
- SimpleColumnRendererCB.prototype.changeTypeToCustomSql = function () {
23244
+ AttrColumnRendererCB.prototype.changeTypeToCustomSql = function () {
23224
23245
  var query = this.column.getQuery();
23225
23246
  query.changeColumnType(this.column, ExprTag.CustomSql);
23226
23247
  this.fireColumnChanged();
23227
23248
  };
23228
- SimpleColumnRendererCB.prototype.changeTypeToAggr = function (funcId) {
23249
+ AttrColumnRendererCB.prototype.changeTypeToAggr = function (funcId) {
23229
23250
  var query = this.column.getQuery();
23230
23251
  query.changeColumnType(this.column, ExprTag.AggregateFunction, { funcId: funcId });
23231
23252
  this.fireColumnChanged();
23232
23253
  };
23233
- SimpleColumnRendererCB.prototype.changeColumnTypeHandler = function (ev) {
23254
+ AttrColumnRendererCB.prototype.changeColumnTypeHandler = function (ev) {
23234
23255
  var _this = this;
23235
23256
  this.functionMenu.showMenu({
23236
23257
  anchor: ev.target,
@@ -23252,12 +23273,12 @@ var SimpleColumnRendererCB = /** @class */ (function (_super) {
23252
23273
  }
23253
23274
  });
23254
23275
  };
23255
- return SimpleColumnRendererCB;
23276
+ return AttrColumnRendererCB;
23256
23277
  }(ColumnRendererCB));
23257
23278
 
23258
- //# sourceMappingURL=simple_column_renderer.js.map
23259
- ;// CONCATENATED MODULE: ./dist/lib/widgets/renderers/columnsbar/aggrfunc_column_renderer.js
23260
- var columnsbar_aggrfunc_column_renderer_extends = (undefined && undefined.__extends) || (function () {
23279
+ //# sourceMappingURL=attr_column_renderer_cb.js.map
23280
+ ;// CONCATENATED MODULE: ./dist/lib/widgets/renderers/columnsbar/aggrfunc_column_renderer_cb.js
23281
+ var aggrfunc_column_renderer_cb_extends = (undefined && undefined.__extends) || (function () {
23261
23282
  var extendStatics = function (d, b) {
23262
23283
  extendStatics = Object.setPrototypeOf ||
23263
23284
  ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
@@ -23276,23 +23297,13 @@ var columnsbar_aggrfunc_column_renderer_extends = (undefined && undefined.__exte
23276
23297
 
23277
23298
 
23278
23299
  var AggrFuncColumnRendererCB = /** @class */ (function (_super) {
23279
- columnsbar_aggrfunc_column_renderer_extends(AggrFuncColumnRendererCB, _super);
23300
+ aggrfunc_column_renderer_cb_extends(AggrFuncColumnRendererCB, _super);
23280
23301
  function AggrFuncColumnRendererCB() {
23281
23302
  return _super !== null && _super.apply(this, arguments) || this;
23282
23303
  }
23283
23304
  AggrFuncColumnRendererCB.prototype.getClassesToAdd = function () {
23284
23305
  return "".concat(_super.prototype.getClassesToAdd.call(this), " ").concat(this.cssPrefix, "-row ").concat(this.cssPrefix, "-row-column-aggr");
23285
23306
  };
23286
- AggrFuncColumnRendererCB.prototype.getAttribute = function () {
23287
- return this.bar
23288
- .getContext()
23289
- .getModel()
23290
- .getAttributeByIdSafe(this.column.expr.args[0].value);
23291
- };
23292
- AggrFuncColumnRendererCB.prototype.getDefaultCaption = function () {
23293
- return this.getDefaultTitleText(this.baseAttr) + ' '
23294
- + this.bar.getContext().getModel().getAggrFunctionCaption(this.column.expr.func);
23295
- };
23296
23307
  AggrFuncColumnRendererCB.prototype.renderColumnTypeButton = function () {
23297
23308
  var button = _super.prototype.renderColumnTypeButton.call(this);
23298
23309
  if (button) {
@@ -23301,12 +23312,9 @@ var AggrFuncColumnRendererCB = /** @class */ (function (_super) {
23301
23312
  }
23302
23313
  return button;
23303
23314
  };
23304
- AggrFuncColumnRendererCB.prototype.baseExpressionItemSelectedCallback = function (data, item) {
23305
- var attrid = data.id;
23306
- //this.column.expr.args[0].id = attrid;
23307
- this.column.expr.args[0].setValue(attrid, true);
23308
- this.column.caption = '';
23309
- this.fireColumnChanged();
23315
+ AggrFuncColumnRendererCB.prototype.updateBaseAttr = function (attr) {
23316
+ this.column.expr.args[0].setValue(attr.id, true);
23317
+ this.column.expr.baseAttrId = attr.id;
23310
23318
  };
23311
23319
  AggrFuncColumnRendererCB.prototype.changeTypeToSimple = function () {
23312
23320
  var query = this.column.getQuery();
@@ -23317,9 +23325,112 @@ var AggrFuncColumnRendererCB = /** @class */ (function (_super) {
23317
23325
  this.changeTypeToSimple();
23318
23326
  };
23319
23327
  return AggrFuncColumnRendererCB;
23320
- }(SimpleColumnRendererCB));
23328
+ }(AttrColumnRendererCB));
23329
+
23330
+ //# sourceMappingURL=aggrfunc_column_renderer_cb.js.map
23331
+ ;// CONCATENATED MODULE: ./dist/lib/widgets/renderers/columnsbar/editable_column_renderer_cb.js
23332
+ var editable_column_renderer_cb_extends = (undefined && undefined.__extends) || (function () {
23333
+ var extendStatics = function (d, b) {
23334
+ extendStatics = Object.setPrototypeOf ||
23335
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
23336
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
23337
+ return extendStatics(d, b);
23338
+ };
23339
+ return function (d, b) {
23340
+ if (typeof b !== "function" && b !== null)
23341
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
23342
+ extendStatics(d, b);
23343
+ function __() { this.constructor = d; }
23344
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
23345
+ };
23346
+ })();
23347
+
23348
+
23349
+ var EditableColumnRendererCB = /** @class */ (function (_super) {
23350
+ editable_column_renderer_cb_extends(EditableColumnRendererCB, _super);
23351
+ function EditableColumnRendererCB() {
23352
+ return _super !== null && _super.apply(this, arguments) || this;
23353
+ }
23354
+ EditableColumnRendererCB.prototype.getClassesToAdd = function () {
23355
+ return "".concat(this.cssPrefix, "-row ").concat(this.cssPrefix, "-row-column-entattr") + _super.prototype.getClassesToAdd.call(this);
23356
+ };
23357
+ EditableColumnRendererCB.prototype.renderColumnTypeButton = function () {
23358
+ var button = _super.prototype.renderColumnTypeButton.call(this);
23359
+ if (button) {
23360
+ button.classList.add('aggregated');
23361
+ button.title = public_api.i18n.getText('ButtonToSimple');
23362
+ }
23363
+ return button;
23364
+ };
23365
+ EditableColumnRendererCB.prototype.changeTypeToSimple = function () {
23366
+ var query = this.column.getQuery();
23367
+ query.changeColumnType(this.column, ExprTag.EntityAttribute);
23368
+ this.fireColumnChanged();
23369
+ };
23370
+ EditableColumnRendererCB.prototype.getColumnValue = function () {
23371
+ return '';
23372
+ };
23373
+ EditableColumnRendererCB.prototype.setColumnValue = function (value) {
23374
+ };
23375
+ EditableColumnRendererCB.prototype.getUIS = function () {
23376
+ return true;
23377
+ };
23378
+ EditableColumnRendererCB.prototype.changeColumnTypeHandler = function (ev) {
23379
+ this.changeTypeToSimple();
23380
+ };
23381
+ return EditableColumnRendererCB;
23382
+ }(ColumnRendererCB));
23383
+
23384
+ var CustomSqlColumnRendererCB = /** @class */ (function (_super) {
23385
+ editable_column_renderer_cb_extends(CustomSqlColumnRendererCB, _super);
23386
+ function CustomSqlColumnRendererCB() {
23387
+ return _super !== null && _super.apply(this, arguments) || this;
23388
+ }
23389
+ Object.defineProperty(CustomSqlColumnRendererCB.prototype, "columnEnabled", {
23390
+ get: function () {
23391
+ return this.bar.areCustomExpressionsAllowed() ? this.column.enabled : false;
23392
+ },
23393
+ set: function (value) {
23394
+ if (this.bar.areCustomExpressionsAllowed()) {
23395
+ this.column.enabled = value;
23396
+ }
23397
+ else {
23398
+ this.column.enabled = false;
23399
+ }
23400
+ },
23401
+ enumerable: false,
23402
+ configurable: true
23403
+ });
23404
+ CustomSqlColumnRendererCB.prototype.getColumnValue = function () {
23405
+ return this.column.expr.sql;
23406
+ };
23407
+ CustomSqlColumnRendererCB.prototype.setColumnValue = function (value) {
23408
+ this.column.expr.sql = value;
23409
+ };
23410
+ CustomSqlColumnRendererCB.prototype.getDefaultValue = function () {
23411
+ return this.column.expr.sql;
23412
+ };
23413
+ return CustomSqlColumnRendererCB;
23414
+ }(EditableColumnRendererCB));
23321
23415
 
23322
- //# sourceMappingURL=aggrfunc_column_renderer.js.map
23416
+ var ConstColumnRendererCB = /** @class */ (function (_super) {
23417
+ editable_column_renderer_cb_extends(ConstColumnRendererCB, _super);
23418
+ function ConstColumnRendererCB() {
23419
+ return _super !== null && _super.apply(this, arguments) || this;
23420
+ }
23421
+ ConstColumnRendererCB.prototype.getColumnValue = function () {
23422
+ return this.column.expr.value;
23423
+ };
23424
+ ConstColumnRendererCB.prototype.setColumnValue = function (value) {
23425
+ this.column.expr.setValue(value);
23426
+ };
23427
+ ConstColumnRendererCB.prototype.getDefaultValue = function () {
23428
+ return this.column.expr.value;
23429
+ };
23430
+ return ConstColumnRendererCB;
23431
+ }(EditableColumnRendererCB));
23432
+
23433
+ //# sourceMappingURL=editable_column_renderer_cb.js.map
23323
23434
  ;// CONCATENATED MODULE: ./dist/lib/widgets/columns_bar.js
23324
23435
  var columns_bar_extends = (undefined && undefined.__extends) || (function () {
23325
23436
  var extendStatics = function (d, b) {
@@ -23345,6 +23456,7 @@ var columns_bar_extends = (undefined && undefined.__extends) || (function () {
23345
23456
 
23346
23457
 
23347
23458
 
23459
+
23348
23460
  var ColumnsBar = /** @class */ (function (_super) {
23349
23461
  columns_bar_extends(ColumnsBar, _super);
23350
23462
  function ColumnsBar(slot, customQuery) {
@@ -23359,8 +23471,6 @@ var ColumnsBar = /** @class */ (function (_super) {
23359
23471
  allowDuplicates: true,
23360
23472
  allowCustomExpressions: false,
23361
23473
  allowSorting: true,
23362
- attrElementFormat: '{entity} {attr}',
23363
- titleElementFormat: null,
23364
23474
  alwaysShowButtons: false,
23365
23475
  accentActiveColumn: true,
23366
23476
  allowDragDrop: true,
@@ -23413,6 +23523,12 @@ var ColumnsBar = /** @class */ (function (_super) {
23413
23523
  var _this = this;
23414
23524
  _super.prototype.init.call(this, context, options);
23415
23525
  this.setOptions(options);
23526
+ if (options.attrElementFormat) {
23527
+ this.context.options.attributeFormat = options.attrElementFormat;
23528
+ }
23529
+ if (options.titleElementFormat) {
23530
+ this.context.options.columnTitleFormat = options.titleElementFormat;
23531
+ }
23416
23532
  this.detachQueryObserver();
23417
23533
  this.attachQueryObserver();
23418
23534
  lib_public_api.eqDragManager.removeDropContainer(this.slot);
@@ -23543,6 +23659,7 @@ var ColumnsBar = /** @class */ (function (_super) {
23543
23659
  };
23544
23660
  ColumnsBar.prototype.setOptions = function (options) {
23545
23661
  this.options = public_api.utils.assignDeep(this.options, options);
23662
+ this.getContext().options.allowCustomExpressions = options.allowCustomExpressions;
23546
23663
  };
23547
23664
  ColumnsBar.prototype.showLandingSlot = function (pageX, pageY) {
23548
23665
  var elements = this.columnsBlock.querySelectorAll("[class*=".concat(this.cssPrefix, "-row]"));
@@ -23794,64 +23911,41 @@ var ColumnsBar = /** @class */ (function (_super) {
23794
23911
  };
23795
23912
  ColumnsBar.prototype.getColumnRenderer = function (column, slot) {
23796
23913
  switch (column.expr.tag) {
23914
+ case ExprTag.Constant:
23915
+ return new ConstColumnRendererCB(this, column, slot);
23797
23916
  case ExprTag.AggregateFunction:
23798
23917
  return new AggrFuncColumnRendererCB(this, column, slot);
23799
23918
  case ExprTag.CustomSql:
23800
- // return new CustomSqlColumnRendererCB(this, column, slot);
23801
- case ExprTag.EntityAttribute:
23802
- case ExprTag.ParentEntityAttribute:
23803
- return new SimpleColumnRendererCB(this, column, slot);
23919
+ return new CustomSqlColumnRendererCB(this, column, slot);
23920
+ default:
23921
+ return new AttrColumnRendererCB(this, column, slot);
23804
23922
  }
23805
23923
  return null;
23806
23924
  };
23807
- ColumnsBar.prototype.addNewColumn = function (attrId, index) {
23808
- var _this = this;
23925
+ ColumnsBar.prototype.addNewColumn = function (attrs, index) {
23809
23926
  var model = this.getContext().getModel();
23810
23927
  var query = this.getQuery();
23811
- var getColumnByAttrId = function (attrid) {
23812
- var attribute = model.getAttributeById(attrid);
23813
- if (!attribute) {
23814
- return null;
23815
- }
23816
- if (!attribute.useInResult) {
23817
- if (attribute.lookupAttr) {
23818
- attrid = attribute.lookupAttr;
23819
- attribute = model.getAttributeById(attrid);
23820
- if (!attribute || !attribute.useInResult) {
23821
- return null;
23822
- }
23823
- }
23824
- else
23825
- return null;
23826
- }
23827
- var column = query.createColumn();
23828
- column.caption = _this.getDefaultColumnCaption(attribute);
23829
- column.sorting = SortDirection.None;
23830
- column.sortIndex = -1;
23831
- column.expr.tag = ExprTag.EntityAttribute;
23832
- column.expr.kind = DataKind.Attribute;
23833
- column.expr.dataType = attribute.dataType;
23834
- column.expr.setValue(attrid, true);
23835
- column.params.concat(attribute.params);
23836
- return column;
23837
- };
23838
- if (!this.getQuery()) {
23839
- return;
23840
- }
23841
- var colToAdd, col;
23842
- if (Array.isArray(attrId)) {
23843
- colToAdd = [];
23844
- for (var i = 0; i < attrId.length; i++) {
23845
- col = getColumnByAttrId(attrId[i]);
23928
+ if (Array.isArray(attrs)) {
23929
+ var col = null;
23930
+ var cols = [];
23931
+ for (var i = 0; i < attrs.length; i++) {
23932
+ col = query.addColumn({
23933
+ attributeId: attrs[i],
23934
+ index: index
23935
+ }, true);
23846
23936
  if (col) {
23847
- colToAdd.push(col);
23937
+ cols.push(col);
23848
23938
  }
23849
23939
  }
23940
+ return cols;
23941
+ }
23942
+ else {
23943
+ var col = query.addColumn({
23944
+ attributeId: attrs,
23945
+ index: index
23946
+ });
23947
+ return col;
23850
23948
  }
23851
- else
23852
- colToAdd = getColumnByAttrId(attrId);
23853
- this.addColumn(colToAdd, index);
23854
- return colToAdd;
23855
23949
  };
23856
23950
  ColumnsBar.prototype.toggleColumnPicked = function (column) {
23857
23951
  var el;
@@ -23876,25 +23970,6 @@ var ColumnsBar = /** @class */ (function (_super) {
23876
23970
  .data("show-buttons", "");
23877
23971
  }
23878
23972
  };
23879
- ColumnsBar.prototype.addColumn = function (column, index) {
23880
- var query = this.getQuery();
23881
- if (!query) {
23882
- return;
23883
- }
23884
- if (Array.isArray(column))
23885
- column = this.checkColumnsArray(column);
23886
- else
23887
- column = this.checkColumn(column);
23888
- if (!column || (Array.isArray(column) && column.length == 0)) {
23889
- return;
23890
- }
23891
- query.addColumnObj(column, index, self);
23892
- query.fireChangedEvent({
23893
- part: QueryChangePart.Columns,
23894
- action: QueryChangeAction.Add,
23895
- changee: column
23896
- });
23897
- };
23898
23973
  //adds one column to the bar on the specified position
23899
23974
  ColumnsBar.prototype.addColumnElement = function (column, index) {
23900
23975
  var rows = this.columnsBlock.querySelectorAll("[class*=".concat(this.cssPrefix, "-row]"));
@@ -23937,11 +24012,6 @@ var ColumnsBar = /** @class */ (function (_super) {
23937
24012
  }
23938
24013
  return col;
23939
24014
  };
23940
- ColumnsBar.prototype.getDefaultColumnCaption = function (attr) {
23941
- var format = this.options.titleElementFormat || this.options.attrElementFormat;
23942
- var model = this.getContext().getModel();
23943
- return model.getAttributeText(attr, format);
23944
- };
23945
24015
  ColumnsBar.prototype.getColumnsBlock = function () {
23946
24016
  return this.columnsBlock;
23947
24017
  };
@@ -24043,13 +24113,13 @@ var ColumnsBar = /** @class */ (function (_super) {
24043
24113
  };
24044
24114
  ColumnsBar.prototype.areCustomExpressionsAllowed = function () {
24045
24115
  var query = this.getQuery();
24046
- return query.isEx() && this.options.allowCustomExpressions;
24116
+ return query.isEx() && this.getContext().options.allowCustomExpressions;
24047
24117
  };
24048
24118
  ColumnsBar.globalCounter = 0;
24049
24119
  return ColumnsBar;
24050
24120
  }(Widget));
24051
24121
  //# sourceMappingURL=columns_bar.js.map
24052
- ;// CONCATENATED MODULE: ./dist/lib/widgets/renderers/sortingbar/column_renderer_sp.js
24122
+ ;// CONCATENATED MODULE: ./dist/lib/widgets/renderers/sortingbar/column_renderer_sb.js
24053
24123
 
24054
24124
 
24055
24125
 
@@ -24073,7 +24143,6 @@ var ColumnRendererSB = /** @class */ (function () {
24073
24143
  });
24074
24144
  ColumnRendererSB.prototype.render = function () {
24075
24145
  var _this = this;
24076
- this.baseAttr = this.getAttribute();
24077
24146
  var builder = (0,lib_public_api.domel)('div');
24078
24147
  builder.data('id', this.column.id);
24079
24148
  if (this.element) {
@@ -24124,9 +24193,6 @@ var ColumnRendererSB = /** @class */ (function () {
24124
24193
  };
24125
24194
  ColumnRendererSB.prototype.renderCaptionBlock = function () {
24126
24195
  var _this = this;
24127
- if (!this.column.caption || this.column.caption == '') {
24128
- this.column.caption = this.getDefaultCaption();
24129
- }
24130
24196
  function getArrow(sd) {
24131
24197
  switch (sd) {
24132
24198
  case SortDirection.Ascending:
@@ -24196,7 +24262,7 @@ var ColumnRendererSB = /** @class */ (function () {
24196
24262
  if (data.id == 'None' || data.id == "Ascending" || data.id == "Descending") {
24197
24263
  var query = _this.bar.getContext().getQuery();
24198
24264
  if (_this.column.isJustSorted() && data.id == 'None') {
24199
- query.removeColumn(_this.column, _this.bar);
24265
+ query.removeColumn(_this.column);
24200
24266
  query.fireColumnsChangedEvent(QueryChangeAction.Delete, _this.column, true);
24201
24267
  }
24202
24268
  else {
@@ -24215,14 +24281,6 @@ var ColumnRendererSB = /** @class */ (function () {
24215
24281
  });
24216
24282
  return false;
24217
24283
  };
24218
- ColumnRendererSB.prototype.getDefaultCaption = function () {
24219
- return this.getDefaultTitleText(this.baseAttr);
24220
- };
24221
- ColumnRendererSB.prototype.getDefaultTitleText = function (attr) {
24222
- var format = this.bar.options.titleElementFormat || this.bar.options.attrElementFormat;
24223
- var model = this.bar.getContext().getModel();
24224
- return model.getAttributeText(attr, format);
24225
- };
24226
24284
  ColumnRendererSB.prototype.getClassesToAdd = function () {
24227
24285
  return "".concat(this.cssPrefix, "-row ").concat(this.cssPrefix, "-row-column-entattr");
24228
24286
  };
@@ -24234,7 +24292,7 @@ var ColumnRendererSB = /** @class */ (function () {
24234
24292
  return ColumnRendererSB;
24235
24293
  }());
24236
24294
 
24237
- //# sourceMappingURL=column_renderer_sp.js.map
24295
+ //# sourceMappingURL=column_renderer_sb.js.map
24238
24296
  ;// CONCATENATED MODULE: ./dist/lib/widgets/sorting_bar.js
24239
24297
  var sorting_bar_extends = (undefined && undefined.__extends) || (function () {
24240
24298
  var extendStatics = function (d, b) {
@@ -24264,8 +24322,6 @@ var SortingBar = /** @class */ (function (_super) {
24264
24322
  var _this = _super.call(this, slot) || this;
24265
24323
  _this.options = {
24266
24324
  showAddRow: true,
24267
- attrElementFormat: '{entity} {attr}',
24268
- titleElementFormat: null,
24269
24325
  allowDragDrop: true,
24270
24326
  menuOptions: {
24271
24327
  showSearchBoxAfter: 30,
@@ -24309,6 +24365,12 @@ var SortingBar = /** @class */ (function (_super) {
24309
24365
  var _this = this;
24310
24366
  _super.prototype.init.call(this, context, options);
24311
24367
  this.setOptions(options);
24368
+ if (options.attrElementFormat) {
24369
+ this.context.options.attributeFormat = options.attrElementFormat;
24370
+ }
24371
+ if (options.titleElementFormat) {
24372
+ this.context.options.columnTitleFormat = options.titleElementFormat;
24373
+ }
24312
24374
  this.destroyCore();
24313
24375
  this.attachQueryObserver();
24314
24376
  lib_public_api.eqDragManager.removeDropContainer(this.slot);
@@ -24461,48 +24523,20 @@ var SortingBar = /** @class */ (function (_super) {
24461
24523
  });
24462
24524
  };
24463
24525
  SortingBar.prototype.addNewColumn = function (attrId) {
24464
- var _this = this;
24465
24526
  var model = this.getModel();
24466
24527
  var query = this.getQuery();
24467
- var getColumnByAttrId = function (attrid) {
24468
- var attribute = model.getAttributeById(attrid);
24469
- if (!attribute) {
24470
- return null;
24471
- }
24472
- if (!attribute.useInSorting) {
24473
- if (attribute.lookupAttr) {
24474
- attrid = attribute.lookupAttr;
24475
- attribute = model.getAttributeById(attrid);
24476
- if (!attribute || !attribute.useInSorting) {
24477
- return null;
24478
- }
24479
- }
24480
- else
24481
- return null;
24482
- }
24483
- var column = query.createColumn(true);
24484
- column.caption = _this.getDefaultColumnCaption(attribute);
24485
- column._sorting = SortDirection.Ascending;
24486
- //column.sortIndex = this.getQuery().getColumnSortIndex(column);
24487
- column.expr.tag = ExprTag.EntityAttribute;
24488
- column.expr.dataType = attribute.dataType;
24489
- //column.expr.id = attrid;
24490
- column.expr.setValue(attrid, true);
24491
- column.params.concat(attribute.params);
24492
- return column;
24493
- };
24494
- if (!this.getQuery()) {
24495
- return;
24496
- }
24497
- var newCol = getColumnByAttrId(attrId);
24498
- return this.getQuery().addColumn({
24499
- column: newCol
24528
+ var col = query.addColumn({
24529
+ attributeId: attrId,
24530
+ justsorted: true,
24531
+ sorting: SortDirection.Ascending
24500
24532
  });
24501
- };
24502
- SortingBar.prototype.getDefaultColumnCaption = function (attr) {
24503
- var format = this.options.titleElementFormat || this.options.attrElementFormat;
24504
- var model = this.getModel();
24505
- return model.getAttributeText(attr, format);
24533
+ query.fireChangedEvent({
24534
+ part: QueryChangePart.SortingColumns,
24535
+ action: QueryChangeAction.Add,
24536
+ changee: col,
24537
+ source: this
24538
+ });
24539
+ return col;
24506
24540
  };
24507
24541
  SortingBar.prototype.renderColumn = function (column, elem) {
24508
24542
  var renderer = new ColumnRendererSB(this, column, elem);
@@ -28224,78 +28258,17 @@ var EasyGridWidget = /** @class */ (function (_super) {
28224
28258
  }
28225
28259
  };
28226
28260
  EasyGridWidget.prototype.addNewColumn = function (attrId) {
28227
- var _this = this;
28228
- var model = this.getContext().getModel();
28229
- var query = this.getContext().getQuery();
28230
- var getColumnByAttrId = function (attrid) {
28231
- var attribute = model.getAttributeById(attrid);
28232
- if (!attribute) {
28233
- return null;
28234
- }
28235
- if (!attribute.useInSorting) {
28236
- if (attribute.lookupAttr) {
28237
- attrid = attribute.lookupAttr;
28238
- attribute = model.getAttributeById(attrid);
28239
- if (!attribute || !attribute.useInSorting) {
28240
- return null;
28241
- }
28242
- }
28243
- else
28244
- return null;
28245
- }
28246
- var column = query.createColumn();
28247
- column.caption = _this.getDefaultColumnCaption(attribute);
28248
- column.sorting = SortDirection.None;
28249
- column.sortIndex = -1;
28250
- column.expr.tag = ExprTag.EntityAttribute;
28251
- //column.expr.id = attrid;
28252
- column.expr.setValue(attrid, true);
28253
- column.params.concat(attribute.params);
28254
- return column;
28255
- };
28256
- if (!this.getContext().getQuery()) {
28257
- return;
28258
- }
28259
- return this.addColumn(getColumnByAttrId(attrId));
28260
- };
28261
- EasyGridWidget.prototype.getDefaultColumnCaption = function (attr) {
28262
- var format = this.options.titleElementFormat || this.options.attrElementFormat;
28263
28261
  var model = this.getContext().getModel();
28264
- return model.getAttributeText(attr, format);
28265
- };
28266
- EasyGridWidget.prototype.addColumn = function (column) {
28267
28262
  var query = this.getContext().getQuery();
28268
- if (!query) {
28269
- return;
28270
- }
28271
- column = this.checkColumn(column);
28272
- if (!column) {
28273
- return;
28274
- }
28275
- column = query.addColumn({
28276
- caption: column.caption,
28277
- attributeId: column.expr.value,
28278
- sorting: column.sorting,
28279
- sortIndex: column.sortIndex
28263
+ var col = query.addColumn({
28264
+ attributeId: attrId
28280
28265
  });
28281
28266
  query.fireChangedEvent({
28282
28267
  part: QueryChangePart.Columns,
28283
28268
  action: QueryChangeAction.Add,
28284
- changee: column,
28269
+ changee: col,
28285
28270
  source: this
28286
28271
  });
28287
- return column;
28288
- };
28289
- EasyGridWidget.prototype.checkColumn = function (col) {
28290
- var query = this.getContext().getQuery();
28291
- var columns = query.getColumns();
28292
- var colJson = JSON.stringify(col.expr.saveToData());
28293
- for (var i = 0; i < columns.length; i++) {
28294
- var qcolJson = JSON.stringify(columns[i].expr.saveToData());
28295
- if (qcolJson === colJson) {
28296
- return null;
28297
- }
28298
- }
28299
28272
  return col;
28300
28273
  };
28301
28274
  return EasyGridWidget;
@@ -32245,12 +32218,7 @@ var View = /** @class */ (function () {
32245
32218
  }
32246
32219
  // map columnTitleFormat option to widgets that have similar option
32247
32220
  if (options.columnTitleFormat) {
32248
- options.widgets.entitiesPanel = options.widgets.entitiesPanel || {};
32249
- options.widgets.entitiesPanel.columnTitleFormat = options.widgets.entitiesPanel.columnTitleFormat || options.columnTitleFormat;
32250
- options.widgets.columnsBar = options.widgets.columnsBar || {};
32251
- options.widgets.columnsBar.titleElementFormat = options.widgets.columnsBar.titleElementFormat || options.columnTitleFormat;
32252
- options.widgets.columnsPanel = options.widgets.columnsPanel || {};
32253
- options.widgets.columnsPanel.titleElementFormat = options.widgets.columnsPanel.titleElementFormat || options.columnTitleFormat;
32221
+ this.context.options.columnTitleFormat = options.columnTitleFormat;
32254
32222
  }
32255
32223
  //to support old paging options (should be removed in the next versions)
32256
32224
  options.widgets.easyGrid.paging =