tuain-ng-forms-lib 12.0.56 → 12.0.60
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/bundles/tuain-ng-forms-lib.umd.js +35 -9
- package/bundles/tuain-ng-forms-lib.umd.js.map +1 -1
- package/esm2015/lib/classes/forms/table/table.js +2 -2
- package/esm2015/lib/components/elements/tables/table.component.js +35 -9
- package/fesm2015/tuain-ng-forms-lib.js +35 -9
- package/fesm2015/tuain-ng-forms-lib.js.map +1 -1
- package/lib/components/elements/tables/table.component.d.ts +9 -9
- package/package.json +1 -1
- package/tuain-ng-forms-lib.metadata.json +1 -1
|
@@ -672,14 +672,21 @@
|
|
|
672
672
|
var changeViewAttributes = ['visibleRecords', 'currentPage', 'recordsPerPage', 'sorting'];
|
|
673
673
|
var LibTableComponent = /** @class */ (function () {
|
|
674
674
|
function LibTableComponent() {
|
|
675
|
+
this.currentPageRecords = [];
|
|
675
676
|
this.globalFilterString = '';
|
|
677
|
+
this.globalSearch = false;
|
|
678
|
+
this.selectedRecords = [];
|
|
679
|
+
this.selectionBackend = false;
|
|
680
|
+
this.allSelected = false;
|
|
681
|
+
this.currentPage = 1;
|
|
682
|
+
this.totalRecordsNumber = 0;
|
|
676
683
|
this.loaded = false;
|
|
677
684
|
this.selectable = false;
|
|
678
685
|
this.hasActions = false;
|
|
679
686
|
}
|
|
680
687
|
LibTableComponent.prototype.ngOnInit = function () {
|
|
681
688
|
var _this = this;
|
|
682
|
-
var _a
|
|
689
|
+
var _a;
|
|
683
690
|
if (this.table) {
|
|
684
691
|
this.formConfig = (_a = this.table) === null || _a === void 0 ? void 0 : _a._formConfig;
|
|
685
692
|
this.tableFieldStyles = this.formConfig.tableFieldStyles;
|
|
@@ -691,17 +698,16 @@
|
|
|
691
698
|
// Inicialización de campos mapeados del objeto
|
|
692
699
|
var mapping = Object.entries(this.formConfig.componentTableAttrMap);
|
|
693
700
|
for (var index = 0; index < mapping.length; index++) {
|
|
694
|
-
var _c = __read(mapping[index], 2),
|
|
695
|
-
|
|
701
|
+
var _c = __read(mapping[index], 2), tableAttrRaw = _c[0], compAttrRaw = _c[1];
|
|
702
|
+
var tableAttr = tableAttrRaw.toString();
|
|
703
|
+
var compAttr = compAttrRaw.toString();
|
|
704
|
+
this.syncAttribute(compAttr, this.table[tableAttr]);
|
|
696
705
|
}
|
|
697
706
|
// Subscripción a cambios en atributos
|
|
698
707
|
this.table.attributeChange.subscribe(function (event) {
|
|
699
708
|
var tableAttr = event.name, value = event.value;
|
|
700
709
|
var compAttr = _this.formConfig.componentTableAttrMap[tableAttr];
|
|
701
|
-
_this.
|
|
702
|
-
if (changeViewAttributes.includes(compAttr)) {
|
|
703
|
-
_this.updateTableView();
|
|
704
|
-
}
|
|
710
|
+
_this.syncAttribute(compAttr, value);
|
|
705
711
|
});
|
|
706
712
|
}
|
|
707
713
|
this.start();
|
|
@@ -710,10 +716,30 @@
|
|
|
710
716
|
LibTableComponent.prototype.tableGlobalAction = function (actionCode) { this.table.notifyGlobalAction(actionCode); };
|
|
711
717
|
LibTableComponent.prototype.tableSelectionAction = function (actionCode) { this.table.notifySelectionAction(actionCode); };
|
|
712
718
|
LibTableComponent.prototype.tableActionSelected = function (actionEvent) { this.table.notifyInlineAction(actionEvent); };
|
|
713
|
-
LibTableComponent.prototype.changePage = function (requestedPage) { !this.clientPaging && this.table.notifyGetDataAction(requestedPage); };
|
|
714
719
|
LibTableComponent.prototype.tableSelectionToggle = function (recordId) { this.table.notifyRecordSelection(recordId); };
|
|
715
720
|
LibTableComponent.prototype.toggleSelectAll = function () { return (this.allSelected) ? this.table.unSelectAll() : this.table.selectAll(); };
|
|
716
721
|
LibTableComponent.prototype.globalFilterCompleted = function () { this.changePage(1); };
|
|
722
|
+
LibTableComponent.prototype.changePage = function (requestedPage) {
|
|
723
|
+
if (this.clientPaging) {
|
|
724
|
+
this.currentPage = requestedPage;
|
|
725
|
+
this.updateTableView();
|
|
726
|
+
}
|
|
727
|
+
else {
|
|
728
|
+
this.table.notifyGetDataAction(requestedPage);
|
|
729
|
+
}
|
|
730
|
+
};
|
|
731
|
+
LibTableComponent.prototype.syncAttribute = function (name, value) {
|
|
732
|
+
try {
|
|
733
|
+
// this.hasOwnProperty(name)
|
|
734
|
+
this[name] = value;
|
|
735
|
+
}
|
|
736
|
+
catch (e) {
|
|
737
|
+
console.log('Error asignando valor a un atributo del objeto');
|
|
738
|
+
}
|
|
739
|
+
if (changeViewAttributes.includes(name)) {
|
|
740
|
+
this.updateTableView();
|
|
741
|
+
}
|
|
742
|
+
};
|
|
717
743
|
LibTableComponent.prototype.globalFilterChanged = function () {
|
|
718
744
|
var _a, _b;
|
|
719
745
|
this.table.setGlobalFilterString((_b = (_a = this.globalFilterString) === null || _a === void 0 ? void 0 : _a.trim()) !== null && _b !== void 0 ? _b : '');
|
|
@@ -1768,7 +1794,7 @@
|
|
|
1768
1794
|
this.recordsNumber = tableReceived.recordsNumber;
|
|
1769
1795
|
this.setAttr('currentPage', (_a = +(tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.currentPage)) !== null && _a !== void 0 ? _a : 1);
|
|
1770
1796
|
this.setAttr('recordsPerPage', +tableReceived.recordsPerPage);
|
|
1771
|
-
this.setAttr('totalRecordsNumber', +tableReceived.totalRecordsNumber);
|
|
1797
|
+
this.setAttr('totalRecordsNumber', (this.clientPaging) ? tableReceived.tableRecords.length : +tableReceived.totalRecordsNumber);
|
|
1772
1798
|
this.setAttr('sorting', {
|
|
1773
1799
|
columnName: tableReceived.sortingColumn || '',
|
|
1774
1800
|
direction: tableReceived.sortingDirection || ''
|