@easyquery/ui 7.2.2-rc02 → 7.2.2-rc03

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.2-rc02 (https://korzh.com/easyquery/javascript)
2
+ * EasyQuery.JS Community 7.2.2-rc03 (https://korzh.com/easyquery/javascript)
3
3
  * Copyright 2022 Korzh.com. All rights reserved.
4
4
  *
5
5
  * EasyQuery.JS commercial licenses may be obtained at
@@ -2347,8 +2347,10 @@ var EqQueryFileLoader = /** @class */ (function () {
2347
2347
  var request = actionResult.getRequest();
2348
2348
  return actionResult.then(function (responseData) {
2349
2349
  var blob = new Blob([responseData]);
2350
- var fileName = request.getXMLHttpRequest()
2351
- .getResponseHeader("Content-Disposition").match(/filename="(.*)"/)[1];
2350
+ var dispositionHeader = request.getXMLHttpRequest().getResponseHeader("Content-Disposition");
2351
+ var fileName = dispositionHeader
2352
+ ? dispositionHeader.match(/filename="(.*)"/)[1]
2353
+ : 'query.json';
2352
2354
  if (options.fileName) {
2353
2355
  fileName = options.fileName
2354
2356
  + fileName.substring(fileName.lastIndexOf('.'));
@@ -2670,8 +2672,10 @@ var EqServerExporter = /** @class */ (function () {
2670
2672
  var request = actionResult.getRequest();
2671
2673
  return actionResult.then(function (responseData) {
2672
2674
  var blob = new Blob([responseData]);
2673
- var filename = request.getXMLHttpRequest()
2674
- .getResponseHeader("Content-Disposition").match(/filename="(.*)"/)[1];
2675
+ var dispositionHeader = request.getXMLHttpRequest().getResponseHeader("Content-Disposition");
2676
+ var filename = dispositionHeader
2677
+ ? dispositionHeader.match(/filename="(.*)"/)[1]
2678
+ : 'export-data.' + format;
2675
2679
  if (window.navigator['msSaveOrOpenBlob']) {
2676
2680
  // Internet Explorer
2677
2681
  window.navigator['msSaveOrOpenBlob'](blob, filename);
@@ -3804,7 +3808,7 @@ var context_EqContext = /** @class */ (function () {
3804
3808
  /**
3805
3809
  * Fetches the data (usuall by executing current query) and processes the result.
3806
3810
  * @param options
3807
- * The `options` parameter in addition to the options defined in ExecuteQueryOptions structure may also contain `success` and `error` callbacks.
3811
+ * The `options` parameter in addition to the options defined in FetchDataOptions structure may also contain `success` and `error` callbacks.
3808
3812
  * @example
3809
3813
  * context.fetchData({ success: function(result) {
3810
3814
  * //do whatever you want with the result
@@ -7286,7 +7290,7 @@ var i18n;
7286
7290
  }
7287
7291
  else if (['D', 'F', 'C'].indexOf(type) >= 0) {
7288
7292
  var locale = getCurrentLocale();
7289
- return number.toLocaleString(locale, getNumberFromatOptions(format));
7293
+ return number.toLocaleString(locale, getNumberFormatOptions(format));
7290
7294
  }
7291
7295
  else {
7292
7296
  return convertWithMask(Math.trunc(number), format);
@@ -7362,7 +7366,7 @@ var i18n;
7362
7366
  }
7363
7367
  return result.split('').reverse().join('');
7364
7368
  }
7365
- function getNumberFromatOptions(format) {
7369
+ function getNumberFormatOptions(format) {
7366
7370
  var localeSettings = getLocaleSettings();
7367
7371
  var type = format[0].toUpperCase();
7368
7372
  var digits = (format.length > 1)
@@ -7384,7 +7388,8 @@ var i18n;
7384
7388
  default:
7385
7389
  return {
7386
7390
  style: 'decimal',
7387
- minimumFractionDigits: digits
7391
+ minimumFractionDigits: digits,
7392
+ maximumFractionDigits: digits
7388
7393
  };
7389
7394
  }
7390
7395
  }
@@ -9218,19 +9223,23 @@ var ListExpressionRenderer = /** @class */ (function (_super) {
9218
9223
  return [this.expression.value];
9219
9224
  }
9220
9225
  else {
9221
- //splits value by ','
9222
- var res = this.expression.value.match(/"[^"\\]*(?:\\.[^"\\]*)*"|[^,]+/g);
9223
- return res
9224
- ? res.map(function (a) {
9225
- if (a.charAt(0) == '"' && a.charAt(a.length - 1) == '"') {
9226
- a = a.substring(1, a.length - 1);
9227
- return a.replace(/\"/g, '"');
9228
- }
9229
- else {
9230
- return a;
9231
- }
9232
- })
9233
- : [];
9226
+ if (this.expression.value) {
9227
+ //splits value by ','
9228
+ var res = this.expression.value.match(/"[^"\\]*(?:\\.[^"\\]*)*"|[^,]+/g);
9229
+ return res
9230
+ ? res.map(function (a) {
9231
+ if (a.charAt(0) == '"' && a.charAt(a.length - 1) == '"') {
9232
+ a = a.substring(1, a.length - 1);
9233
+ return a.replace(/\"/g, '"');
9234
+ }
9235
+ else {
9236
+ return a;
9237
+ }
9238
+ })
9239
+ : [];
9240
+ }
9241
+ else
9242
+ return [];
9234
9243
  }
9235
9244
  };
9236
9245
  ListExpressionRenderer.prototype.adjustNewValue = function (newValue) {
@@ -28886,6 +28895,14 @@ var HttpClient = /** @class */ (function () {
28886
28895
  this.defaultHeaders = {};
28887
28896
  this.customPayload = undefined;
28888
28897
  }
28898
+ Object.defineProperty(HttpClient.prototype, "responseBody", {
28899
+ /** Gets the response body for the latest request */
28900
+ get: function () {
28901
+ return this._responseBody;
28902
+ },
28903
+ enumerable: true,
28904
+ configurable: true
28905
+ });
28889
28906
  HttpClient.prototype.get = function (url, options) {
28890
28907
  return this.send(_http_method__WEBPACK_IMPORTED_MODULE_2__[/* HttpMethod */ "a"].Get, url, null, options);
28891
28908
  };
@@ -28899,6 +28916,7 @@ var HttpClient = /** @class */ (function () {
28899
28916
  return this.send(_http_method__WEBPACK_IMPORTED_MODULE_2__[/* HttpMethod */ "a"].Delete, url, data, options);
28900
28917
  };
28901
28918
  HttpClient.prototype.send = function (method, url, data, options) {
28919
+ var _this = this;
28902
28920
  options = options || {};
28903
28921
  var dataType = options.dataType || 'json';
28904
28922
  var contentType = options.contentType || (dataType !== 'form-data')
@@ -28954,6 +28972,10 @@ var HttpClient = /** @class */ (function () {
28954
28972
  : (responseContentType.indexOf('application/json') == 0
28955
28973
  ? JSON.parse(xhr.responseText)
28956
28974
  : xhr.responseText);
28975
+ _this._responseBody = responseObj;
28976
+ if (_this.onResponse) {
28977
+ _this.onResponse(xhr);
28978
+ }
28957
28979
  resolve(responseObj);
28958
28980
  }
28959
28981
  else {
@@ -28965,6 +28987,7 @@ var HttpClient = /** @class */ (function () {
28965
28987
  var responseObj = (responseContentType.indexOf('application/json') == 0)
28966
28988
  ? JSON.parse(responseText)
28967
28989
  : responseText;
28990
+ _this._responseBody = responseObj;
28968
28991
  var message = responseObj.message ||
28969
28992
  (status == 404
28970
28993
  ? "No such endpoint: " + url
@@ -30669,7 +30692,9 @@ var __spreadArrays = (undefined && undefined.__spreadArrays) || function () {
30669
30692
 
30670
30693
  var DEFAULT_ROW_HEIGHT = 36;
30671
30694
  var DEFAULT_ROW_COUNT = 15;
30695
+ /** Represents a grid widget with columns rows, paging, custom rendering and more */
30672
30696
  var EasyGrid = /** @class */ (function () {
30697
+ /** Creates and initializes all internal properties of the grid object */
30673
30698
  function EasyGrid(options) {
30674
30699
  this.cssPrefix = "keg";
30675
30700
  this.pagination = { page: 1, pageSize: 30, total: 0 };
@@ -30788,6 +30813,7 @@ var EasyGrid = /** @class */ (function () {
30788
30813
  widthOptions[dataType] = __assign(__assign({}, widthOptions.otherColumns), widthOptions[dataType]);
30789
30814
  }
30790
30815
  });
30816
+ widthOptions[_easydata_core__WEBPACK_IMPORTED_MODULE_0__["DataType"].Unknown] = widthOptions.otherColumns;
30791
30817
  };
30792
30818
  EasyGrid.prototype.setSlot = function (slot) {
30793
30819
  if (typeof slot === 'string') {
@@ -30810,6 +30836,7 @@ var EasyGrid = /** @class */ (function () {
30810
30836
  this.slot = slot;
30811
30837
  }
30812
30838
  };
30839
+ /** Initializes grid widget according to the options passed in the parameter */
30813
30840
  EasyGrid.prototype.init = function (options) {
30814
30841
  var _this = this;
30815
30842
  if (options.onInit) {
@@ -30873,6 +30900,10 @@ var EasyGrid = /** @class */ (function () {
30873
30900
  this.refresh();
30874
30901
  this.fireEvent('init');
30875
30902
  };
30903
+ /** Fires a grid event. You can pass either an event type
30904
+ * (like 'init', 'rowClick', 'pageChanged', etc )
30905
+ * or a ready-to-use grid event object
30906
+ * */
30876
30907
  EasyGrid.prototype.fireEvent = function (event) {
30877
30908
  if (typeof event === "string") {
30878
30909
  this.eventEmitter.fire(event);
@@ -30881,20 +30912,26 @@ var EasyGrid = /** @class */ (function () {
30881
30912
  this.eventEmitter.fire(event.type, event);
30882
30913
  }
30883
30914
  };
30915
+ /** Allows to set the data (represented by a EasyDataTable object)
30916
+ * or to replace the existing one associated with the grid */
30884
30917
  EasyGrid.prototype.setData = function (data) {
30885
30918
  this.dataTable = data;
30886
30919
  this.clear();
30887
30920
  this.refresh();
30888
30921
  };
30922
+ /** Returns the EasyDataTable object associated with the grid via `setData()` call */
30889
30923
  EasyGrid.prototype.getData = function () {
30890
30924
  return this.dataTable;
30891
30925
  };
30926
+ /** Gets the list of grid columns */
30892
30927
  EasyGrid.prototype.getColumns = function () {
30893
30928
  return this.columns;
30894
30929
  };
30930
+ /** This function is called when the grid is destroyed */
30895
30931
  EasyGrid.prototype.destroy = function () {
30896
30932
  this.slot.innerHTML = "";
30897
30933
  };
30934
+ /** Clears the current DOM object and re-renders everything from the scratch */
30898
30935
  EasyGrid.prototype.refresh = function () {
30899
30936
  this.clearDOM();
30900
30937
  this.render();
@@ -30902,10 +30939,12 @@ var EasyGrid = /** @class */ (function () {
30902
30939
  EasyGrid.prototype.clearDOM = function () {
30903
30940
  this.slot.innerHTML = '';
30904
30941
  };
30942
+ /** Clears all DOM object in the grid and return it to its initial state */
30905
30943
  EasyGrid.prototype.clear = function () {
30906
30944
  this.pagination.page = 1;
30907
30945
  this.clearDOM();
30908
30946
  };
30947
+ /** Renders the grid */
30909
30948
  EasyGrid.prototype.render = function () {
30910
30949
  var _this = this;
30911
30950
  if (!this.hasData() && !this.options.showPlusButton)
@@ -31460,6 +31499,7 @@ var EasyGrid = /** @class */ (function () {
31460
31499
  }
31461
31500
  return cellElement;
31462
31501
  };
31502
+ /** Sets current grid pages (if paging is used) */
31463
31503
  EasyGrid.prototype.setPage = function (page) {
31464
31504
  this.pagination.page = page;
31465
31505
  this.fireEvent({ type: "pageChanged", page: page });
@@ -31706,9 +31746,11 @@ var EasyGrid = /** @class */ (function () {
31706
31746
  return rows[index];
31707
31747
  return null;
31708
31748
  };
31749
+ /** Makes the grid focused for keyboard events */
31709
31750
  EasyGrid.prototype.focus = function () {
31710
31751
  this.bodyViewportDiv.focus();
31711
31752
  };
31753
+ /** Resizes columns according to the data they represent */
31712
31754
  EasyGrid.prototype.resizeColumns = function () {
31713
31755
  if (this.options.columnWidths.autoResize === _easy_grid_options__WEBPACK_IMPORTED_MODULE_4__[/* AutoResizeColumns */ "a"].Never)
31714
31756
  return;