@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
@@ -2407,7 +2407,7 @@ var eq_services_EqServiceProvider = /** @class */ (function () {
2407
2407
  this.queryFileLoader = null;
2408
2408
  this.aggrCalculator = null;
2409
2409
  this.httpClient = new public_api["HttpClient"]();
2410
- this.httpClient.defaultHeaders['x-eqjs-version'] = '7.1.0';
2410
+ this.httpClient.defaultHeaders['x-eqjs-version'] = '7.2.0';
2411
2411
  this.modelResolver = function (_) { return new data_model["a" /* DataModel */](); };
2412
2412
  this.queryResolver = function (context) { return new query_query["b" /* Query */](context.getModel()); };
2413
2413
  this.modelLoaderResolver = function (context) { return new EqServerModelLoader(context); };
@@ -11259,6 +11259,11 @@ var ResultFacet = /** @class */ (function () {
11259
11259
  var resultTable = context.resultTable;
11260
11260
  return (resultTable.getCachedCount() == resultTable.getTotal());
11261
11261
  };
11262
+ ResultFacet.prototype.showErrorMessage = function (message) {
11263
+ this.displayMessageDiv.innerHTML = message;
11264
+ this.displayMessageDiv.classList.add(this.cssPrefix + "-error-message");
11265
+ Object(_easydata_ui__WEBPACK_IMPORTED_MODULE_1__["domel"])(this.displayMessageDiv).show();
11266
+ };
11262
11267
  ResultFacet.prototype.showUnableDisplayMessage = function (message) {
11263
11268
  var context = this.getContext();
11264
11269
  var resultTable = context.resultTable;
@@ -15282,7 +15287,7 @@ var EasyGridWidget = /** @class */ (function (_super) {
15282
15287
  _super.prototype.init.call(this, context, options);
15283
15288
  var gridOptions = __assign(__assign({}, options), { slot: this.slot, dataTable: context.resultTable });
15284
15289
  this.options = _easydata_core__WEBPACK_IMPORTED_MODULE_1__["utils"].assign(this.options, options);
15285
- gridOptions.onAddColumnClick = function (ev) { return _this.addColumnClickHandler(ev); };
15290
+ gridOptions.onPlusButtonClick = function (ev) { return _this.addColumnClickHandler(ev); };
15286
15291
  gridOptions.onColumnMoved = function (ev) { return _this.columnMovedHandler(ev); };
15287
15292
  if (gridOptions.aggregates) {
15288
15293
  this.hasCustomTotalsSettings = true;
@@ -25634,21 +25639,25 @@ var PivotTableFacet = /** @class */ (function (_super) {
25634
25639
  PivotTableFacet.prototype.init = function (slot) {
25635
25640
  var _this = this;
25636
25641
  _super.prototype.init.call(this, slot);
25642
+ this.options.maxRowCount = this.options.maxRowCount || 500;
25643
+ this.options.viewportRowsCount = this.options.viewportRowsCount || 50;
25637
25644
  this.grid = new _easydata_ui__WEBPACK_IMPORTED_MODULE_0__["EasyGrid"]({
25638
25645
  slot: this.contentDiv,
25639
25646
  dataTable: this.pivotTable,
25640
25647
  paging: {
25641
- enabled: false
25648
+ enabled: false,
25649
+ pageSize: this.options.maxRowCount
25642
25650
  },
25651
+ viewportRowsCount: this.options.viewportRowsCount,
25643
25652
  useRowNumeration: false,
25644
- addColumns: false,
25653
+ showPlusButton: false,
25645
25654
  allowDragDrop: false,
25646
25655
  onGetCellRenderer: function (column, defaultRenderer) {
25647
25656
  if (column.dataColumn) {
25648
25657
  if (column.dataColumn.id == "total") {
25649
25658
  return function (value, column, cell, rowEl) {
25650
25659
  defaultRenderer(value, column, cell, rowEl);
25651
- cell.style.fontWeight = '900';
25660
+ cell.classList.add('pivot-cell-total');
25652
25661
  };
25653
25662
  }
25654
25663
  if (_this.settings.totalsRow) {
@@ -25909,6 +25918,18 @@ var PivotTableFacet = /** @class */ (function (_super) {
25909
25918
  PivotTableFacet.prototype.refreshCore = function () {
25910
25919
  this.updatePivotData();
25911
25920
  if (this.grid) {
25921
+ var dataSize = this.pivotTable.getTotal();
25922
+ var maxRow = this.grid.options.paging.pageSize;
25923
+ if (dataSize > maxRow) {
25924
+ this.contentDiv.classList.remove('pivot-grid-with-totals');
25925
+ this.showErrorMessage(_easydata_core__WEBPACK_IMPORTED_MODULE_1__["i18n"].getText('Facets', 'ErrTooMuchData'));
25926
+ }
25927
+ if (this.options.viewportRowsCount > dataSize) {
25928
+ this.grid.options.viewportRowsCount = dataSize;
25929
+ }
25930
+ else {
25931
+ this.grid.options.viewportRowsCount = this.options.viewportRowsCount;
25932
+ }
25912
25933
  this.grid.refresh();
25913
25934
  }
25914
25935
  };
@@ -26083,10 +26104,10 @@ var PivotTableFacet = /** @class */ (function (_super) {
26083
26104
  total_row.push(totalByCol);
26084
26105
  }
26085
26106
  this.pivotTable.addRow(total_row);
26086
- this.contentDiv.classList.add('pivot-grid-totals-row');
26107
+ this.contentDiv.classList.add('pivot-grid-with-totals');
26087
26108
  }
26088
26109
  else {
26089
- this.contentDiv.classList.remove('pivot-grid-totals-row');
26110
+ this.contentDiv.classList.remove('pivot-grid-with-totals');
26090
26111
  }
26091
26112
  };
26092
26113
  PivotTableFacet.prototype.calcAggrFunc = function (func, options) {
@@ -30576,7 +30597,7 @@ var EasyGrid = /** @class */ (function () {
30576
30597
  default: 60
30577
30598
  }
30578
30599
  },
30579
- addColumns: false,
30600
+ showPlusButton: false,
30580
30601
  viewportRowsCount: null,
30581
30602
  showActiveRow: true
30582
30603
  };
@@ -30675,8 +30696,8 @@ var EasyGrid = /** @class */ (function () {
30675
30696
  if (options.onRowDbClick) {
30676
30697
  this.addEventListener('rowDbClick', options.onRowDbClick);
30677
30698
  }
30678
- if (options.onAddColumnClick) {
30679
- this.addEventListener('addColumnClick', options.onAddColumnClick);
30699
+ if (options.onPlusButtonClick) {
30700
+ this.addEventListener('plusButtonClick', options.onPlusButtonClick);
30680
30701
  }
30681
30702
  if (options.onColumnChanged) {
30682
30703
  this.addEventListener('columnChanged', options.onColumnChanged);
@@ -30762,7 +30783,7 @@ var EasyGrid = /** @class */ (function () {
30762
30783
  };
30763
30784
  EasyGrid.prototype.render = function () {
30764
30785
  var _this = this;
30765
- if (!this.hasData() && !this.options.addColumns)
30786
+ if (!this.hasData() && !this.options.showPlusButton)
30766
30787
  return;
30767
30788
  this.containerInitialHeight = this.slot.clientHeight;
30768
30789
  this.rootDiv = document.createElement('div');
@@ -30810,14 +30831,14 @@ var EasyGrid = /** @class */ (function () {
30810
30831
  var firstRow = _this.bodyCellContainerDiv.firstElementChild;
30811
30832
  var rowHeight = firstRow ? firstRow.offsetHeight : DEFAULT_ROW_HEIGHT;
30812
30833
  var rowCount = _this.options.viewportRowsCount; // || DEFAULT_ROW_COUNT;
30813
- var bodyHeight_1 = rowHeight * rowCount;
30814
- Object(_utils_dom_elem_builder__WEBPACK_IMPORTED_MODULE_2__[/* domel */ "e"])(_this.bodyDiv)
30815
- .setStyle('height', bodyHeight_1 + "px");
30834
+ var viewportHeight_1 = rowHeight * rowCount;
30835
+ Object(_utils_dom_elem_builder__WEBPACK_IMPORTED_MODULE_2__[/* domel */ "e"])(_this.bodyViewportDiv)
30836
+ .setStyle('height', viewportHeight_1 + "px");
30816
30837
  setTimeout(function () {
30817
30838
  var sbHeight = _this.bodyViewportDiv.offsetHeight - _this.bodyViewportDiv.clientHeight;
30818
- bodyHeight_1 = bodyHeight_1 + sbHeight;
30819
- Object(_utils_dom_elem_builder__WEBPACK_IMPORTED_MODULE_2__[/* domel */ "e"])(_this.bodyDiv)
30820
- .setStyle('height', bodyHeight_1 + "px");
30839
+ viewportHeight_1 = viewportHeight_1 + sbHeight;
30840
+ Object(_utils_dom_elem_builder__WEBPACK_IMPORTED_MODULE_2__[/* domel */ "e"])(_this.bodyViewportDiv)
30841
+ .setStyle('height', viewportHeight_1 + "px");
30821
30842
  resolve();
30822
30843
  }, 100);
30823
30844
  return;
@@ -30864,7 +30885,7 @@ var EasyGrid = /** @class */ (function () {
30864
30885
  _this.headerRowDiv.appendChild(hd);
30865
30886
  if (column.isRowNum) {
30866
30887
  Object(_utils_dom_elem_builder__WEBPACK_IMPORTED_MODULE_2__[/* domel */ "e"])(hd)
30867
- .addChildElement(_this.renderAddColumnButton());
30888
+ .addChildElement(_this.renderHeaderButtons());
30868
30889
  }
30869
30890
  });
30870
30891
  var containerWidth = this.getContainerWidth();
@@ -31203,23 +31224,26 @@ var EasyGrid = /** @class */ (function () {
31203
31224
  var pageInfoDiv = Object(_utils_dom_elem_builder__WEBPACK_IMPORTED_MODULE_2__[/* domel */ "e"])('div')
31204
31225
  .addClass(this.cssPrefix + "-page-info")
31205
31226
  .toDOM();
31206
- var fistPageRecordNum = count
31207
- ? (this.pagination.page - 1) * this.pagination.pageSize + 1
31208
- : 0;
31209
- var lastPageRecordNum = count
31210
- ? fistPageRecordNum + count - 1
31211
- : 0;
31212
- var totalStr = this.dataTable.getTotal().toString();
31213
- if (this.dataTable.elasticChunks) {
31214
- var count_1 = this.dataTable.getCachedCount();
31215
- var total = this.dataTable.getTotal();
31216
- if (count_1 !== total)
31217
- totalStr = '?';
31218
- }
31219
- pageInfoDiv.innerHTML = _easydata_core__WEBPACK_IMPORTED_MODULE_0__["i18n"].getText('GridPageInfo')
31220
- .replace('{FirstPageRecordNum}', "<span>" + fistPageRecordNum.toString() + "</span>")
31221
- .replace('{LastPageRecordNum}', "<span>" + lastPageRecordNum.toString() + "</span>")
31222
- .replace('{Total}', "<span>" + totalStr + "</span>");
31227
+ var rowCount = this.dataTable.getTotal();
31228
+ if (rowCount > 0) {
31229
+ var fistPageRecordNum = count
31230
+ ? (this.pagination.page - 1) * this.pagination.pageSize + 1
31231
+ : 0;
31232
+ var lastPageRecordNum = count
31233
+ ? fistPageRecordNum + count - 1
31234
+ : 0;
31235
+ var totalStr = this.dataTable.getTotal().toString();
31236
+ if (this.dataTable.elasticChunks) {
31237
+ var count_1 = this.dataTable.getCachedCount();
31238
+ var total = this.dataTable.getTotal();
31239
+ if (count_1 !== total)
31240
+ totalStr = '?';
31241
+ }
31242
+ pageInfoDiv.innerHTML = _easydata_core__WEBPACK_IMPORTED_MODULE_0__["i18n"].getText('GridPageInfo')
31243
+ .replace('{FirstPageRecordNum}', "<span>" + fistPageRecordNum.toString() + "</span>")
31244
+ .replace('{LastPageRecordNum}', "<span>" + lastPageRecordNum.toString() + "</span>")
31245
+ .replace('{Total}', "<span>" + totalStr + "</span>");
31246
+ }
31223
31247
  return pageInfoDiv;
31224
31248
  };
31225
31249
  EasyGrid.prototype.showProgress = function () {
@@ -31314,7 +31338,8 @@ var EasyGrid = /** @class */ (function () {
31314
31338
  var _this = this;
31315
31339
  var paginateDiv = document.createElement('div');
31316
31340
  paginateDiv.className = this.cssPrefix + "-pagination-wrapper";
31317
- if (this.options.paging && this.options.paging.enabled) {
31341
+ var rowCount = this.dataTable.getTotal();
31342
+ if (this.options.paging && this.options.paging.enabled && rowCount > 0) {
31318
31343
  var prefix_1 = this.paginationOptions.useBootstrap ? '' : this.cssPrefix + "-";
31319
31344
  var buttonClickHandler_1 = function (ev) {
31320
31345
  var element = ev.target;
@@ -31440,18 +31465,18 @@ var EasyGrid = /** @class */ (function () {
31440
31465
  EasyGrid.prototype.removeEventListener = function (eventType, handlerId) {
31441
31466
  this.eventEmitter.unsubscribe(eventType, handlerId);
31442
31467
  };
31443
- EasyGrid.prototype.renderAddColumnButton = function () {
31468
+ EasyGrid.prototype.renderHeaderButtons = function () {
31444
31469
  var _this = this;
31445
- if (this.options.addColumns) {
31470
+ if (this.options.showPlusButton) {
31446
31471
  return Object(_utils_dom_elem_builder__WEBPACK_IMPORTED_MODULE_2__[/* domel */ "e"])('div')
31447
- .addClass(this.cssPrefix + "-addrow")
31448
- .title(this.options.addColumnsTitle || 'Add column')
31472
+ .addClass(this.cssPrefix + "-header-btn-plus")
31473
+ .title(this.options.plusButtonTitle || 'Add')
31449
31474
  .addChild('a', function (builder) { return builder
31450
31475
  .attr('href', 'javascript:void(0)')
31451
31476
  .on('click', function (e) {
31452
31477
  e.preventDefault();
31453
31478
  _this.fireEvent({
31454
- type: 'addColumnClick',
31479
+ type: 'plusButtonClick',
31455
31480
  sourceEvent: e
31456
31481
  });
31457
31482
  }); })
@@ -35568,6 +35593,7 @@ function addEasyQueryUITexts() {
35568
35593
  TabNameLabel: 'Tab name',
35569
35594
  ErrQueryChanged: 'FAILED TO DISPLAY. QUERY WAS CHANGED',
35570
35595
  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.",
35596
+ ErrTooMuchData: 'Too much data. The grid is not able to display it',
35571
35597
  Chart: {
35572
35598
  FacetTitle: 'Chart',
35573
35599
  DlgTitle: 'Chart settings',