@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
|
@@ -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 };
|
|
@@ -4611,6 +4627,7 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
4611
4627
|
widthOptions[dataType] = easy_grid_assign(easy_grid_assign({}, widthOptions.otherColumns), widthOptions[dataType]);
|
|
4612
4628
|
}
|
|
4613
4629
|
});
|
|
4630
|
+
widthOptions[DataType.Unknown] = widthOptions.otherColumns;
|
|
4614
4631
|
};
|
|
4615
4632
|
EasyGrid.prototype.setSlot = function (slot) {
|
|
4616
4633
|
if (typeof slot === 'string') {
|
|
@@ -4633,6 +4650,7 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
4633
4650
|
this.slot = slot;
|
|
4634
4651
|
}
|
|
4635
4652
|
};
|
|
4653
|
+
/** Initializes grid widget according to the options passed in the parameter */
|
|
4636
4654
|
EasyGrid.prototype.init = function (options) {
|
|
4637
4655
|
var _this = this;
|
|
4638
4656
|
if (options.onInit) {
|
|
@@ -4696,6 +4714,10 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
4696
4714
|
this.refresh();
|
|
4697
4715
|
this.fireEvent('init');
|
|
4698
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
|
+
* */
|
|
4699
4721
|
EasyGrid.prototype.fireEvent = function (event) {
|
|
4700
4722
|
if (typeof event === "string") {
|
|
4701
4723
|
this.eventEmitter.fire(event);
|
|
@@ -4704,20 +4726,26 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
4704
4726
|
this.eventEmitter.fire(event.type, event);
|
|
4705
4727
|
}
|
|
4706
4728
|
};
|
|
4729
|
+
/** Allows to set the data (represented by a EasyDataTable object)
|
|
4730
|
+
* or to replace the existing one associated with the grid */
|
|
4707
4731
|
EasyGrid.prototype.setData = function (data) {
|
|
4708
4732
|
this.dataTable = data;
|
|
4709
4733
|
this.clear();
|
|
4710
4734
|
this.refresh();
|
|
4711
4735
|
};
|
|
4736
|
+
/** Returns the EasyDataTable object associated with the grid via `setData()` call */
|
|
4712
4737
|
EasyGrid.prototype.getData = function () {
|
|
4713
4738
|
return this.dataTable;
|
|
4714
4739
|
};
|
|
4740
|
+
/** Gets the list of grid columns */
|
|
4715
4741
|
EasyGrid.prototype.getColumns = function () {
|
|
4716
4742
|
return this.columns;
|
|
4717
4743
|
};
|
|
4744
|
+
/** This function is called when the grid is destroyed */
|
|
4718
4745
|
EasyGrid.prototype.destroy = function () {
|
|
4719
4746
|
this.slot.innerHTML = "";
|
|
4720
4747
|
};
|
|
4748
|
+
/** Clears the current DOM object and re-renders everything from the scratch */
|
|
4721
4749
|
EasyGrid.prototype.refresh = function () {
|
|
4722
4750
|
this.clearDOM();
|
|
4723
4751
|
this.render();
|
|
@@ -4725,10 +4753,12 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
4725
4753
|
EasyGrid.prototype.clearDOM = function () {
|
|
4726
4754
|
this.slot.innerHTML = '';
|
|
4727
4755
|
};
|
|
4756
|
+
/** Clears all DOM object in the grid and return it to its initial state */
|
|
4728
4757
|
EasyGrid.prototype.clear = function () {
|
|
4729
4758
|
this.pagination.page = 1;
|
|
4730
4759
|
this.clearDOM();
|
|
4731
4760
|
};
|
|
4761
|
+
/** Renders the grid */
|
|
4732
4762
|
EasyGrid.prototype.render = function () {
|
|
4733
4763
|
var _this = this;
|
|
4734
4764
|
if (!this.hasData() && !this.options.showPlusButton)
|
|
@@ -5283,6 +5313,7 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
5283
5313
|
}
|
|
5284
5314
|
return cellElement;
|
|
5285
5315
|
};
|
|
5316
|
+
/** Sets current grid pages (if paging is used) */
|
|
5286
5317
|
EasyGrid.prototype.setPage = function (page) {
|
|
5287
5318
|
this.pagination.page = page;
|
|
5288
5319
|
this.fireEvent({ type: "pageChanged", page: page });
|
|
@@ -5529,9 +5560,11 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
5529
5560
|
return rows[index];
|
|
5530
5561
|
return null;
|
|
5531
5562
|
};
|
|
5563
|
+
/** Makes the grid focused for keyboard events */
|
|
5532
5564
|
EasyGrid.prototype.focus = function () {
|
|
5533
5565
|
this.bodyViewportDiv.focus();
|
|
5534
5566
|
};
|
|
5567
|
+
/** Resizes columns according to the data they represent */
|
|
5535
5568
|
EasyGrid.prototype.resizeColumns = function () {
|
|
5536
5569
|
if (this.options.columnWidths.autoResize === AutoResizeColumns.Never)
|
|
5537
5570
|
return;
|