@easydata/crud 1.4.6 → 1.4.9-rc01
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.css +0 -4
- package/dist/browser/easydata.css.map +1 -1
- package/dist/browser/easydata.js +33 -0
- package/dist/browser/easydata.js.map +1 -1
- package/dist/browser/easydata.min.css +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
|
@@ -1426,6 +1426,14 @@ var http_client_HttpClient = /** @class */ (function () {
|
|
|
1426
1426
|
this.defaultHeaders = {};
|
|
1427
1427
|
this.customPayload = undefined;
|
|
1428
1428
|
}
|
|
1429
|
+
Object.defineProperty(HttpClient.prototype, "responseBody", {
|
|
1430
|
+
/** Gets the response body for the latest request */
|
|
1431
|
+
get: function () {
|
|
1432
|
+
return this._responseBody;
|
|
1433
|
+
},
|
|
1434
|
+
enumerable: true,
|
|
1435
|
+
configurable: true
|
|
1436
|
+
});
|
|
1429
1437
|
HttpClient.prototype.get = function (url, options) {
|
|
1430
1438
|
return this.send(HttpMethod.Get, url, null, options);
|
|
1431
1439
|
};
|
|
@@ -1439,6 +1447,7 @@ var http_client_HttpClient = /** @class */ (function () {
|
|
|
1439
1447
|
return this.send(HttpMethod.Delete, url, data, options);
|
|
1440
1448
|
};
|
|
1441
1449
|
HttpClient.prototype.send = function (method, url, data, options) {
|
|
1450
|
+
var _this = this;
|
|
1442
1451
|
options = options || {};
|
|
1443
1452
|
var dataType = options.dataType || 'json';
|
|
1444
1453
|
var contentType = options.contentType || (dataType !== 'form-data')
|
|
@@ -1494,6 +1503,10 @@ var http_client_HttpClient = /** @class */ (function () {
|
|
|
1494
1503
|
: (responseContentType.indexOf('application/json') == 0
|
|
1495
1504
|
? JSON.parse(xhr.responseText)
|
|
1496
1505
|
: xhr.responseText);
|
|
1506
|
+
_this._responseBody = responseObj;
|
|
1507
|
+
if (_this.onResponse) {
|
|
1508
|
+
_this.onResponse(xhr);
|
|
1509
|
+
}
|
|
1497
1510
|
resolve(responseObj);
|
|
1498
1511
|
}
|
|
1499
1512
|
else {
|
|
@@ -1505,6 +1518,7 @@ var http_client_HttpClient = /** @class */ (function () {
|
|
|
1505
1518
|
var responseObj = (responseContentType.indexOf('application/json') == 0)
|
|
1506
1519
|
? JSON.parse(responseText)
|
|
1507
1520
|
: responseText;
|
|
1521
|
+
_this._responseBody = responseObj;
|
|
1508
1522
|
var message = responseObj.message ||
|
|
1509
1523
|
(status == 404
|
|
1510
1524
|
? "No such endpoint: " + url
|
|
@@ -4492,7 +4506,9 @@ var easy_grid_spreadArrays = (undefined && undefined.__spreadArrays) || function
|
|
|
4492
4506
|
|
|
4493
4507
|
var DEFAULT_ROW_HEIGHT = 36;
|
|
4494
4508
|
var DEFAULT_ROW_COUNT = 15;
|
|
4509
|
+
/** Represents a grid widget with columns rows, paging, custom rendering and more */
|
|
4495
4510
|
var easy_grid_EasyGrid = /** @class */ (function () {
|
|
4511
|
+
/** Creates and initializes all internal properties of the grid object */
|
|
4496
4512
|
function EasyGrid(options) {
|
|
4497
4513
|
this.cssPrefix = "keg";
|
|
4498
4514
|
this.pagination = { page: 1, pageSize: 30, total: 0 };
|
|
@@ -4634,6 +4650,7 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
4634
4650
|
this.slot = slot;
|
|
4635
4651
|
}
|
|
4636
4652
|
};
|
|
4653
|
+
/** Initializes grid widget according to the options passed in the parameter */
|
|
4637
4654
|
EasyGrid.prototype.init = function (options) {
|
|
4638
4655
|
var _this = this;
|
|
4639
4656
|
if (options.onInit) {
|
|
@@ -4697,6 +4714,10 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
4697
4714
|
this.refresh();
|
|
4698
4715
|
this.fireEvent('init');
|
|
4699
4716
|
};
|
|
4717
|
+
/** Fires a grid event. You can pass either an event type
|
|
4718
|
+
* (like 'init', 'rowClick', 'pageChanged', etc )
|
|
4719
|
+
* or a ready-to-use grid event object
|
|
4720
|
+
* */
|
|
4700
4721
|
EasyGrid.prototype.fireEvent = function (event) {
|
|
4701
4722
|
if (typeof event === "string") {
|
|
4702
4723
|
this.eventEmitter.fire(event);
|
|
@@ -4705,20 +4726,26 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
4705
4726
|
this.eventEmitter.fire(event.type, event);
|
|
4706
4727
|
}
|
|
4707
4728
|
};
|
|
4729
|
+
/** Allows to set the data (represented by a EasyDataTable object)
|
|
4730
|
+
* or to replace the existing one associated with the grid */
|
|
4708
4731
|
EasyGrid.prototype.setData = function (data) {
|
|
4709
4732
|
this.dataTable = data;
|
|
4710
4733
|
this.clear();
|
|
4711
4734
|
this.refresh();
|
|
4712
4735
|
};
|
|
4736
|
+
/** Returns the EasyDataTable object associated with the grid via `setData()` call */
|
|
4713
4737
|
EasyGrid.prototype.getData = function () {
|
|
4714
4738
|
return this.dataTable;
|
|
4715
4739
|
};
|
|
4740
|
+
/** Gets the list of grid columns */
|
|
4716
4741
|
EasyGrid.prototype.getColumns = function () {
|
|
4717
4742
|
return this.columns;
|
|
4718
4743
|
};
|
|
4744
|
+
/** This function is called when the grid is destroyed */
|
|
4719
4745
|
EasyGrid.prototype.destroy = function () {
|
|
4720
4746
|
this.slot.innerHTML = "";
|
|
4721
4747
|
};
|
|
4748
|
+
/** Clears the current DOM object and re-renders everything from the scratch */
|
|
4722
4749
|
EasyGrid.prototype.refresh = function () {
|
|
4723
4750
|
this.clearDOM();
|
|
4724
4751
|
this.render();
|
|
@@ -4726,10 +4753,12 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
4726
4753
|
EasyGrid.prototype.clearDOM = function () {
|
|
4727
4754
|
this.slot.innerHTML = '';
|
|
4728
4755
|
};
|
|
4756
|
+
/** Clears all DOM object in the grid and return it to its initial state */
|
|
4729
4757
|
EasyGrid.prototype.clear = function () {
|
|
4730
4758
|
this.pagination.page = 1;
|
|
4731
4759
|
this.clearDOM();
|
|
4732
4760
|
};
|
|
4761
|
+
/** Renders the grid */
|
|
4733
4762
|
EasyGrid.prototype.render = function () {
|
|
4734
4763
|
var _this = this;
|
|
4735
4764
|
if (!this.hasData() && !this.options.showPlusButton)
|
|
@@ -5165,6 +5194,7 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
5165
5194
|
.toDOM();
|
|
5166
5195
|
if (this.rowsOnPagePromise) {
|
|
5167
5196
|
this.rowsOnPagePromise.then(function (count) {
|
|
5197
|
+
_this.footerDiv.innerHTML = '';
|
|
5168
5198
|
_this.footerPaginateDiv = _this.renderPageNavigator();
|
|
5169
5199
|
_this.footerDiv.appendChild(_this.footerPaginateDiv);
|
|
5170
5200
|
var pageInfoBlock = _this.renderPageInfoBlock(count);
|
|
@@ -5284,6 +5314,7 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
5284
5314
|
}
|
|
5285
5315
|
return cellElement;
|
|
5286
5316
|
};
|
|
5317
|
+
/** Sets current grid pages (if paging is used) */
|
|
5287
5318
|
EasyGrid.prototype.setPage = function (page) {
|
|
5288
5319
|
this.pagination.page = page;
|
|
5289
5320
|
this.fireEvent({ type: "pageChanged", page: page });
|
|
@@ -5530,9 +5561,11 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
5530
5561
|
return rows[index];
|
|
5531
5562
|
return null;
|
|
5532
5563
|
};
|
|
5564
|
+
/** Makes the grid focused for keyboard events */
|
|
5533
5565
|
EasyGrid.prototype.focus = function () {
|
|
5534
5566
|
this.bodyViewportDiv.focus();
|
|
5535
5567
|
};
|
|
5568
|
+
/** Resizes columns according to the data they represent */
|
|
5536
5569
|
EasyGrid.prototype.resizeColumns = function () {
|
|
5537
5570
|
if (this.options.columnWidths.autoResize === AutoResizeColumns.Never)
|
|
5538
5571
|
return;
|