@easyquery/enterprise 7.2.2-rc01 → 7.2.2-rc04

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-rc01 (https://korzh.com/easyquery/javascript)
2
+ * EasyQuery.JS Enterprise 7.2.2-rc04 (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
@@ -295,7 +295,8 @@ var meta_entity_MetaEntityAttr = /** @class */ (function () {
295
295
  this.lookupEntity = dto.lent;
296
296
  this.dataAttr = dto.dattr;
297
297
  this.lookupDataAttr = dto.ldattr;
298
- this.defaultValue = dto.defVal;
298
+ var isDataType = utils["a" /* utils */].getDateDataTypes().indexOf(this.dataType);
299
+ this.defaultValue = dto.defVal && isDataType ? new Date(dto.defVal) : dto.defVal;
299
300
  this.isNullable = utils["a" /* utils */].getIfDefined(dto.nul, this.isNullable);
300
301
  this.isEditable = utils["a" /* utils */].getIfDefined(dto.ied, this.isEditable);
301
302
  this.showOnView = utils["a" /* utils */].getIfDefined(dto.ivis || dto.sov, this.showOnView);
@@ -2347,8 +2348,10 @@ var EqQueryFileLoader = /** @class */ (function () {
2347
2348
  var request = actionResult.getRequest();
2348
2349
  return actionResult.then(function (responseData) {
2349
2350
  var blob = new Blob([responseData]);
2350
- var fileName = request.getXMLHttpRequest()
2351
- .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';
2352
2355
  if (options.fileName) {
2353
2356
  fileName = options.fileName
2354
2357
  + fileName.substring(fileName.lastIndexOf('.'));
@@ -2662,13 +2665,18 @@ var EqServerExporter = /** @class */ (function () {
2662
2665
  else {
2663
2666
  requestData.query = query.toJSONData();
2664
2667
  }
2668
+ if (exportOptions.data) {
2669
+ requestData.data = exportOptions.data;
2670
+ }
2665
2671
  var url = this.context.resolveEndpoint('ExportResult', { modelId: modelId, format: format });
2666
2672
  var actionResult = http.post(url, requestData, { responseType: this.responseType });
2667
2673
  var request = actionResult.getRequest();
2668
2674
  return actionResult.then(function (responseData) {
2669
2675
  var blob = new Blob([responseData]);
2670
- var filename = request.getXMLHttpRequest()
2671
- .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;
2672
2680
  if (window.navigator['msSaveOrOpenBlob']) {
2673
2681
  // Internet Explorer
2674
2682
  window.navigator['msSaveOrOpenBlob'](blob, filename);
@@ -3801,7 +3809,7 @@ var context_EqContext = /** @class */ (function () {
3801
3809
  /**
3802
3810
  * Fetches the data (usuall by executing current query) and processes the result.
3803
3811
  * @param options
3804
- * 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.
3805
3813
  * @example
3806
3814
  * context.fetchData({ success: function(result) {
3807
3815
  * //do whatever you want with the result
@@ -7283,7 +7291,7 @@ var i18n;
7283
7291
  }
7284
7292
  else if (['D', 'F', 'C'].indexOf(type) >= 0) {
7285
7293
  var locale = getCurrentLocale();
7286
- return number.toLocaleString(locale, getNumberFromatOptions(format));
7294
+ return number.toLocaleString(locale, getNumberFormatOptions(format));
7287
7295
  }
7288
7296
  else {
7289
7297
  return convertWithMask(Math.trunc(number), format);
@@ -7359,7 +7367,7 @@ var i18n;
7359
7367
  }
7360
7368
  return result.split('').reverse().join('');
7361
7369
  }
7362
- function getNumberFromatOptions(format) {
7370
+ function getNumberFormatOptions(format) {
7363
7371
  var localeSettings = getLocaleSettings();
7364
7372
  var type = format[0].toUpperCase();
7365
7373
  var digits = (format.length > 1)
@@ -7381,7 +7389,8 @@ var i18n;
7381
7389
  default:
7382
7390
  return {
7383
7391
  style: 'decimal',
7384
- minimumFractionDigits: digits
7392
+ minimumFractionDigits: digits,
7393
+ maximumFractionDigits: digits
7385
7394
  };
7386
7395
  }
7387
7396
  }
@@ -9215,19 +9224,23 @@ var ListExpressionRenderer = /** @class */ (function (_super) {
9215
9224
  return [this.expression.value];
9216
9225
  }
9217
9226
  else {
9218
- //splits value by ','
9219
- var res = this.expression.value.match(/"[^"\\]*(?:\\.[^"\\]*)*"|[^,]+/g);
9220
- return res
9221
- ? res.map(function (a) {
9222
- if (a.charAt(0) == '"' && a.charAt(a.length - 1) == '"') {
9223
- a = a.substring(1, a.length - 1);
9224
- return a.replace(/\"/g, '"');
9225
- }
9226
- else {
9227
- return a;
9228
- }
9229
- })
9230
- : [];
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 [];
9231
9244
  }
9232
9245
  };
9233
9246
  ListExpressionRenderer.prototype.adjustNewValue = function (newValue) {
@@ -14224,7 +14237,7 @@ var CellRendererType;
14224
14237
  })(CellRendererType || (CellRendererType = {}));
14225
14238
  var StringCellRendererDefault = function (value, column, cellValueElement, rowElement) {
14226
14239
  var text = value ? value.toString().replace(/\n/g, '\u21B5 ') : '';
14227
- cellValueElement.innerHTML = text;
14240
+ cellValueElement.innerText = text;
14228
14241
  cellValueElement.title = text;
14229
14242
  if (column.align == _easy_grid_columns__WEBPACK_IMPORTED_MODULE_1__[/* GridColumnAlign */ "b"].NONE) {
14230
14243
  cellValueElement.classList.add(cssPrefix + "-cell-value-align-left");
@@ -14243,7 +14256,7 @@ var NumberCellRendererDefault = function (value, column, cellValueElement, rowEl
14243
14256
  strValue = value.toLocaleString();
14244
14257
  }
14245
14258
  }
14246
- cellValueElement.innerHTML = strValue;
14259
+ cellValueElement.innerText = strValue;
14247
14260
  cellValueElement.title = strValue;
14248
14261
  if (column.align == _easy_grid_columns__WEBPACK_IMPORTED_MODULE_1__[/* GridColumnAlign */ "b"].NONE) {
14249
14262
  cellValueElement.classList.add(cssPrefix + "-cell-value-align-right");
@@ -14275,7 +14288,7 @@ var DateTimeCellRendererDefault = function (value, column, cellValueElement, row
14275
14288
  }
14276
14289
  }
14277
14290
  }
14278
- cellValueElement.innerHTML = strValue;
14291
+ cellValueElement.innerText = strValue;
14279
14292
  cellValueElement.title = strValue;
14280
14293
  if (column.align == _easy_grid_columns__WEBPACK_IMPORTED_MODULE_1__[/* GridColumnAlign */ "b"].NONE) {
14281
14294
  cellValueElement.classList.add(cssPrefix + "-cell-value-align-right");
@@ -30177,6 +30190,14 @@ var HttpClient = /** @class */ (function () {
30177
30190
  this.defaultHeaders = {};
30178
30191
  this.customPayload = undefined;
30179
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
+ });
30180
30201
  HttpClient.prototype.get = function (url, options) {
30181
30202
  return this.send(_http_method__WEBPACK_IMPORTED_MODULE_2__[/* HttpMethod */ "a"].Get, url, null, options);
30182
30203
  };
@@ -30190,6 +30211,7 @@ var HttpClient = /** @class */ (function () {
30190
30211
  return this.send(_http_method__WEBPACK_IMPORTED_MODULE_2__[/* HttpMethod */ "a"].Delete, url, data, options);
30191
30212
  };
30192
30213
  HttpClient.prototype.send = function (method, url, data, options) {
30214
+ var _this = this;
30193
30215
  options = options || {};
30194
30216
  var dataType = options.dataType || 'json';
30195
30217
  var contentType = options.contentType || (dataType !== 'form-data')
@@ -30245,6 +30267,10 @@ var HttpClient = /** @class */ (function () {
30245
30267
  : (responseContentType.indexOf('application/json') == 0
30246
30268
  ? JSON.parse(xhr.responseText)
30247
30269
  : xhr.responseText);
30270
+ _this._responseBody = responseObj;
30271
+ if (_this.onResponse) {
30272
+ _this.onResponse(xhr);
30273
+ }
30248
30274
  resolve(responseObj);
30249
30275
  }
30250
30276
  else {
@@ -30256,6 +30282,7 @@ var HttpClient = /** @class */ (function () {
30256
30282
  var responseObj = (responseContentType.indexOf('application/json') == 0)
30257
30283
  ? JSON.parse(responseText)
30258
30284
  : responseText;
30285
+ _this._responseBody = responseObj;
30259
30286
  var message = responseObj.message ||
30260
30287
  (status == 404
30261
30288
  ? "No such endpoint: " + url
@@ -31960,7 +31987,9 @@ var __spreadArrays = (undefined && undefined.__spreadArrays) || function () {
31960
31987
 
31961
31988
  var DEFAULT_ROW_HEIGHT = 36;
31962
31989
  var DEFAULT_ROW_COUNT = 15;
31990
+ /** Represents a grid widget with columns rows, paging, custom rendering and more */
31963
31991
  var EasyGrid = /** @class */ (function () {
31992
+ /** Creates and initializes all internal properties of the grid object */
31964
31993
  function EasyGrid(options) {
31965
31994
  this.cssPrefix = "keg";
31966
31995
  this.pagination = { page: 1, pageSize: 30, total: 0 };
@@ -32079,6 +32108,7 @@ var EasyGrid = /** @class */ (function () {
32079
32108
  widthOptions[dataType] = __assign(__assign({}, widthOptions.otherColumns), widthOptions[dataType]);
32080
32109
  }
32081
32110
  });
32111
+ widthOptions[_easydata_core__WEBPACK_IMPORTED_MODULE_0__["DataType"].Unknown] = widthOptions.otherColumns;
32082
32112
  };
32083
32113
  EasyGrid.prototype.setSlot = function (slot) {
32084
32114
  if (typeof slot === 'string') {
@@ -32101,6 +32131,7 @@ var EasyGrid = /** @class */ (function () {
32101
32131
  this.slot = slot;
32102
32132
  }
32103
32133
  };
32134
+ /** Initializes grid widget according to the options passed in the parameter */
32104
32135
  EasyGrid.prototype.init = function (options) {
32105
32136
  var _this = this;
32106
32137
  if (options.onInit) {
@@ -32164,6 +32195,10 @@ var EasyGrid = /** @class */ (function () {
32164
32195
  this.refresh();
32165
32196
  this.fireEvent('init');
32166
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
+ * */
32167
32202
  EasyGrid.prototype.fireEvent = function (event) {
32168
32203
  if (typeof event === "string") {
32169
32204
  this.eventEmitter.fire(event);
@@ -32172,20 +32207,26 @@ var EasyGrid = /** @class */ (function () {
32172
32207
  this.eventEmitter.fire(event.type, event);
32173
32208
  }
32174
32209
  };
32210
+ /** Allows to set the data (represented by a EasyDataTable object)
32211
+ * or to replace the existing one associated with the grid */
32175
32212
  EasyGrid.prototype.setData = function (data) {
32176
32213
  this.dataTable = data;
32177
32214
  this.clear();
32178
32215
  this.refresh();
32179
32216
  };
32217
+ /** Returns the EasyDataTable object associated with the grid via `setData()` call */
32180
32218
  EasyGrid.prototype.getData = function () {
32181
32219
  return this.dataTable;
32182
32220
  };
32221
+ /** Gets the list of grid columns */
32183
32222
  EasyGrid.prototype.getColumns = function () {
32184
32223
  return this.columns;
32185
32224
  };
32225
+ /** This function is called when the grid is destroyed */
32186
32226
  EasyGrid.prototype.destroy = function () {
32187
32227
  this.slot.innerHTML = "";
32188
32228
  };
32229
+ /** Clears the current DOM object and re-renders everything from the scratch */
32189
32230
  EasyGrid.prototype.refresh = function () {
32190
32231
  this.clearDOM();
32191
32232
  this.render();
@@ -32193,10 +32234,12 @@ var EasyGrid = /** @class */ (function () {
32193
32234
  EasyGrid.prototype.clearDOM = function () {
32194
32235
  this.slot.innerHTML = '';
32195
32236
  };
32237
+ /** Clears all DOM object in the grid and return it to its initial state */
32196
32238
  EasyGrid.prototype.clear = function () {
32197
32239
  this.pagination.page = 1;
32198
32240
  this.clearDOM();
32199
32241
  };
32242
+ /** Renders the grid */
32200
32243
  EasyGrid.prototype.render = function () {
32201
32244
  var _this = this;
32202
32245
  if (!this.hasData() && !this.options.showPlusButton)
@@ -32751,6 +32794,7 @@ var EasyGrid = /** @class */ (function () {
32751
32794
  }
32752
32795
  return cellElement;
32753
32796
  };
32797
+ /** Sets current grid pages (if paging is used) */
32754
32798
  EasyGrid.prototype.setPage = function (page) {
32755
32799
  this.pagination.page = page;
32756
32800
  this.fireEvent({ type: "pageChanged", page: page });
@@ -32997,9 +33041,11 @@ var EasyGrid = /** @class */ (function () {
32997
33041
  return rows[index];
32998
33042
  return null;
32999
33043
  };
33044
+ /** Makes the grid focused for keyboard events */
33000
33045
  EasyGrid.prototype.focus = function () {
33001
33046
  this.bodyViewportDiv.focus();
33002
33047
  };
33048
+ /** Resizes columns according to the data they represent */
33003
33049
  EasyGrid.prototype.resizeColumns = function () {
33004
33050
  if (this.options.columnWidths.autoResize === _easy_grid_options__WEBPACK_IMPORTED_MODULE_4__[/* AutoResizeColumns */ "a"].Never)
33005
33051
  return;