tuain-ng-forms-lib 12.0.59 → 12.0.63
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 +55 -45
- package/bundles/tuain-ng-forms-lib.umd.js.map +1 -1
- package/esm2015/lib/classes/forms/table/column.js +9 -1
- package/esm2015/lib/classes/forms/table/table.js +36 -16
- package/esm2015/lib/components/elements/tables/table.component.js +9 -31
- package/fesm2015/tuain-ng-forms-lib.js +51 -45
- package/fesm2015/tuain-ng-forms-lib.js.map +1 -1
- package/lib/classes/forms/table/column.d.ts +1 -0
- package/lib/classes/forms/table/table.d.ts +2 -0
- package/lib/components/elements/tables/table.component.d.ts +8 -15
- package/package.json +1 -1
- package/tuain-ng-forms-lib.metadata.json +1 -1
|
@@ -669,17 +669,15 @@
|
|
|
669
669
|
fieldValue: [{ type: core.Input }]
|
|
670
670
|
};
|
|
671
671
|
|
|
672
|
-
var changeViewAttributes = ['visibleRecords', 'currentPage', 'recordsPerPage'
|
|
672
|
+
var changeViewAttributes = ['visibleRecords', 'currentPage', 'recordsPerPage'];
|
|
673
673
|
var LibTableComponent = /** @class */ (function () {
|
|
674
674
|
function LibTableComponent() {
|
|
675
|
-
this.currentPageRecords = [];
|
|
676
675
|
this.globalFilterString = '';
|
|
676
|
+
this.currentPage = 1;
|
|
677
677
|
this.globalSearch = false;
|
|
678
678
|
this.selectedRecords = [];
|
|
679
|
-
this.selectionBackend = false;
|
|
680
|
-
this.allSelected = false;
|
|
681
|
-
this.currentPage = 1;
|
|
682
679
|
this.totalRecordsNumber = 0;
|
|
680
|
+
this.allSelected = false;
|
|
683
681
|
this.loaded = false;
|
|
684
682
|
this.selectable = false;
|
|
685
683
|
this.hasActions = false;
|
|
@@ -716,42 +714,22 @@
|
|
|
716
714
|
LibTableComponent.prototype.tableGlobalAction = function (actionCode) { this.table.notifyGlobalAction(actionCode); };
|
|
717
715
|
LibTableComponent.prototype.tableSelectionAction = function (actionCode) { this.table.notifySelectionAction(actionCode); };
|
|
718
716
|
LibTableComponent.prototype.tableActionSelected = function (actionEvent) { this.table.notifyInlineAction(actionEvent); };
|
|
719
|
-
LibTableComponent.prototype.changePage = function (requestedPage) { !this.clientPaging && this.table.notifyGetDataAction(requestedPage); };
|
|
720
717
|
LibTableComponent.prototype.tableSelectionToggle = function (recordId) { this.table.notifyRecordSelection(recordId); };
|
|
721
718
|
LibTableComponent.prototype.toggleSelectAll = function () { return (this.allSelected) ? this.table.unSelectAll() : this.table.selectAll(); };
|
|
722
719
|
LibTableComponent.prototype.globalFilterCompleted = function () { this.changePage(1); };
|
|
720
|
+
LibTableComponent.prototype.changePage = function (requestedPage) { this.table.changePage(requestedPage); };
|
|
721
|
+
LibTableComponent.prototype.tableColumnSort = function (columnName) { this.table.sort(columnName); };
|
|
722
|
+
LibTableComponent.prototype.globalFilterChanged = function () { var _a, _b; this.table.setGlobalFilterString((_b = (_a = this.globalFilterString) === null || _a === void 0 ? void 0 : _a.trim()) !== null && _b !== void 0 ? _b : ''); };
|
|
723
723
|
LibTableComponent.prototype.syncAttribute = function (name, value) {
|
|
724
724
|
try {
|
|
725
|
-
// this.hasOwnProperty(name)
|
|
726
725
|
this[name] = value;
|
|
727
726
|
}
|
|
728
727
|
catch (e) {
|
|
729
728
|
console.log('Error asignando valor a un atributo del objeto');
|
|
730
729
|
}
|
|
731
|
-
if (changeViewAttributes.includes(name)) {
|
|
732
|
-
this.updateTableView();
|
|
733
|
-
}
|
|
734
730
|
};
|
|
735
|
-
LibTableComponent.prototype.
|
|
736
|
-
|
|
737
|
-
this.table.setGlobalFilterString((_b = (_a = this.globalFilterString) === null || _a === void 0 ? void 0 : _a.trim()) !== null && _b !== void 0 ? _b : '');
|
|
738
|
-
if (this.clientPaging) {
|
|
739
|
-
this.table.setAttr('currentPage', 1);
|
|
740
|
-
this.table.updateVisibleRecords();
|
|
741
|
-
}
|
|
742
|
-
};
|
|
743
|
-
LibTableComponent.prototype.tableColumnSort = function (columnName) {
|
|
744
|
-
this.table.setRequiredOrder(columnName);
|
|
745
|
-
return this.clientPaging ? this.table.localSortData() : this.table.notifyGetDataAction();
|
|
746
|
-
};
|
|
747
|
-
LibTableComponent.prototype.updateTableView = function () {
|
|
748
|
-
var currentPageRecords = this.visibleRecords;
|
|
749
|
-
if (this.clientPaging) {
|
|
750
|
-
currentPageRecords = currentPageRecords.map(function (record, i) { return (Object.assign({ id: i + 1 }, record)); })
|
|
751
|
-
.slice((this.currentPage - 1) * this.recordsPerPage, (this.currentPage - 1) * this.recordsPerPage + this.recordsPerPage);
|
|
752
|
-
this.totalRecordsNumber = this.visibleRecords.length;
|
|
753
|
-
}
|
|
754
|
-
this.currentPageRecords = currentPageRecords;
|
|
731
|
+
LibTableComponent.prototype.filterHasChanged = function (columnName, values) {
|
|
732
|
+
this.table.addColumnFilter(columnName, values);
|
|
755
733
|
};
|
|
756
734
|
return LibTableComponent;
|
|
757
735
|
}());
|
|
@@ -1311,6 +1289,7 @@
|
|
|
1311
1289
|
function RecordTableColumn(recTableColReceived, formConfig) {
|
|
1312
1290
|
var _a, _b, _c;
|
|
1313
1291
|
this._formConfig = formConfig;
|
|
1292
|
+
this.filterDef = null;
|
|
1314
1293
|
if (recTableColReceived) {
|
|
1315
1294
|
this.fieldCode = recTableColReceived.fieldCode;
|
|
1316
1295
|
this.fieldTitle = recTableColReceived.fieldTitle;
|
|
@@ -1354,6 +1333,17 @@
|
|
|
1354
1333
|
RecordTableColumn.prototype.removeFilter = function () {
|
|
1355
1334
|
this.filterSetup = null;
|
|
1356
1335
|
};
|
|
1336
|
+
Object.defineProperty(RecordTableColumn.prototype, "options", {
|
|
1337
|
+
get: function () {
|
|
1338
|
+
var _a, _b, _c, _d;
|
|
1339
|
+
if (((_b = (_a = this.filterDef) === null || _a === void 0 ? void 0 : _a.operators) === null || _b === void 0 ? void 0 : _b.length) === 1 && ((_c = this.filterDef) === null || _c === void 0 ? void 0 : _c.operators[0]) === 'IN') {
|
|
1340
|
+
return (_d = this.filterDef) === null || _d === void 0 ? void 0 : _d.options;
|
|
1341
|
+
}
|
|
1342
|
+
return null;
|
|
1343
|
+
},
|
|
1344
|
+
enumerable: false,
|
|
1345
|
+
configurable: true
|
|
1346
|
+
});
|
|
1357
1347
|
return RecordTableColumn;
|
|
1358
1348
|
}());
|
|
1359
1349
|
|
|
@@ -1549,12 +1539,12 @@
|
|
|
1549
1539
|
_this.tableTitle = tableReceived.tableTitle;
|
|
1550
1540
|
_this._appendPages = (_a = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.append) !== null && _a !== void 0 ? _a : false;
|
|
1551
1541
|
_this.selectable = (_b = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.selectable) !== null && _b !== void 0 ? _b : false;
|
|
1542
|
+
_this.selectionBackend = (_c = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.selectionBackend) !== null && _c !== void 0 ? _c : false;
|
|
1543
|
+
_this.sortable = (_d = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.sortable) !== null && _d !== void 0 ? _d : false;
|
|
1552
1544
|
_this.setAttr('allSelected', false);
|
|
1553
1545
|
_this.setAttr('tableCode', tableReceived.tableCode);
|
|
1554
|
-
_this.setAttr('clientPaging', (
|
|
1555
|
-
_this.setAttr('globalSearch', (
|
|
1556
|
-
_this.setAttr('selectionBackend', (_e = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.selectionBackend) !== null && _e !== void 0 ? _e : false);
|
|
1557
|
-
_this.setAttr('sortable', (_f = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.sortable) !== null && _f !== void 0 ? _f : false);
|
|
1546
|
+
_this.setAttr('clientPaging', (_e = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.clientPaging) !== null && _e !== void 0 ? _e : true);
|
|
1547
|
+
_this.setAttr('globalSearch', (_f = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.simpleFilter) !== null && _f !== void 0 ? _f : false);
|
|
1558
1548
|
_this.setAttr('sorting', { columnName: '', direction: '' });
|
|
1559
1549
|
_this.setAttr('recordsPerPage', formConfig.defaultRecordsPerPage);
|
|
1560
1550
|
if (tableReceived.fields) {
|
|
@@ -1721,10 +1711,10 @@
|
|
|
1721
1711
|
return null;
|
|
1722
1712
|
};
|
|
1723
1713
|
RecordTable.prototype.clean = function () {
|
|
1724
|
-
this.visibleRecords = [];
|
|
1725
1714
|
this.tableRecords = [];
|
|
1726
1715
|
this.unSelectAll();
|
|
1727
1716
|
this.tableRecordObj = {};
|
|
1717
|
+
this.updateVisibleRecords();
|
|
1728
1718
|
};
|
|
1729
1719
|
RecordTable.prototype.selectAll = function () {
|
|
1730
1720
|
this.setAttr('allSelected', true);
|
|
@@ -1768,14 +1758,27 @@
|
|
|
1768
1758
|
};
|
|
1769
1759
|
RecordTable.prototype.appendRecords = function (records) { this.setTableRecords(records, true); };
|
|
1770
1760
|
RecordTable.prototype.replaceRecords = function (records) { this.setTableRecords(records, false); };
|
|
1761
|
+
RecordTable.prototype.changePage = function (requestedPage) {
|
|
1762
|
+
if (this.clientPaging) {
|
|
1763
|
+
this.setAttr('currentPage', requestedPage);
|
|
1764
|
+
this.updateVisibleRecords();
|
|
1765
|
+
}
|
|
1766
|
+
else {
|
|
1767
|
+
this.notifyGetDataAction(requestedPage);
|
|
1768
|
+
}
|
|
1769
|
+
};
|
|
1771
1770
|
RecordTable.prototype.updateVisibleRecords = function () {
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1771
|
+
// updateView const changeViewAttributes = ['currentPage', 'recordsPerPage', 'sorting'];
|
|
1772
|
+
var visibleRecords;
|
|
1773
|
+
if (this.clientPaging) {
|
|
1774
|
+
var filteredRecords = this.getFilteredRecords();
|
|
1775
|
+
this.setAttr('totalRecordsNumber', filteredRecords.length);
|
|
1776
|
+
visibleRecords = filteredRecords.slice((this.currentPage - 1) * this.recordsPerPage, (this.currentPage - 1) * this.recordsPerPage + this.recordsPerPage);
|
|
1775
1777
|
}
|
|
1776
1778
|
else {
|
|
1777
|
-
|
|
1779
|
+
visibleRecords = this.tableRecords;
|
|
1778
1780
|
}
|
|
1781
|
+
this.setAttr('visibleRecords', visibleRecords);
|
|
1779
1782
|
};
|
|
1780
1783
|
RecordTable.prototype.updateFromServer = function (tableReceived) {
|
|
1781
1784
|
var _a;
|
|
@@ -1786,12 +1789,7 @@
|
|
|
1786
1789
|
this.recordsNumber = tableReceived.recordsNumber;
|
|
1787
1790
|
this.setAttr('currentPage', (_a = +(tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.currentPage)) !== null && _a !== void 0 ? _a : 1);
|
|
1788
1791
|
this.setAttr('recordsPerPage', +tableReceived.recordsPerPage);
|
|
1789
|
-
|
|
1790
|
-
this.setAttr('totalRecordsNumber', +tableReceived.tableRecords.length);
|
|
1791
|
-
}
|
|
1792
|
-
else {
|
|
1793
|
-
this.setAttr('totalRecordsNumber', +tableReceived.totalRecordsNumber);
|
|
1794
|
-
}
|
|
1792
|
+
this.setAttr('totalRecordsNumber', (this.clientPaging) ? tableReceived.tableRecords.length : +tableReceived.totalRecordsNumber);
|
|
1795
1793
|
this.setAttr('sorting', {
|
|
1796
1794
|
columnName: tableReceived.sortingColumn || '',
|
|
1797
1795
|
direction: tableReceived.sortingDirection || ''
|
|
@@ -1826,6 +1824,9 @@
|
|
|
1826
1824
|
RecordTable.prototype.setGlobalFilterString = function (text) {
|
|
1827
1825
|
var _a;
|
|
1828
1826
|
this.globalFilterStrings = (_a = text.split(' ').filter(function (t) { return t && t.trim().length > 0; }).map(function (t) { return t.trim(); })) !== null && _a !== void 0 ? _a : [];
|
|
1827
|
+
if (this.clientPaging) {
|
|
1828
|
+
this.changePage(1);
|
|
1829
|
+
}
|
|
1829
1830
|
};
|
|
1830
1831
|
RecordTable.prototype.addFilterDefinition = function (filterDefinition) {
|
|
1831
1832
|
var tableColumn = this.columnDefinition(filterDefinition.fieldCode);
|
|
@@ -1881,6 +1882,15 @@
|
|
|
1881
1882
|
configurable: true
|
|
1882
1883
|
});
|
|
1883
1884
|
// Ordenamiento de registros local
|
|
1885
|
+
RecordTable.prototype.sort = function (columnName) {
|
|
1886
|
+
this.setRequiredOrder(columnName);
|
|
1887
|
+
if (this.clientPaging) {
|
|
1888
|
+
this.localSortData();
|
|
1889
|
+
}
|
|
1890
|
+
else {
|
|
1891
|
+
this.notifyGetDataAction();
|
|
1892
|
+
}
|
|
1893
|
+
};
|
|
1884
1894
|
RecordTable.prototype.setRequiredOrder = function (columnField) {
|
|
1885
1895
|
if (columnField !== this.sorting.columnName) {
|
|
1886
1896
|
this.setAttr('sorting', {
|