@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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -4322,7 +4337,9 @@ var easy_grid_spreadArrays = (undefined && undefined.__spreadArrays) || function
4322
4337
 
4323
4338
  var DEFAULT_ROW_HEIGHT = 36;
4324
4339
  var DEFAULT_ROW_COUNT = 15;
4340
+ /** Represents a grid widget with columns rows, paging, custom rendering and more */
4325
4341
  var easy_grid_EasyGrid = /** @class */ (function () {
4342
+ /** Creates and initializes all internal properties of the grid object */
4326
4343
  function EasyGrid(options) {
4327
4344
  this.cssPrefix = "keg";
4328
4345
  this.pagination = { page: 1, pageSize: 30, total: 0 };
@@ -4441,6 +4458,7 @@ var easy_grid_EasyGrid = /** @class */ (function () {
4441
4458
  widthOptions[dataType] = __assign(__assign({}, widthOptions.otherColumns), widthOptions[dataType]);
4442
4459
  }
4443
4460
  });
4461
+ widthOptions[public_api["d" /* DataType */].Unknown] = widthOptions.otherColumns;
4444
4462
  };
4445
4463
  EasyGrid.prototype.setSlot = function (slot) {
4446
4464
  if (typeof slot === 'string') {
@@ -4463,6 +4481,7 @@ var easy_grid_EasyGrid = /** @class */ (function () {
4463
4481
  this.slot = slot;
4464
4482
  }
4465
4483
  };
4484
+ /** Initializes grid widget according to the options passed in the parameter */
4466
4485
  EasyGrid.prototype.init = function (options) {
4467
4486
  var _this = this;
4468
4487
  if (options.onInit) {
@@ -4526,6 +4545,10 @@ var easy_grid_EasyGrid = /** @class */ (function () {
4526
4545
  this.refresh();
4527
4546
  this.fireEvent('init');
4528
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
+ * */
4529
4552
  EasyGrid.prototype.fireEvent = function (event) {
4530
4553
  if (typeof event === "string") {
4531
4554
  this.eventEmitter.fire(event);
@@ -4534,20 +4557,26 @@ var easy_grid_EasyGrid = /** @class */ (function () {
4534
4557
  this.eventEmitter.fire(event.type, event);
4535
4558
  }
4536
4559
  };
4560
+ /** Allows to set the data (represented by a EasyDataTable object)
4561
+ * or to replace the existing one associated with the grid */
4537
4562
  EasyGrid.prototype.setData = function (data) {
4538
4563
  this.dataTable = data;
4539
4564
  this.clear();
4540
4565
  this.refresh();
4541
4566
  };
4567
+ /** Returns the EasyDataTable object associated with the grid via `setData()` call */
4542
4568
  EasyGrid.prototype.getData = function () {
4543
4569
  return this.dataTable;
4544
4570
  };
4571
+ /** Gets the list of grid columns */
4545
4572
  EasyGrid.prototype.getColumns = function () {
4546
4573
  return this.columns;
4547
4574
  };
4575
+ /** This function is called when the grid is destroyed */
4548
4576
  EasyGrid.prototype.destroy = function () {
4549
4577
  this.slot.innerHTML = "";
4550
4578
  };
4579
+ /** Clears the current DOM object and re-renders everything from the scratch */
4551
4580
  EasyGrid.prototype.refresh = function () {
4552
4581
  this.clearDOM();
4553
4582
  this.render();
@@ -4555,10 +4584,12 @@ var easy_grid_EasyGrid = /** @class */ (function () {
4555
4584
  EasyGrid.prototype.clearDOM = function () {
4556
4585
  this.slot.innerHTML = '';
4557
4586
  };
4587
+ /** Clears all DOM object in the grid and return it to its initial state */
4558
4588
  EasyGrid.prototype.clear = function () {
4559
4589
  this.pagination.page = 1;
4560
4590
  this.clearDOM();
4561
4591
  };
4592
+ /** Renders the grid */
4562
4593
  EasyGrid.prototype.render = function () {
4563
4594
  var _this = this;
4564
4595
  if (!this.hasData() && !this.options.showPlusButton)
@@ -5113,6 +5144,7 @@ var easy_grid_EasyGrid = /** @class */ (function () {
5113
5144
  }
5114
5145
  return cellElement;
5115
5146
  };
5147
+ /** Sets current grid pages (if paging is used) */
5116
5148
  EasyGrid.prototype.setPage = function (page) {
5117
5149
  this.pagination.page = page;
5118
5150
  this.fireEvent({ type: "pageChanged", page: page });
@@ -5359,9 +5391,11 @@ var easy_grid_EasyGrid = /** @class */ (function () {
5359
5391
  return rows[index];
5360
5392
  return null;
5361
5393
  };
5394
+ /** Makes the grid focused for keyboard events */
5362
5395
  EasyGrid.prototype.focus = function () {
5363
5396
  this.bodyViewportDiv.focus();
5364
5397
  };
5398
+ /** Resizes columns according to the data they represent */
5365
5399
  EasyGrid.prototype.resizeColumns = function () {
5366
5400
  if (this.options.columnWidths.autoResize === AutoResizeColumns.Never)
5367
5401
  return;
@@ -14275,19 +14309,23 @@ var list_expression_renderer_ListExpressionRenderer = /** @class */ (function (_
14275
14309
  return [this.expression.value];
14276
14310
  }
14277
14311
  else {
14278
- //splits value by ','
14279
- var res = this.expression.value.match(/"[^"\\]*(?:\\.[^"\\]*)*"|[^,]+/g);
14280
- return res
14281
- ? res.map(function (a) {
14282
- if (a.charAt(0) == '"' && a.charAt(a.length - 1) == '"') {
14283
- a = a.substring(1, a.length - 1);
14284
- return a.replace(/\"/g, '"');
14285
- }
14286
- else {
14287
- return a;
14288
- }
14289
- })
14290
- : [];
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 [];
14291
14329
  }
14292
14330
  };
14293
14331
  ListExpressionRenderer.prototype.adjustNewValue = function (newValue) {