@easyquery/enterprise 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 Enterprise 7.2.2-rc02 (https://korzh.com/easyquery/javascript)
2
+ * EasyQuery.JS Enterprise 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
@@ -2348,8 +2348,10 @@ var EqQueryFileLoader = /** @class */ (function () {
2348
2348
  var request = actionResult.getRequest();
2349
2349
  return actionResult.then(function (responseData) {
2350
2350
  var blob = new Blob([responseData]);
2351
- var fileName = request.getXMLHttpRequest()
2352
- .getResponseHeader("Content-Disposition").match(/filename="(.*)"/)[1];
2351
+ var dispositionHeader = request.getXMLHttpRequest().getResponseHeader("Content-Disposition");
2352
+ var fileName = dispositionHeader
2353
+ ? dispositionHeader.match(/filename="(.*)"/)[1]
2354
+ : 'query.json';
2353
2355
  if (options.fileName) {
2354
2356
  fileName = options.fileName
2355
2357
  + fileName.substring(fileName.lastIndexOf('.'));
@@ -2671,8 +2673,10 @@ var EqServerExporter = /** @class */ (function () {
2671
2673
  var request = actionResult.getRequest();
2672
2674
  return actionResult.then(function (responseData) {
2673
2675
  var blob = new Blob([responseData]);
2674
- var filename = request.getXMLHttpRequest()
2675
- .getResponseHeader("Content-Disposition").match(/filename="(.*)"/)[1];
2676
+ var dispositionHeader = request.getXMLHttpRequest().getResponseHeader("Content-Disposition");
2677
+ var filename = dispositionHeader
2678
+ ? dispositionHeader.match(/filename="(.*)"/)[1]
2679
+ : 'export-data.' + format;
2676
2680
  if (window.navigator['msSaveOrOpenBlob']) {
2677
2681
  // Internet Explorer
2678
2682
  window.navigator['msSaveOrOpenBlob'](blob, filename);
@@ -3805,7 +3809,7 @@ var context_EqContext = /** @class */ (function () {
3805
3809
  /**
3806
3810
  * Fetches the data (usuall by executing current query) and processes the result.
3807
3811
  * @param options
3808
- * The `options` parameter in addition to the options defined in ExecuteQueryOptions structure may also contain `success` and `error` callbacks.
3812
+ * The `options` parameter in addition to the options defined in FetchDataOptions structure may also contain `success` and `error` callbacks.
3809
3813
  * @example
3810
3814
  * context.fetchData({ success: function(result) {
3811
3815
  * //do whatever you want with the result
@@ -7287,7 +7291,7 @@ var i18n;
7287
7291
  }
7288
7292
  else if (['D', 'F', 'C'].indexOf(type) >= 0) {
7289
7293
  var locale = getCurrentLocale();
7290
- return number.toLocaleString(locale, getNumberFromatOptions(format));
7294
+ return number.toLocaleString(locale, getNumberFormatOptions(format));
7291
7295
  }
7292
7296
  else {
7293
7297
  return convertWithMask(Math.trunc(number), format);
@@ -7363,7 +7367,7 @@ var i18n;
7363
7367
  }
7364
7368
  return result.split('').reverse().join('');
7365
7369
  }
7366
- function getNumberFromatOptions(format) {
7370
+ function getNumberFormatOptions(format) {
7367
7371
  var localeSettings = getLocaleSettings();
7368
7372
  var type = format[0].toUpperCase();
7369
7373
  var digits = (format.length > 1)
@@ -7385,7 +7389,8 @@ var i18n;
7385
7389
  default:
7386
7390
  return {
7387
7391
  style: 'decimal',
7388
- minimumFractionDigits: digits
7392
+ minimumFractionDigits: digits,
7393
+ maximumFractionDigits: digits
7389
7394
  };
7390
7395
  }
7391
7396
  }
@@ -9219,19 +9224,23 @@ var ListExpressionRenderer = /** @class */ (function (_super) {
9219
9224
  return [this.expression.value];
9220
9225
  }
9221
9226
  else {
9222
- //splits value by ','
9223
- var res = this.expression.value.match(/"[^"\\]*(?:\\.[^"\\]*)*"|[^,]+/g);
9224
- return res
9225
- ? res.map(function (a) {
9226
- if (a.charAt(0) == '"' && a.charAt(a.length - 1) == '"') {
9227
- a = a.substring(1, a.length - 1);
9228
- return a.replace(/\"/g, '"');
9229
- }
9230
- else {
9231
- return a;
9232
- }
9233
- })
9234
- : [];
9227
+ if (this.expression.value) {
9228
+ //splits value by ','
9229
+ var res = this.expression.value.match(/"[^"\\]*(?:\\.[^"\\]*)*"|[^,]+/g);
9230
+ return res
9231
+ ? res.map(function (a) {
9232
+ if (a.charAt(0) == '"' && a.charAt(a.length - 1) == '"') {
9233
+ a = a.substring(1, a.length - 1);
9234
+ return a.replace(/\"/g, '"');
9235
+ }
9236
+ else {
9237
+ return a;
9238
+ }
9239
+ })
9240
+ : [];
9241
+ }
9242
+ else
9243
+ return [];
9235
9244
  }
9236
9245
  };
9237
9246
  ListExpressionRenderer.prototype.adjustNewValue = function (newValue) {
@@ -30181,6 +30190,14 @@ var HttpClient = /** @class */ (function () {
30181
30190
  this.defaultHeaders = {};
30182
30191
  this.customPayload = undefined;
30183
30192
  }
30193
+ Object.defineProperty(HttpClient.prototype, "responseBody", {
30194
+ /** Gets the response body for the latest request */
30195
+ get: function () {
30196
+ return this._responseBody;
30197
+ },
30198
+ enumerable: true,
30199
+ configurable: true
30200
+ });
30184
30201
  HttpClient.prototype.get = function (url, options) {
30185
30202
  return this.send(_http_method__WEBPACK_IMPORTED_MODULE_2__[/* HttpMethod */ "a"].Get, url, null, options);
30186
30203
  };
@@ -30194,6 +30211,7 @@ var HttpClient = /** @class */ (function () {
30194
30211
  return this.send(_http_method__WEBPACK_IMPORTED_MODULE_2__[/* HttpMethod */ "a"].Delete, url, data, options);
30195
30212
  };
30196
30213
  HttpClient.prototype.send = function (method, url, data, options) {
30214
+ var _this = this;
30197
30215
  options = options || {};
30198
30216
  var dataType = options.dataType || 'json';
30199
30217
  var contentType = options.contentType || (dataType !== 'form-data')
@@ -30249,6 +30267,10 @@ var HttpClient = /** @class */ (function () {
30249
30267
  : (responseContentType.indexOf('application/json') == 0
30250
30268
  ? JSON.parse(xhr.responseText)
30251
30269
  : xhr.responseText);
30270
+ _this._responseBody = responseObj;
30271
+ if (_this.onResponse) {
30272
+ _this.onResponse(xhr);
30273
+ }
30252
30274
  resolve(responseObj);
30253
30275
  }
30254
30276
  else {
@@ -30260,6 +30282,7 @@ var HttpClient = /** @class */ (function () {
30260
30282
  var responseObj = (responseContentType.indexOf('application/json') == 0)
30261
30283
  ? JSON.parse(responseText)
30262
30284
  : responseText;
30285
+ _this._responseBody = responseObj;
30263
30286
  var message = responseObj.message ||
30264
30287
  (status == 404
30265
30288
  ? "No such endpoint: " + url
@@ -31964,7 +31987,9 @@ var __spreadArrays = (undefined && undefined.__spreadArrays) || function () {
31964
31987
 
31965
31988
  var DEFAULT_ROW_HEIGHT = 36;
31966
31989
  var DEFAULT_ROW_COUNT = 15;
31990
+ /** Represents a grid widget with columns rows, paging, custom rendering and more */
31967
31991
  var EasyGrid = /** @class */ (function () {
31992
+ /** Creates and initializes all internal properties of the grid object */
31968
31993
  function EasyGrid(options) {
31969
31994
  this.cssPrefix = "keg";
31970
31995
  this.pagination = { page: 1, pageSize: 30, total: 0 };
@@ -32083,6 +32108,7 @@ var EasyGrid = /** @class */ (function () {
32083
32108
  widthOptions[dataType] = __assign(__assign({}, widthOptions.otherColumns), widthOptions[dataType]);
32084
32109
  }
32085
32110
  });
32111
+ widthOptions[_easydata_core__WEBPACK_IMPORTED_MODULE_0__["DataType"].Unknown] = widthOptions.otherColumns;
32086
32112
  };
32087
32113
  EasyGrid.prototype.setSlot = function (slot) {
32088
32114
  if (typeof slot === 'string') {
@@ -32105,6 +32131,7 @@ var EasyGrid = /** @class */ (function () {
32105
32131
  this.slot = slot;
32106
32132
  }
32107
32133
  };
32134
+ /** Initializes grid widget according to the options passed in the parameter */
32108
32135
  EasyGrid.prototype.init = function (options) {
32109
32136
  var _this = this;
32110
32137
  if (options.onInit) {
@@ -32168,6 +32195,10 @@ var EasyGrid = /** @class */ (function () {
32168
32195
  this.refresh();
32169
32196
  this.fireEvent('init');
32170
32197
  };
32198
+ /** Fires a grid event. You can pass either an event type
32199
+ * (like 'init', 'rowClick', 'pageChanged', etc )
32200
+ * or a ready-to-use grid event object
32201
+ * */
32171
32202
  EasyGrid.prototype.fireEvent = function (event) {
32172
32203
  if (typeof event === "string") {
32173
32204
  this.eventEmitter.fire(event);
@@ -32176,20 +32207,26 @@ var EasyGrid = /** @class */ (function () {
32176
32207
  this.eventEmitter.fire(event.type, event);
32177
32208
  }
32178
32209
  };
32210
+ /** Allows to set the data (represented by a EasyDataTable object)
32211
+ * or to replace the existing one associated with the grid */
32179
32212
  EasyGrid.prototype.setData = function (data) {
32180
32213
  this.dataTable = data;
32181
32214
  this.clear();
32182
32215
  this.refresh();
32183
32216
  };
32217
+ /** Returns the EasyDataTable object associated with the grid via `setData()` call */
32184
32218
  EasyGrid.prototype.getData = function () {
32185
32219
  return this.dataTable;
32186
32220
  };
32221
+ /** Gets the list of grid columns */
32187
32222
  EasyGrid.prototype.getColumns = function () {
32188
32223
  return this.columns;
32189
32224
  };
32225
+ /** This function is called when the grid is destroyed */
32190
32226
  EasyGrid.prototype.destroy = function () {
32191
32227
  this.slot.innerHTML = "";
32192
32228
  };
32229
+ /** Clears the current DOM object and re-renders everything from the scratch */
32193
32230
  EasyGrid.prototype.refresh = function () {
32194
32231
  this.clearDOM();
32195
32232
  this.render();
@@ -32197,10 +32234,12 @@ var EasyGrid = /** @class */ (function () {
32197
32234
  EasyGrid.prototype.clearDOM = function () {
32198
32235
  this.slot.innerHTML = '';
32199
32236
  };
32237
+ /** Clears all DOM object in the grid and return it to its initial state */
32200
32238
  EasyGrid.prototype.clear = function () {
32201
32239
  this.pagination.page = 1;
32202
32240
  this.clearDOM();
32203
32241
  };
32242
+ /** Renders the grid */
32204
32243
  EasyGrid.prototype.render = function () {
32205
32244
  var _this = this;
32206
32245
  if (!this.hasData() && !this.options.showPlusButton)
@@ -32755,6 +32794,7 @@ var EasyGrid = /** @class */ (function () {
32755
32794
  }
32756
32795
  return cellElement;
32757
32796
  };
32797
+ /** Sets current grid pages (if paging is used) */
32758
32798
  EasyGrid.prototype.setPage = function (page) {
32759
32799
  this.pagination.page = page;
32760
32800
  this.fireEvent({ type: "pageChanged", page: page });
@@ -33001,9 +33041,11 @@ var EasyGrid = /** @class */ (function () {
33001
33041
  return rows[index];
33002
33042
  return null;
33003
33043
  };
33044
+ /** Makes the grid focused for keyboard events */
33004
33045
  EasyGrid.prototype.focus = function () {
33005
33046
  this.bodyViewportDiv.focus();
33006
33047
  };
33048
+ /** Resizes columns according to the data they represent */
33007
33049
  EasyGrid.prototype.resizeColumns = function () {
33008
33050
  if (this.options.columnWidths.autoResize === _easy_grid_options__WEBPACK_IMPORTED_MODULE_4__[/* AutoResizeColumns */ "a"].Never)
33009
33051
  return;