@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
@@ -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
@@ -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
@@ -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
@@ -652,7 +652,7 @@ var i18n_i18n;
652
652
  }
653
653
  else if (['D', 'F', 'C'].indexOf(type) >= 0) {
654
654
  var locale = getCurrentLocale();
655
- return number.toLocaleString(locale, getNumberFromatOptions(format));
655
+ return number.toLocaleString(locale, getNumberFormatOptions(format));
656
656
  }
657
657
  else {
658
658
  return convertWithMask(Math.trunc(number), format);
@@ -728,7 +728,7 @@ var i18n_i18n;
728
728
  }
729
729
  return result.split('').reverse().join('');
730
730
  }
731
- function getNumberFromatOptions(format) {
731
+ function getNumberFormatOptions(format) {
732
732
  var localeSettings = getLocaleSettings();
733
733
  var type = format[0].toUpperCase();
734
734
  var digits = (format.length > 1)
@@ -750,7 +750,8 @@ var i18n_i18n;
750
750
  default:
751
751
  return {
752
752
  style: 'decimal',
753
- minimumFractionDigits: digits
753
+ minimumFractionDigits: digits,
754
+ maximumFractionDigits: digits
754
755
  };
755
756
  }
756
757
  }
@@ -1346,6 +1347,14 @@ var http_client_HttpClient = /** @class */ (function () {
1346
1347
  this.defaultHeaders = {};
1347
1348
  this.customPayload = undefined;
1348
1349
  }
1350
+ Object.defineProperty(HttpClient.prototype, "responseBody", {
1351
+ /** Gets the response body for the latest request */
1352
+ get: function () {
1353
+ return this._responseBody;
1354
+ },
1355
+ enumerable: true,
1356
+ configurable: true
1357
+ });
1349
1358
  HttpClient.prototype.get = function (url, options) {
1350
1359
  return this.send(HttpMethod.Get, url, null, options);
1351
1360
  };
@@ -1359,6 +1368,7 @@ var http_client_HttpClient = /** @class */ (function () {
1359
1368
  return this.send(HttpMethod.Delete, url, data, options);
1360
1369
  };
1361
1370
  HttpClient.prototype.send = function (method, url, data, options) {
1371
+ var _this = this;
1362
1372
  options = options || {};
1363
1373
  var dataType = options.dataType || 'json';
1364
1374
  var contentType = options.contentType || (dataType !== 'form-data')
@@ -1414,6 +1424,10 @@ var http_client_HttpClient = /** @class */ (function () {
1414
1424
  : (responseContentType.indexOf('application/json') == 0
1415
1425
  ? JSON.parse(xhr.responseText)
1416
1426
  : xhr.responseText);
1427
+ _this._responseBody = responseObj;
1428
+ if (_this.onResponse) {
1429
+ _this.onResponse(xhr);
1430
+ }
1417
1431
  resolve(responseObj);
1418
1432
  }
1419
1433
  else {
@@ -1425,6 +1439,7 @@ var http_client_HttpClient = /** @class */ (function () {
1425
1439
  var responseObj = (responseContentType.indexOf('application/json') == 0)
1426
1440
  ? JSON.parse(responseText)
1427
1441
  : responseText;
1442
+ _this._responseBody = responseObj;
1428
1443
  var message = responseObj.message ||
1429
1444
  (status == 404
1430
1445
  ? "No such endpoint: " + url
@@ -1574,7 +1589,8 @@ var meta_entity_MetaEntityAttr = /** @class */ (function () {
1574
1589
  this.lookupEntity = dto.lent;
1575
1590
  this.dataAttr = dto.dattr;
1576
1591
  this.lookupDataAttr = dto.ldattr;
1577
- this.defaultValue = dto.defVal;
1592
+ var isDataType = utils_utils.getDateDataTypes().indexOf(this.dataType);
1593
+ this.defaultValue = dto.defVal && isDataType ? new Date(dto.defVal) : dto.defVal;
1578
1594
  this.isNullable = utils_utils.getIfDefined(dto.nul, this.isNullable);
1579
1595
  this.isEditable = utils_utils.getIfDefined(dto.ied, this.isEditable);
1580
1596
  this.showOnView = utils_utils.getIfDefined(dto.ivis || dto.sov, this.showOnView);
@@ -4011,7 +4027,7 @@ var CellRendererType;
4011
4027
  })(CellRendererType || (CellRendererType = {}));
4012
4028
  var StringCellRendererDefault = function (value, column, cellValueElement, rowElement) {
4013
4029
  var text = value ? value.toString().replace(/\n/g, '\u21B5 ') : '';
4014
- cellValueElement.innerHTML = text;
4030
+ cellValueElement.innerText = text;
4015
4031
  cellValueElement.title = text;
4016
4032
  if (column.align == GridColumnAlign.NONE) {
4017
4033
  cellValueElement.classList.add(cssPrefix + "-cell-value-align-left");
@@ -4030,7 +4046,7 @@ var NumberCellRendererDefault = function (value, column, cellValueElement, rowEl
4030
4046
  strValue = value.toLocaleString();
4031
4047
  }
4032
4048
  }
4033
- cellValueElement.innerHTML = strValue;
4049
+ cellValueElement.innerText = strValue;
4034
4050
  cellValueElement.title = strValue;
4035
4051
  if (column.align == GridColumnAlign.NONE) {
4036
4052
  cellValueElement.classList.add(cssPrefix + "-cell-value-align-right");
@@ -4062,7 +4078,7 @@ var DateTimeCellRendererDefault = function (value, column, cellValueElement, row
4062
4078
  }
4063
4079
  }
4064
4080
  }
4065
- cellValueElement.innerHTML = strValue;
4081
+ cellValueElement.innerText = strValue;
4066
4082
  cellValueElement.title = strValue;
4067
4083
  if (column.align == GridColumnAlign.NONE) {
4068
4084
  cellValueElement.classList.add(cssPrefix + "-cell-value-align-right");
@@ -4321,7 +4337,9 @@ var easy_grid_spreadArrays = (undefined && undefined.__spreadArrays) || function
4321
4337
 
4322
4338
  var DEFAULT_ROW_HEIGHT = 36;
4323
4339
  var DEFAULT_ROW_COUNT = 15;
4340
+ /** Represents a grid widget with columns rows, paging, custom rendering and more */
4324
4341
  var easy_grid_EasyGrid = /** @class */ (function () {
4342
+ /** Creates and initializes all internal properties of the grid object */
4325
4343
  function EasyGrid(options) {
4326
4344
  this.cssPrefix = "keg";
4327
4345
  this.pagination = { page: 1, pageSize: 30, total: 0 };
@@ -4440,6 +4458,7 @@ var easy_grid_EasyGrid = /** @class */ (function () {
4440
4458
  widthOptions[dataType] = __assign(__assign({}, widthOptions.otherColumns), widthOptions[dataType]);
4441
4459
  }
4442
4460
  });
4461
+ widthOptions[public_api["d" /* DataType */].Unknown] = widthOptions.otherColumns;
4443
4462
  };
4444
4463
  EasyGrid.prototype.setSlot = function (slot) {
4445
4464
  if (typeof slot === 'string') {
@@ -4462,6 +4481,7 @@ var easy_grid_EasyGrid = /** @class */ (function () {
4462
4481
  this.slot = slot;
4463
4482
  }
4464
4483
  };
4484
+ /** Initializes grid widget according to the options passed in the parameter */
4465
4485
  EasyGrid.prototype.init = function (options) {
4466
4486
  var _this = this;
4467
4487
  if (options.onInit) {
@@ -4525,6 +4545,10 @@ var easy_grid_EasyGrid = /** @class */ (function () {
4525
4545
  this.refresh();
4526
4546
  this.fireEvent('init');
4527
4547
  };
4548
+ /** Fires a grid event. You can pass either an event type
4549
+ * (like 'init', 'rowClick', 'pageChanged', etc )
4550
+ * or a ready-to-use grid event object
4551
+ * */
4528
4552
  EasyGrid.prototype.fireEvent = function (event) {
4529
4553
  if (typeof event === "string") {
4530
4554
  this.eventEmitter.fire(event);
@@ -4533,20 +4557,26 @@ var easy_grid_EasyGrid = /** @class */ (function () {
4533
4557
  this.eventEmitter.fire(event.type, event);
4534
4558
  }
4535
4559
  };
4560
+ /** Allows to set the data (represented by a EasyDataTable object)
4561
+ * or to replace the existing one associated with the grid */
4536
4562
  EasyGrid.prototype.setData = function (data) {
4537
4563
  this.dataTable = data;
4538
4564
  this.clear();
4539
4565
  this.refresh();
4540
4566
  };
4567
+ /** Returns the EasyDataTable object associated with the grid via `setData()` call */
4541
4568
  EasyGrid.prototype.getData = function () {
4542
4569
  return this.dataTable;
4543
4570
  };
4571
+ /** Gets the list of grid columns */
4544
4572
  EasyGrid.prototype.getColumns = function () {
4545
4573
  return this.columns;
4546
4574
  };
4575
+ /** This function is called when the grid is destroyed */
4547
4576
  EasyGrid.prototype.destroy = function () {
4548
4577
  this.slot.innerHTML = "";
4549
4578
  };
4579
+ /** Clears the current DOM object and re-renders everything from the scratch */
4550
4580
  EasyGrid.prototype.refresh = function () {
4551
4581
  this.clearDOM();
4552
4582
  this.render();
@@ -4554,10 +4584,12 @@ var easy_grid_EasyGrid = /** @class */ (function () {
4554
4584
  EasyGrid.prototype.clearDOM = function () {
4555
4585
  this.slot.innerHTML = '';
4556
4586
  };
4587
+ /** Clears all DOM object in the grid and return it to its initial state */
4557
4588
  EasyGrid.prototype.clear = function () {
4558
4589
  this.pagination.page = 1;
4559
4590
  this.clearDOM();
4560
4591
  };
4592
+ /** Renders the grid */
4561
4593
  EasyGrid.prototype.render = function () {
4562
4594
  var _this = this;
4563
4595
  if (!this.hasData() && !this.options.showPlusButton)
@@ -5112,6 +5144,7 @@ var easy_grid_EasyGrid = /** @class */ (function () {
5112
5144
  }
5113
5145
  return cellElement;
5114
5146
  };
5147
+ /** Sets current grid pages (if paging is used) */
5115
5148
  EasyGrid.prototype.setPage = function (page) {
5116
5149
  this.pagination.page = page;
5117
5150
  this.fireEvent({ type: "pageChanged", page: page });
@@ -5358,9 +5391,11 @@ var easy_grid_EasyGrid = /** @class */ (function () {
5358
5391
  return rows[index];
5359
5392
  return null;
5360
5393
  };
5394
+ /** Makes the grid focused for keyboard events */
5361
5395
  EasyGrid.prototype.focus = function () {
5362
5396
  this.bodyViewportDiv.focus();
5363
5397
  };
5398
+ /** Resizes columns according to the data they represent */
5364
5399
  EasyGrid.prototype.resizeColumns = function () {
5365
5400
  if (this.options.columnWidths.autoResize === AutoResizeColumns.Never)
5366
5401
  return;
@@ -14274,19 +14309,23 @@ var list_expression_renderer_ListExpressionRenderer = /** @class */ (function (_
14274
14309
  return [this.expression.value];
14275
14310
  }
14276
14311
  else {
14277
- //splits value by ','
14278
- var res = this.expression.value.match(/"[^"\\]*(?:\\.[^"\\]*)*"|[^,]+/g);
14279
- return res
14280
- ? res.map(function (a) {
14281
- if (a.charAt(0) == '"' && a.charAt(a.length - 1) == '"') {
14282
- a = a.substring(1, a.length - 1);
14283
- return a.replace(/\"/g, '"');
14284
- }
14285
- else {
14286
- return a;
14287
- }
14288
- })
14289
- : [];
14312
+ if (this.expression.value) {
14313
+ //splits value by ','
14314
+ var res = this.expression.value.match(/"[^"\\]*(?:\\.[^"\\]*)*"|[^,]+/g);
14315
+ return res
14316
+ ? res.map(function (a) {
14317
+ if (a.charAt(0) == '"' && a.charAt(a.length - 1) == '"') {
14318
+ a = a.substring(1, a.length - 1);
14319
+ return a.replace(/\"/g, '"');
14320
+ }
14321
+ else {
14322
+ return a;
14323
+ }
14324
+ })
14325
+ : [];
14326
+ }
14327
+ else
14328
+ return [];
14290
14329
  }
14291
14330
  };
14292
14331
  ListExpressionRenderer.prototype.adjustNewValue = function (newValue) {