@easyquery/ui 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 Community 7.2.2-rc01 (https://korzh.com/easyquery/javascript)
2
+ * EasyQuery.JS Community 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
@@ -294,7 +294,8 @@ var meta_entity_MetaEntityAttr = /** @class */ (function () {
294
294
  this.lookupEntity = dto.lent;
295
295
  this.dataAttr = dto.dattr;
296
296
  this.lookupDataAttr = dto.ldattr;
297
- this.defaultValue = dto.defVal;
297
+ var isDataType = utils["a" /* utils */].getDateDataTypes().indexOf(this.dataType);
298
+ this.defaultValue = dto.defVal && isDataType ? new Date(dto.defVal) : dto.defVal;
298
299
  this.isNullable = utils["a" /* utils */].getIfDefined(dto.nul, this.isNullable);
299
300
  this.isEditable = utils["a" /* utils */].getIfDefined(dto.ied, this.isEditable);
300
301
  this.showOnView = utils["a" /* utils */].getIfDefined(dto.ivis || dto.sov, this.showOnView);
@@ -2346,8 +2347,10 @@ var EqQueryFileLoader = /** @class */ (function () {
2346
2347
  var request = actionResult.getRequest();
2347
2348
  return actionResult.then(function (responseData) {
2348
2349
  var blob = new Blob([responseData]);
2349
- var fileName = request.getXMLHttpRequest()
2350
- .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';
2351
2354
  if (options.fileName) {
2352
2355
  fileName = options.fileName
2353
2356
  + fileName.substring(fileName.lastIndexOf('.'));
@@ -2661,13 +2664,18 @@ var EqServerExporter = /** @class */ (function () {
2661
2664
  else {
2662
2665
  requestData.query = query.toJSONData();
2663
2666
  }
2667
+ if (exportOptions.data) {
2668
+ requestData.data = exportOptions.data;
2669
+ }
2664
2670
  var url = this.context.resolveEndpoint('ExportResult', { modelId: modelId, format: format });
2665
2671
  var actionResult = http.post(url, requestData, { responseType: this.responseType });
2666
2672
  var request = actionResult.getRequest();
2667
2673
  return actionResult.then(function (responseData) {
2668
2674
  var blob = new Blob([responseData]);
2669
- var filename = request.getXMLHttpRequest()
2670
- .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;
2671
2679
  if (window.navigator['msSaveOrOpenBlob']) {
2672
2680
  // Internet Explorer
2673
2681
  window.navigator['msSaveOrOpenBlob'](blob, filename);
@@ -3800,7 +3808,7 @@ var context_EqContext = /** @class */ (function () {
3800
3808
  /**
3801
3809
  * Fetches the data (usuall by executing current query) and processes the result.
3802
3810
  * @param options
3803
- * 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.
3804
3812
  * @example
3805
3813
  * context.fetchData({ success: function(result) {
3806
3814
  * //do whatever you want with the result
@@ -7282,7 +7290,7 @@ var i18n;
7282
7290
  }
7283
7291
  else if (['D', 'F', 'C'].indexOf(type) >= 0) {
7284
7292
  var locale = getCurrentLocale();
7285
- return number.toLocaleString(locale, getNumberFromatOptions(format));
7293
+ return number.toLocaleString(locale, getNumberFormatOptions(format));
7286
7294
  }
7287
7295
  else {
7288
7296
  return convertWithMask(Math.trunc(number), format);
@@ -7358,7 +7366,7 @@ var i18n;
7358
7366
  }
7359
7367
  return result.split('').reverse().join('');
7360
7368
  }
7361
- function getNumberFromatOptions(format) {
7369
+ function getNumberFormatOptions(format) {
7362
7370
  var localeSettings = getLocaleSettings();
7363
7371
  var type = format[0].toUpperCase();
7364
7372
  var digits = (format.length > 1)
@@ -7380,7 +7388,8 @@ var i18n;
7380
7388
  default:
7381
7389
  return {
7382
7390
  style: 'decimal',
7383
- minimumFractionDigits: digits
7391
+ minimumFractionDigits: digits,
7392
+ maximumFractionDigits: digits
7384
7393
  };
7385
7394
  }
7386
7395
  }
@@ -9214,19 +9223,23 @@ var ListExpressionRenderer = /** @class */ (function (_super) {
9214
9223
  return [this.expression.value];
9215
9224
  }
9216
9225
  else {
9217
- //splits value by ','
9218
- var res = this.expression.value.match(/"[^"\\]*(?:\\.[^"\\]*)*"|[^,]+/g);
9219
- return res
9220
- ? res.map(function (a) {
9221
- if (a.charAt(0) == '"' && a.charAt(a.length - 1) == '"') {
9222
- a = a.substring(1, a.length - 1);
9223
- return a.replace(/\"/g, '"');
9224
- }
9225
- else {
9226
- return a;
9227
- }
9228
- })
9229
- : [];
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 [];
9230
9243
  }
9231
9244
  };
9232
9245
  ListExpressionRenderer.prototype.adjustNewValue = function (newValue) {
@@ -14223,7 +14236,7 @@ var CellRendererType;
14223
14236
  })(CellRendererType || (CellRendererType = {}));
14224
14237
  var StringCellRendererDefault = function (value, column, cellValueElement, rowElement) {
14225
14238
  var text = value ? value.toString().replace(/\n/g, '\u21B5 ') : '';
14226
- cellValueElement.innerHTML = text;
14239
+ cellValueElement.innerText = text;
14227
14240
  cellValueElement.title = text;
14228
14241
  if (column.align == _easy_grid_columns__WEBPACK_IMPORTED_MODULE_1__[/* GridColumnAlign */ "b"].NONE) {
14229
14242
  cellValueElement.classList.add(cssPrefix + "-cell-value-align-left");
@@ -14242,7 +14255,7 @@ var NumberCellRendererDefault = function (value, column, cellValueElement, rowEl
14242
14255
  strValue = value.toLocaleString();
14243
14256
  }
14244
14257
  }
14245
- cellValueElement.innerHTML = strValue;
14258
+ cellValueElement.innerText = strValue;
14246
14259
  cellValueElement.title = strValue;
14247
14260
  if (column.align == _easy_grid_columns__WEBPACK_IMPORTED_MODULE_1__[/* GridColumnAlign */ "b"].NONE) {
14248
14261
  cellValueElement.classList.add(cssPrefix + "-cell-value-align-right");
@@ -14274,7 +14287,7 @@ var DateTimeCellRendererDefault = function (value, column, cellValueElement, row
14274
14287
  }
14275
14288
  }
14276
14289
  }
14277
- cellValueElement.innerHTML = strValue;
14290
+ cellValueElement.innerText = strValue;
14278
14291
  cellValueElement.title = strValue;
14279
14292
  if (column.align == _easy_grid_columns__WEBPACK_IMPORTED_MODULE_1__[/* GridColumnAlign */ "b"].NONE) {
14280
14293
  cellValueElement.classList.add(cssPrefix + "-cell-value-align-right");
@@ -28882,6 +28895,14 @@ var HttpClient = /** @class */ (function () {
28882
28895
  this.defaultHeaders = {};
28883
28896
  this.customPayload = undefined;
28884
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
+ });
28885
28906
  HttpClient.prototype.get = function (url, options) {
28886
28907
  return this.send(_http_method__WEBPACK_IMPORTED_MODULE_2__[/* HttpMethod */ "a"].Get, url, null, options);
28887
28908
  };
@@ -28895,6 +28916,7 @@ var HttpClient = /** @class */ (function () {
28895
28916
  return this.send(_http_method__WEBPACK_IMPORTED_MODULE_2__[/* HttpMethod */ "a"].Delete, url, data, options);
28896
28917
  };
28897
28918
  HttpClient.prototype.send = function (method, url, data, options) {
28919
+ var _this = this;
28898
28920
  options = options || {};
28899
28921
  var dataType = options.dataType || 'json';
28900
28922
  var contentType = options.contentType || (dataType !== 'form-data')
@@ -28950,6 +28972,10 @@ var HttpClient = /** @class */ (function () {
28950
28972
  : (responseContentType.indexOf('application/json') == 0
28951
28973
  ? JSON.parse(xhr.responseText)
28952
28974
  : xhr.responseText);
28975
+ _this._responseBody = responseObj;
28976
+ if (_this.onResponse) {
28977
+ _this.onResponse(xhr);
28978
+ }
28953
28979
  resolve(responseObj);
28954
28980
  }
28955
28981
  else {
@@ -28961,6 +28987,7 @@ var HttpClient = /** @class */ (function () {
28961
28987
  var responseObj = (responseContentType.indexOf('application/json') == 0)
28962
28988
  ? JSON.parse(responseText)
28963
28989
  : responseText;
28990
+ _this._responseBody = responseObj;
28964
28991
  var message = responseObj.message ||
28965
28992
  (status == 404
28966
28993
  ? "No such endpoint: " + url
@@ -30665,7 +30692,9 @@ var __spreadArrays = (undefined && undefined.__spreadArrays) || function () {
30665
30692
 
30666
30693
  var DEFAULT_ROW_HEIGHT = 36;
30667
30694
  var DEFAULT_ROW_COUNT = 15;
30695
+ /** Represents a grid widget with columns rows, paging, custom rendering and more */
30668
30696
  var EasyGrid = /** @class */ (function () {
30697
+ /** Creates and initializes all internal properties of the grid object */
30669
30698
  function EasyGrid(options) {
30670
30699
  this.cssPrefix = "keg";
30671
30700
  this.pagination = { page: 1, pageSize: 30, total: 0 };
@@ -30784,6 +30813,7 @@ var EasyGrid = /** @class */ (function () {
30784
30813
  widthOptions[dataType] = __assign(__assign({}, widthOptions.otherColumns), widthOptions[dataType]);
30785
30814
  }
30786
30815
  });
30816
+ widthOptions[_easydata_core__WEBPACK_IMPORTED_MODULE_0__["DataType"].Unknown] = widthOptions.otherColumns;
30787
30817
  };
30788
30818
  EasyGrid.prototype.setSlot = function (slot) {
30789
30819
  if (typeof slot === 'string') {
@@ -30806,6 +30836,7 @@ var EasyGrid = /** @class */ (function () {
30806
30836
  this.slot = slot;
30807
30837
  }
30808
30838
  };
30839
+ /** Initializes grid widget according to the options passed in the parameter */
30809
30840
  EasyGrid.prototype.init = function (options) {
30810
30841
  var _this = this;
30811
30842
  if (options.onInit) {
@@ -30869,6 +30900,10 @@ var EasyGrid = /** @class */ (function () {
30869
30900
  this.refresh();
30870
30901
  this.fireEvent('init');
30871
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
+ * */
30872
30907
  EasyGrid.prototype.fireEvent = function (event) {
30873
30908
  if (typeof event === "string") {
30874
30909
  this.eventEmitter.fire(event);
@@ -30877,20 +30912,26 @@ var EasyGrid = /** @class */ (function () {
30877
30912
  this.eventEmitter.fire(event.type, event);
30878
30913
  }
30879
30914
  };
30915
+ /** Allows to set the data (represented by a EasyDataTable object)
30916
+ * or to replace the existing one associated with the grid */
30880
30917
  EasyGrid.prototype.setData = function (data) {
30881
30918
  this.dataTable = data;
30882
30919
  this.clear();
30883
30920
  this.refresh();
30884
30921
  };
30922
+ /** Returns the EasyDataTable object associated with the grid via `setData()` call */
30885
30923
  EasyGrid.prototype.getData = function () {
30886
30924
  return this.dataTable;
30887
30925
  };
30926
+ /** Gets the list of grid columns */
30888
30927
  EasyGrid.prototype.getColumns = function () {
30889
30928
  return this.columns;
30890
30929
  };
30930
+ /** This function is called when the grid is destroyed */
30891
30931
  EasyGrid.prototype.destroy = function () {
30892
30932
  this.slot.innerHTML = "";
30893
30933
  };
30934
+ /** Clears the current DOM object and re-renders everything from the scratch */
30894
30935
  EasyGrid.prototype.refresh = function () {
30895
30936
  this.clearDOM();
30896
30937
  this.render();
@@ -30898,10 +30939,12 @@ var EasyGrid = /** @class */ (function () {
30898
30939
  EasyGrid.prototype.clearDOM = function () {
30899
30940
  this.slot.innerHTML = '';
30900
30941
  };
30942
+ /** Clears all DOM object in the grid and return it to its initial state */
30901
30943
  EasyGrid.prototype.clear = function () {
30902
30944
  this.pagination.page = 1;
30903
30945
  this.clearDOM();
30904
30946
  };
30947
+ /** Renders the grid */
30905
30948
  EasyGrid.prototype.render = function () {
30906
30949
  var _this = this;
30907
30950
  if (!this.hasData() && !this.options.showPlusButton)
@@ -31456,6 +31499,7 @@ var EasyGrid = /** @class */ (function () {
31456
31499
  }
31457
31500
  return cellElement;
31458
31501
  };
31502
+ /** Sets current grid pages (if paging is used) */
31459
31503
  EasyGrid.prototype.setPage = function (page) {
31460
31504
  this.pagination.page = page;
31461
31505
  this.fireEvent({ type: "pageChanged", page: page });
@@ -31702,9 +31746,11 @@ var EasyGrid = /** @class */ (function () {
31702
31746
  return rows[index];
31703
31747
  return null;
31704
31748
  };
31749
+ /** Makes the grid focused for keyboard events */
31705
31750
  EasyGrid.prototype.focus = function () {
31706
31751
  this.bodyViewportDiv.focus();
31707
31752
  };
31753
+ /** Resizes columns according to the data they represent */
31708
31754
  EasyGrid.prototype.resizeColumns = function () {
31709
31755
  if (this.options.columnWidths.autoResize === _easy_grid_options__WEBPACK_IMPORTED_MODULE_4__[/* AutoResizeColumns */ "a"].Never)
31710
31756
  return;