@easydata/crud 1.4.6 → 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.
@@ -7590,7 +7590,9 @@ var __spreadArrays = (undefined && undefined.__spreadArrays) || function () {
7590
7590
 
7591
7591
  var DEFAULT_ROW_HEIGHT = 36;
7592
7592
  var DEFAULT_ROW_COUNT = 15;
7593
+ /** Represents a grid widget with columns rows, paging, custom rendering and more */
7593
7594
  var EasyGrid = /** @class */ (function () {
7595
+ /** Creates and initializes all internal properties of the grid object */
7594
7596
  function EasyGrid(options) {
7595
7597
  this.cssPrefix = "keg";
7596
7598
  this.pagination = { page: 1, pageSize: 30, total: 0 };
@@ -7732,6 +7734,7 @@ var EasyGrid = /** @class */ (function () {
7732
7734
  this.slot = slot;
7733
7735
  }
7734
7736
  };
7737
+ /** Initializes grid widget according to the options passed in the parameter */
7735
7738
  EasyGrid.prototype.init = function (options) {
7736
7739
  var _this = this;
7737
7740
  if (options.onInit) {
@@ -7795,6 +7798,10 @@ var EasyGrid = /** @class */ (function () {
7795
7798
  this.refresh();
7796
7799
  this.fireEvent('init');
7797
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
+ * */
7798
7805
  EasyGrid.prototype.fireEvent = function (event) {
7799
7806
  if (typeof event === "string") {
7800
7807
  this.eventEmitter.fire(event);
@@ -7803,20 +7810,26 @@ var EasyGrid = /** @class */ (function () {
7803
7810
  this.eventEmitter.fire(event.type, event);
7804
7811
  }
7805
7812
  };
7813
+ /** Allows to set the data (represented by a EasyDataTable object)
7814
+ * or to replace the existing one associated with the grid */
7806
7815
  EasyGrid.prototype.setData = function (data) {
7807
7816
  this.dataTable = data;
7808
7817
  this.clear();
7809
7818
  this.refresh();
7810
7819
  };
7820
+ /** Returns the EasyDataTable object associated with the grid via `setData()` call */
7811
7821
  EasyGrid.prototype.getData = function () {
7812
7822
  return this.dataTable;
7813
7823
  };
7824
+ /** Gets the list of grid columns */
7814
7825
  EasyGrid.prototype.getColumns = function () {
7815
7826
  return this.columns;
7816
7827
  };
7828
+ /** This function is called when the grid is destroyed */
7817
7829
  EasyGrid.prototype.destroy = function () {
7818
7830
  this.slot.innerHTML = "";
7819
7831
  };
7832
+ /** Clears the current DOM object and re-renders everything from the scratch */
7820
7833
  EasyGrid.prototype.refresh = function () {
7821
7834
  this.clearDOM();
7822
7835
  this.render();
@@ -7824,10 +7837,12 @@ var EasyGrid = /** @class */ (function () {
7824
7837
  EasyGrid.prototype.clearDOM = function () {
7825
7838
  this.slot.innerHTML = '';
7826
7839
  };
7840
+ /** Clears all DOM object in the grid and return it to its initial state */
7827
7841
  EasyGrid.prototype.clear = function () {
7828
7842
  this.pagination.page = 1;
7829
7843
  this.clearDOM();
7830
7844
  };
7845
+ /** Renders the grid */
7831
7846
  EasyGrid.prototype.render = function () {
7832
7847
  var _this = this;
7833
7848
  if (!this.hasData() && !this.options.showPlusButton)
@@ -8382,6 +8397,7 @@ var EasyGrid = /** @class */ (function () {
8382
8397
  }
8383
8398
  return cellElement;
8384
8399
  };
8400
+ /** Sets current grid pages (if paging is used) */
8385
8401
  EasyGrid.prototype.setPage = function (page) {
8386
8402
  this.pagination.page = page;
8387
8403
  this.fireEvent({ type: "pageChanged", page: page });
@@ -8628,9 +8644,11 @@ var EasyGrid = /** @class */ (function () {
8628
8644
  return rows[index];
8629
8645
  return null;
8630
8646
  };
8647
+ /** Makes the grid focused for keyboard events */
8631
8648
  EasyGrid.prototype.focus = function () {
8632
8649
  this.bodyViewportDiv.focus();
8633
8650
  };
8651
+ /** Resizes columns according to the data they represent */
8634
8652
  EasyGrid.prototype.resizeColumns = function () {
8635
8653
  if (this.options.columnWidths.autoResize === _easy_grid_options__WEBPACK_IMPORTED_MODULE_4__[/* AutoResizeColumns */ "a"].Never)
8636
8654
  return;