@easydata/crud 1.4.5 → 1.4.7

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.
@@ -3335,7 +3335,7 @@ var i18n;
3335
3335
  }
3336
3336
  else if (['D', 'F', 'C'].indexOf(type) >= 0) {
3337
3337
  var locale = getCurrentLocale();
3338
- return number.toLocaleString(locale, getNumberFromatOptions(format));
3338
+ return number.toLocaleString(locale, getNumberFormatOptions(format));
3339
3339
  }
3340
3340
  else {
3341
3341
  return convertWithMask(Math.trunc(number), format);
@@ -3411,7 +3411,7 @@ var i18n;
3411
3411
  }
3412
3412
  return result.split('').reverse().join('');
3413
3413
  }
3414
- function getNumberFromatOptions(format) {
3414
+ function getNumberFormatOptions(format) {
3415
3415
  var localeSettings = getLocaleSettings();
3416
3416
  var type = format[0].toUpperCase();
3417
3417
  var digits = (format.length > 1)
@@ -3433,7 +3433,8 @@ var i18n;
3433
3433
  default:
3434
3434
  return {
3435
3435
  style: 'decimal',
3436
- minimumFractionDigits: digits
3436
+ minimumFractionDigits: digits,
3437
+ maximumFractionDigits: digits
3437
3438
  };
3438
3439
  }
3439
3440
  }
@@ -7589,7 +7590,9 @@ var __spreadArrays = (undefined && undefined.__spreadArrays) || function () {
7589
7590
 
7590
7591
  var DEFAULT_ROW_HEIGHT = 36;
7591
7592
  var DEFAULT_ROW_COUNT = 15;
7593
+ /** Represents a grid widget with columns rows, paging, custom rendering and more */
7592
7594
  var EasyGrid = /** @class */ (function () {
7595
+ /** Creates and initializes all internal properties of the grid object */
7593
7596
  function EasyGrid(options) {
7594
7597
  this.cssPrefix = "keg";
7595
7598
  this.pagination = { page: 1, pageSize: 30, total: 0 };
@@ -7708,6 +7711,7 @@ var EasyGrid = /** @class */ (function () {
7708
7711
  widthOptions[dataType] = __assign(__assign({}, widthOptions.otherColumns), widthOptions[dataType]);
7709
7712
  }
7710
7713
  });
7714
+ widthOptions[_easydata_core__WEBPACK_IMPORTED_MODULE_0__["DataType"].Unknown] = widthOptions.otherColumns;
7711
7715
  };
7712
7716
  EasyGrid.prototype.setSlot = function (slot) {
7713
7717
  if (typeof slot === 'string') {
@@ -7730,6 +7734,7 @@ var EasyGrid = /** @class */ (function () {
7730
7734
  this.slot = slot;
7731
7735
  }
7732
7736
  };
7737
+ /** Initializes grid widget according to the options passed in the parameter */
7733
7738
  EasyGrid.prototype.init = function (options) {
7734
7739
  var _this = this;
7735
7740
  if (options.onInit) {
@@ -7793,6 +7798,10 @@ var EasyGrid = /** @class */ (function () {
7793
7798
  this.refresh();
7794
7799
  this.fireEvent('init');
7795
7800
  };
7801
+ /** Fires a grid event. You can pass either an event type
7802
+ * (like 'init', 'rowClick', 'pageChanged', etc )
7803
+ * or a ready-to-use grid event object
7804
+ * */
7796
7805
  EasyGrid.prototype.fireEvent = function (event) {
7797
7806
  if (typeof event === "string") {
7798
7807
  this.eventEmitter.fire(event);
@@ -7801,20 +7810,26 @@ var EasyGrid = /** @class */ (function () {
7801
7810
  this.eventEmitter.fire(event.type, event);
7802
7811
  }
7803
7812
  };
7813
+ /** Allows to set the data (represented by a EasyDataTable object)
7814
+ * or to replace the existing one associated with the grid */
7804
7815
  EasyGrid.prototype.setData = function (data) {
7805
7816
  this.dataTable = data;
7806
7817
  this.clear();
7807
7818
  this.refresh();
7808
7819
  };
7820
+ /** Returns the EasyDataTable object associated with the grid via `setData()` call */
7809
7821
  EasyGrid.prototype.getData = function () {
7810
7822
  return this.dataTable;
7811
7823
  };
7824
+ /** Gets the list of grid columns */
7812
7825
  EasyGrid.prototype.getColumns = function () {
7813
7826
  return this.columns;
7814
7827
  };
7828
+ /** This function is called when the grid is destroyed */
7815
7829
  EasyGrid.prototype.destroy = function () {
7816
7830
  this.slot.innerHTML = "";
7817
7831
  };
7832
+ /** Clears the current DOM object and re-renders everything from the scratch */
7818
7833
  EasyGrid.prototype.refresh = function () {
7819
7834
  this.clearDOM();
7820
7835
  this.render();
@@ -7822,10 +7837,12 @@ var EasyGrid = /** @class */ (function () {
7822
7837
  EasyGrid.prototype.clearDOM = function () {
7823
7838
  this.slot.innerHTML = '';
7824
7839
  };
7840
+ /** Clears all DOM object in the grid and return it to its initial state */
7825
7841
  EasyGrid.prototype.clear = function () {
7826
7842
  this.pagination.page = 1;
7827
7843
  this.clearDOM();
7828
7844
  };
7845
+ /** Renders the grid */
7829
7846
  EasyGrid.prototype.render = function () {
7830
7847
  var _this = this;
7831
7848
  if (!this.hasData() && !this.options.showPlusButton)
@@ -8380,6 +8397,7 @@ var EasyGrid = /** @class */ (function () {
8380
8397
  }
8381
8398
  return cellElement;
8382
8399
  };
8400
+ /** Sets current grid pages (if paging is used) */
8383
8401
  EasyGrid.prototype.setPage = function (page) {
8384
8402
  this.pagination.page = page;
8385
8403
  this.fireEvent({ type: "pageChanged", page: page });
@@ -8626,9 +8644,11 @@ var EasyGrid = /** @class */ (function () {
8626
8644
  return rows[index];
8627
8645
  return null;
8628
8646
  };
8647
+ /** Makes the grid focused for keyboard events */
8629
8648
  EasyGrid.prototype.focus = function () {
8630
8649
  this.bodyViewportDiv.focus();
8631
8650
  };
8651
+ /** Resizes columns according to the data they represent */
8632
8652
  EasyGrid.prototype.resizeColumns = function () {
8633
8653
  if (this.options.columnWidths.autoResize === _easy_grid_options__WEBPACK_IMPORTED_MODULE_4__[/* AutoResizeColumns */ "a"].Never)
8634
8654
  return;