@easyquery/ui 7.2.0-rc01 → 7.2.0-rc02

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * EasyQuery.JS Community 7.2.0-rc01 (https://korzh.com/easyquery/javascript)
2
+ * EasyQuery.JS Community 7.2.0-rc02 (https://korzh.com/easyquery/javascript)
3
3
  * Copyright 2021 Korzh.com. All rights reserved.
4
4
  *
5
5
  * EasyQuery.JS commercial licenses may be obtained at
@@ -1,5 +1,5 @@
1
1
  /**
2
- * EasyQuery.JS Community 7.2.0-rc01 (https://korzh.com/easyquery/javascript)
2
+ * EasyQuery.JS Community 7.2.0-rc02 (https://korzh.com/easyquery/javascript)
3
3
  * Copyright 2021 Korzh.com. All rights reserved.
4
4
  *
5
5
  * EasyQuery.JS commercial licenses may be obtained at
@@ -4370,7 +4370,7 @@ var easy_grid_EasyGrid = /** @class */ (function () {
4370
4370
  default: 60
4371
4371
  }
4372
4372
  },
4373
- addColumns: false,
4373
+ showPlusButton: false,
4374
4374
  viewportRowsCount: null,
4375
4375
  showActiveRow: true
4376
4376
  };
@@ -4469,8 +4469,8 @@ var easy_grid_EasyGrid = /** @class */ (function () {
4469
4469
  if (options.onRowDbClick) {
4470
4470
  this.addEventListener('rowDbClick', options.onRowDbClick);
4471
4471
  }
4472
- if (options.onAddColumnClick) {
4473
- this.addEventListener('addColumnClick', options.onAddColumnClick);
4472
+ if (options.onPlusButtonClick) {
4473
+ this.addEventListener('plusButtonClick', options.onPlusButtonClick);
4474
4474
  }
4475
4475
  if (options.onColumnChanged) {
4476
4476
  this.addEventListener('columnChanged', options.onColumnChanged);
@@ -4556,7 +4556,7 @@ var easy_grid_EasyGrid = /** @class */ (function () {
4556
4556
  };
4557
4557
  EasyGrid.prototype.render = function () {
4558
4558
  var _this = this;
4559
- if (!this.hasData() && !this.options.addColumns)
4559
+ if (!this.hasData() && !this.options.showPlusButton)
4560
4560
  return;
4561
4561
  this.containerInitialHeight = this.slot.clientHeight;
4562
4562
  this.rootDiv = document.createElement('div');
@@ -4604,14 +4604,14 @@ var easy_grid_EasyGrid = /** @class */ (function () {
4604
4604
  var firstRow = _this.bodyCellContainerDiv.firstElementChild;
4605
4605
  var rowHeight = firstRow ? firstRow.offsetHeight : DEFAULT_ROW_HEIGHT;
4606
4606
  var rowCount = _this.options.viewportRowsCount; // || DEFAULT_ROW_COUNT;
4607
- var bodyHeight_1 = rowHeight * rowCount;
4608
- domel(_this.bodyDiv)
4609
- .setStyle('height', bodyHeight_1 + "px");
4607
+ var viewportHeight_1 = rowHeight * rowCount;
4608
+ domel(_this.bodyViewportDiv)
4609
+ .setStyle('height', viewportHeight_1 + "px");
4610
4610
  setTimeout(function () {
4611
4611
  var sbHeight = _this.bodyViewportDiv.offsetHeight - _this.bodyViewportDiv.clientHeight;
4612
- bodyHeight_1 = bodyHeight_1 + sbHeight;
4613
- domel(_this.bodyDiv)
4614
- .setStyle('height', bodyHeight_1 + "px");
4612
+ viewportHeight_1 = viewportHeight_1 + sbHeight;
4613
+ domel(_this.bodyViewportDiv)
4614
+ .setStyle('height', viewportHeight_1 + "px");
4615
4615
  resolve();
4616
4616
  }, 100);
4617
4617
  return;
@@ -4658,7 +4658,7 @@ var easy_grid_EasyGrid = /** @class */ (function () {
4658
4658
  _this.headerRowDiv.appendChild(hd);
4659
4659
  if (column.isRowNum) {
4660
4660
  domel(hd)
4661
- .addChildElement(_this.renderAddColumnButton());
4661
+ .addChildElement(_this.renderHeaderButtons());
4662
4662
  }
4663
4663
  });
4664
4664
  var containerWidth = this.getContainerWidth();
@@ -4997,23 +4997,26 @@ var easy_grid_EasyGrid = /** @class */ (function () {
4997
4997
  var pageInfoDiv = domel('div')
4998
4998
  .addClass(this.cssPrefix + "-page-info")
4999
4999
  .toDOM();
5000
- var fistPageRecordNum = count
5001
- ? (this.pagination.page - 1) * this.pagination.pageSize + 1
5002
- : 0;
5003
- var lastPageRecordNum = count
5004
- ? fistPageRecordNum + count - 1
5005
- : 0;
5006
- var totalStr = this.dataTable.getTotal().toString();
5007
- if (this.dataTable.elasticChunks) {
5008
- var count_1 = this.dataTable.getCachedCount();
5009
- var total = this.dataTable.getTotal();
5010
- if (count_1 !== total)
5011
- totalStr = '?';
5012
- }
5013
- pageInfoDiv.innerHTML = public_api["g" /* i18n */].getText('GridPageInfo')
5014
- .replace('{FirstPageRecordNum}', "<span>" + fistPageRecordNum.toString() + "</span>")
5015
- .replace('{LastPageRecordNum}', "<span>" + lastPageRecordNum.toString() + "</span>")
5016
- .replace('{Total}', "<span>" + totalStr + "</span>");
5000
+ var rowCount = this.dataTable.getTotal();
5001
+ if (rowCount > 0) {
5002
+ var fistPageRecordNum = count
5003
+ ? (this.pagination.page - 1) * this.pagination.pageSize + 1
5004
+ : 0;
5005
+ var lastPageRecordNum = count
5006
+ ? fistPageRecordNum + count - 1
5007
+ : 0;
5008
+ var totalStr = this.dataTable.getTotal().toString();
5009
+ if (this.dataTable.elasticChunks) {
5010
+ var count_1 = this.dataTable.getCachedCount();
5011
+ var total = this.dataTable.getTotal();
5012
+ if (count_1 !== total)
5013
+ totalStr = '?';
5014
+ }
5015
+ pageInfoDiv.innerHTML = public_api["g" /* i18n */].getText('GridPageInfo')
5016
+ .replace('{FirstPageRecordNum}', "<span>" + fistPageRecordNum.toString() + "</span>")
5017
+ .replace('{LastPageRecordNum}', "<span>" + lastPageRecordNum.toString() + "</span>")
5018
+ .replace('{Total}', "<span>" + totalStr + "</span>");
5019
+ }
5017
5020
  return pageInfoDiv;
5018
5021
  };
5019
5022
  EasyGrid.prototype.showProgress = function () {
@@ -5108,7 +5111,8 @@ var easy_grid_EasyGrid = /** @class */ (function () {
5108
5111
  var _this = this;
5109
5112
  var paginateDiv = document.createElement('div');
5110
5113
  paginateDiv.className = this.cssPrefix + "-pagination-wrapper";
5111
- if (this.options.paging && this.options.paging.enabled) {
5114
+ var rowCount = this.dataTable.getTotal();
5115
+ if (this.options.paging && this.options.paging.enabled && rowCount > 0) {
5112
5116
  var prefix_1 = this.paginationOptions.useBootstrap ? '' : this.cssPrefix + "-";
5113
5117
  var buttonClickHandler_1 = function (ev) {
5114
5118
  var element = ev.target;
@@ -5234,18 +5238,18 @@ var easy_grid_EasyGrid = /** @class */ (function () {
5234
5238
  EasyGrid.prototype.removeEventListener = function (eventType, handlerId) {
5235
5239
  this.eventEmitter.unsubscribe(eventType, handlerId);
5236
5240
  };
5237
- EasyGrid.prototype.renderAddColumnButton = function () {
5241
+ EasyGrid.prototype.renderHeaderButtons = function () {
5238
5242
  var _this = this;
5239
- if (this.options.addColumns) {
5243
+ if (this.options.showPlusButton) {
5240
5244
  return domel('div')
5241
- .addClass(this.cssPrefix + "-addrow")
5242
- .title(this.options.addColumnsTitle || 'Add column')
5245
+ .addClass(this.cssPrefix + "-header-btn-plus")
5246
+ .title(this.options.plusButtonTitle || 'Add')
5243
5247
  .addChild('a', function (builder) { return builder
5244
5248
  .attr('href', 'javascript:void(0)')
5245
5249
  .on('click', function (e) {
5246
5250
  e.preventDefault();
5247
5251
  _this.fireEvent({
5248
- type: 'addColumnClick',
5252
+ type: 'plusButtonClick',
5249
5253
  sourceEvent: e
5250
5254
  });
5251
5255
  }); })
@@ -16402,7 +16406,7 @@ var easy_grid_widget_EasyGridWidget = /** @class */ (function (_super) {
16402
16406
  _super.prototype.init.call(this, context, options);
16403
16407
  var gridOptions = __assign(__assign({}, options), { slot: this.slot, dataTable: context.resultTable });
16404
16408
  this.options = public_api["i" /* utils */].assign(this.options, options);
16405
- gridOptions.onAddColumnClick = function (ev) { return _this.addColumnClickHandler(ev); };
16409
+ gridOptions.onPlusButtonClick = function (ev) { return _this.addColumnClickHandler(ev); };
16406
16410
  gridOptions.onColumnMoved = function (ev) { return _this.columnMovedHandler(ev); };
16407
16411
  if (gridOptions.aggregates) {
16408
16412
  this.hasCustomTotalsSettings = true;
@@ -17105,6 +17109,11 @@ var result_facet_ResultFacet = /** @class */ (function () {
17105
17109
  var resultTable = context.resultTable;
17106
17110
  return (resultTable.getCachedCount() == resultTable.getTotal());
17107
17111
  };
17112
+ ResultFacet.prototype.showErrorMessage = function (message) {
17113
+ this.displayMessageDiv.innerHTML = message;
17114
+ this.displayMessageDiv.classList.add(this.cssPrefix + "-error-message");
17115
+ Object(lib_public_api["i" /* domel */])(this.displayMessageDiv).show();
17116
+ };
17108
17117
  ResultFacet.prototype.showUnableDisplayMessage = function (message) {
17109
17118
  var context = this.getContext();
17110
17119
  var resultTable = context.resultTable;
@@ -18196,21 +18205,25 @@ var pivot_table_facet_PivotTableFacet = /** @class */ (function (_super) {
18196
18205
  PivotTableFacet.prototype.init = function (slot) {
18197
18206
  var _this = this;
18198
18207
  _super.prototype.init.call(this, slot);
18208
+ this.options.maxRowCount = this.options.maxRowCount || 500;
18209
+ this.options.viewportRowsCount = this.options.viewportRowsCount || 50;
18199
18210
  this.grid = new lib_public_api["e" /* EasyGrid */]({
18200
18211
  slot: this.contentDiv,
18201
18212
  dataTable: this.pivotTable,
18202
18213
  paging: {
18203
- enabled: false
18214
+ enabled: false,
18215
+ pageSize: this.options.maxRowCount
18204
18216
  },
18217
+ viewportRowsCount: this.options.viewportRowsCount,
18205
18218
  useRowNumeration: false,
18206
- addColumns: false,
18219
+ showPlusButton: false,
18207
18220
  allowDragDrop: false,
18208
18221
  onGetCellRenderer: function (column, defaultRenderer) {
18209
18222
  if (column.dataColumn) {
18210
18223
  if (column.dataColumn.id == "total") {
18211
18224
  return function (value, column, cell, rowEl) {
18212
18225
  defaultRenderer(value, column, cell, rowEl);
18213
- cell.style.fontWeight = '900';
18226
+ cell.classList.add('pivot-cell-total');
18214
18227
  };
18215
18228
  }
18216
18229
  if (_this.settings.totalsRow) {
@@ -18471,6 +18484,18 @@ var pivot_table_facet_PivotTableFacet = /** @class */ (function (_super) {
18471
18484
  PivotTableFacet.prototype.refreshCore = function () {
18472
18485
  this.updatePivotData();
18473
18486
  if (this.grid) {
18487
+ var dataSize = this.pivotTable.getTotal();
18488
+ var maxRow = this.grid.options.paging.pageSize;
18489
+ if (dataSize > maxRow) {
18490
+ this.contentDiv.classList.remove('pivot-grid-with-totals');
18491
+ this.showErrorMessage(public_api["g" /* i18n */].getText('Facets', 'ErrTooMuchData'));
18492
+ }
18493
+ if (this.options.viewportRowsCount > dataSize) {
18494
+ this.grid.options.viewportRowsCount = dataSize;
18495
+ }
18496
+ else {
18497
+ this.grid.options.viewportRowsCount = this.options.viewportRowsCount;
18498
+ }
18474
18499
  this.grid.refresh();
18475
18500
  }
18476
18501
  };
@@ -18645,10 +18670,10 @@ var pivot_table_facet_PivotTableFacet = /** @class */ (function (_super) {
18645
18670
  total_row.push(totalByCol);
18646
18671
  }
18647
18672
  this.pivotTable.addRow(total_row);
18648
- this.contentDiv.classList.add('pivot-grid-totals-row');
18673
+ this.contentDiv.classList.add('pivot-grid-with-totals');
18649
18674
  }
18650
18675
  else {
18651
- this.contentDiv.classList.remove('pivot-grid-totals-row');
18676
+ this.contentDiv.classList.remove('pivot-grid-with-totals');
18652
18677
  }
18653
18678
  };
18654
18679
  PivotTableFacet.prototype.calcAggrFunc = function (func, options) {
@@ -22668,6 +22693,7 @@ function addEasyQueryUITexts() {
22668
22693
  TabNameLabel: 'Tab name',
22669
22694
  ErrQueryChanged: 'FAILED TO DISPLAY. QUERY WAS CHANGED',
22670
22695
  ErrNotEnoughData: "We can't display the graph because not all data for this query is loaded. \n The total number of records: {totalRecs}, currently loaded: {cachedRecs}. \n You can [download the result]. Please note: this may take some time and consume a lot of memory.",
22696
+ ErrTooMuchData: 'Too much data. The grid is not able to display it',
22671
22697
  Chart: {
22672
22698
  FacetTitle: 'Chart',
22673
22699
  DlgTitle: 'Chart settings',