@easydata/crud 1.4.6-rc01 → 1.4.8
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.
- package/dist/browser/easydata.js +33 -0
- package/dist/browser/easydata.js.map +1 -1
- package/dist/browser/easydata.min.js +1 -1
- package/dist/browser/easydata.min.js.map +1 -1
- package/dist/bundles/easydata.crud.js +33 -0
- package/dist/bundles/easydata.crud.js.map +1 -1
- package/dist/bundles/easydata.crud.min.js +1 -1
- package/dist/bundles/easydata.crud.min.js.map +1 -1
- package/package.json +3 -3
package/dist/browser/easydata.js
CHANGED
|
@@ -5800,6 +5800,14 @@ var HttpClient = /** @class */ (function () {
|
|
|
5800
5800
|
this.defaultHeaders = {};
|
|
5801
5801
|
this.customPayload = undefined;
|
|
5802
5802
|
}
|
|
5803
|
+
Object.defineProperty(HttpClient.prototype, "responseBody", {
|
|
5804
|
+
/** Gets the response body for the latest request */
|
|
5805
|
+
get: function () {
|
|
5806
|
+
return this._responseBody;
|
|
5807
|
+
},
|
|
5808
|
+
enumerable: true,
|
|
5809
|
+
configurable: true
|
|
5810
|
+
});
|
|
5803
5811
|
HttpClient.prototype.get = function (url, options) {
|
|
5804
5812
|
return this.send(_http_method__WEBPACK_IMPORTED_MODULE_2__[/* HttpMethod */ "a"].Get, url, null, options);
|
|
5805
5813
|
};
|
|
@@ -5813,6 +5821,7 @@ var HttpClient = /** @class */ (function () {
|
|
|
5813
5821
|
return this.send(_http_method__WEBPACK_IMPORTED_MODULE_2__[/* HttpMethod */ "a"].Delete, url, data, options);
|
|
5814
5822
|
};
|
|
5815
5823
|
HttpClient.prototype.send = function (method, url, data, options) {
|
|
5824
|
+
var _this = this;
|
|
5816
5825
|
options = options || {};
|
|
5817
5826
|
var dataType = options.dataType || 'json';
|
|
5818
5827
|
var contentType = options.contentType || (dataType !== 'form-data')
|
|
@@ -5868,6 +5877,10 @@ var HttpClient = /** @class */ (function () {
|
|
|
5868
5877
|
: (responseContentType.indexOf('application/json') == 0
|
|
5869
5878
|
? JSON.parse(xhr.responseText)
|
|
5870
5879
|
: xhr.responseText);
|
|
5880
|
+
_this._responseBody = responseObj;
|
|
5881
|
+
if (_this.onResponse) {
|
|
5882
|
+
_this.onResponse(xhr);
|
|
5883
|
+
}
|
|
5871
5884
|
resolve(responseObj);
|
|
5872
5885
|
}
|
|
5873
5886
|
else {
|
|
@@ -5879,6 +5892,7 @@ var HttpClient = /** @class */ (function () {
|
|
|
5879
5892
|
var responseObj = (responseContentType.indexOf('application/json') == 0)
|
|
5880
5893
|
? JSON.parse(responseText)
|
|
5881
5894
|
: responseText;
|
|
5895
|
+
_this._responseBody = responseObj;
|
|
5882
5896
|
var message = responseObj.message ||
|
|
5883
5897
|
(status == 404
|
|
5884
5898
|
? "No such endpoint: " + url
|
|
@@ -7590,7 +7604,9 @@ var __spreadArrays = (undefined && undefined.__spreadArrays) || function () {
|
|
|
7590
7604
|
|
|
7591
7605
|
var DEFAULT_ROW_HEIGHT = 36;
|
|
7592
7606
|
var DEFAULT_ROW_COUNT = 15;
|
|
7607
|
+
/** Represents a grid widget with columns rows, paging, custom rendering and more */
|
|
7593
7608
|
var EasyGrid = /** @class */ (function () {
|
|
7609
|
+
/** Creates and initializes all internal properties of the grid object */
|
|
7594
7610
|
function EasyGrid(options) {
|
|
7595
7611
|
this.cssPrefix = "keg";
|
|
7596
7612
|
this.pagination = { page: 1, pageSize: 30, total: 0 };
|
|
@@ -7709,6 +7725,7 @@ var EasyGrid = /** @class */ (function () {
|
|
|
7709
7725
|
widthOptions[dataType] = __assign(__assign({}, widthOptions.otherColumns), widthOptions[dataType]);
|
|
7710
7726
|
}
|
|
7711
7727
|
});
|
|
7728
|
+
widthOptions[_easydata_core__WEBPACK_IMPORTED_MODULE_0__["DataType"].Unknown] = widthOptions.otherColumns;
|
|
7712
7729
|
};
|
|
7713
7730
|
EasyGrid.prototype.setSlot = function (slot) {
|
|
7714
7731
|
if (typeof slot === 'string') {
|
|
@@ -7731,6 +7748,7 @@ var EasyGrid = /** @class */ (function () {
|
|
|
7731
7748
|
this.slot = slot;
|
|
7732
7749
|
}
|
|
7733
7750
|
};
|
|
7751
|
+
/** Initializes grid widget according to the options passed in the parameter */
|
|
7734
7752
|
EasyGrid.prototype.init = function (options) {
|
|
7735
7753
|
var _this = this;
|
|
7736
7754
|
if (options.onInit) {
|
|
@@ -7794,6 +7812,10 @@ var EasyGrid = /** @class */ (function () {
|
|
|
7794
7812
|
this.refresh();
|
|
7795
7813
|
this.fireEvent('init');
|
|
7796
7814
|
};
|
|
7815
|
+
/** Fires a grid event. You can pass either an event type
|
|
7816
|
+
* (like 'init', 'rowClick', 'pageChanged', etc )
|
|
7817
|
+
* or a ready-to-use grid event object
|
|
7818
|
+
* */
|
|
7797
7819
|
EasyGrid.prototype.fireEvent = function (event) {
|
|
7798
7820
|
if (typeof event === "string") {
|
|
7799
7821
|
this.eventEmitter.fire(event);
|
|
@@ -7802,20 +7824,26 @@ var EasyGrid = /** @class */ (function () {
|
|
|
7802
7824
|
this.eventEmitter.fire(event.type, event);
|
|
7803
7825
|
}
|
|
7804
7826
|
};
|
|
7827
|
+
/** Allows to set the data (represented by a EasyDataTable object)
|
|
7828
|
+
* or to replace the existing one associated with the grid */
|
|
7805
7829
|
EasyGrid.prototype.setData = function (data) {
|
|
7806
7830
|
this.dataTable = data;
|
|
7807
7831
|
this.clear();
|
|
7808
7832
|
this.refresh();
|
|
7809
7833
|
};
|
|
7834
|
+
/** Returns the EasyDataTable object associated with the grid via `setData()` call */
|
|
7810
7835
|
EasyGrid.prototype.getData = function () {
|
|
7811
7836
|
return this.dataTable;
|
|
7812
7837
|
};
|
|
7838
|
+
/** Gets the list of grid columns */
|
|
7813
7839
|
EasyGrid.prototype.getColumns = function () {
|
|
7814
7840
|
return this.columns;
|
|
7815
7841
|
};
|
|
7842
|
+
/** This function is called when the grid is destroyed */
|
|
7816
7843
|
EasyGrid.prototype.destroy = function () {
|
|
7817
7844
|
this.slot.innerHTML = "";
|
|
7818
7845
|
};
|
|
7846
|
+
/** Clears the current DOM object and re-renders everything from the scratch */
|
|
7819
7847
|
EasyGrid.prototype.refresh = function () {
|
|
7820
7848
|
this.clearDOM();
|
|
7821
7849
|
this.render();
|
|
@@ -7823,10 +7851,12 @@ var EasyGrid = /** @class */ (function () {
|
|
|
7823
7851
|
EasyGrid.prototype.clearDOM = function () {
|
|
7824
7852
|
this.slot.innerHTML = '';
|
|
7825
7853
|
};
|
|
7854
|
+
/** Clears all DOM object in the grid and return it to its initial state */
|
|
7826
7855
|
EasyGrid.prototype.clear = function () {
|
|
7827
7856
|
this.pagination.page = 1;
|
|
7828
7857
|
this.clearDOM();
|
|
7829
7858
|
};
|
|
7859
|
+
/** Renders the grid */
|
|
7830
7860
|
EasyGrid.prototype.render = function () {
|
|
7831
7861
|
var _this = this;
|
|
7832
7862
|
if (!this.hasData() && !this.options.showPlusButton)
|
|
@@ -8381,6 +8411,7 @@ var EasyGrid = /** @class */ (function () {
|
|
|
8381
8411
|
}
|
|
8382
8412
|
return cellElement;
|
|
8383
8413
|
};
|
|
8414
|
+
/** Sets current grid pages (if paging is used) */
|
|
8384
8415
|
EasyGrid.prototype.setPage = function (page) {
|
|
8385
8416
|
this.pagination.page = page;
|
|
8386
8417
|
this.fireEvent({ type: "pageChanged", page: page });
|
|
@@ -8627,9 +8658,11 @@ var EasyGrid = /** @class */ (function () {
|
|
|
8627
8658
|
return rows[index];
|
|
8628
8659
|
return null;
|
|
8629
8660
|
};
|
|
8661
|
+
/** Makes the grid focused for keyboard events */
|
|
8630
8662
|
EasyGrid.prototype.focus = function () {
|
|
8631
8663
|
this.bodyViewportDiv.focus();
|
|
8632
8664
|
};
|
|
8665
|
+
/** Resizes columns according to the data they represent */
|
|
8633
8666
|
EasyGrid.prototype.resizeColumns = function () {
|
|
8634
8667
|
if (this.options.columnWidths.autoResize === _easy_grid_options__WEBPACK_IMPORTED_MODULE_4__[/* AutoResizeColumns */ "a"].Never)
|
|
8635
8668
|
return;
|