tuain-ng-forms-lib 12.0.58 → 12.0.62
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 +53 -40
- 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 -11
- package/esm2015/lib/components/elements/tables/table.component.js +7 -31
- package/fesm2015/tuain-ng-forms-lib.js +49 -40
- 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 -16
- package/package.json +1 -1
- package/tuain-ng-forms-lib.metadata.json +1 -1
|
@@ -669,16 +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.
|
|
679
|
+
this.totalRecordsNumber = 0;
|
|
680
680
|
this.allSelected = false;
|
|
681
|
-
this.currentPage = 1;
|
|
682
681
|
this.loaded = false;
|
|
683
682
|
this.selectable = false;
|
|
684
683
|
this.hasActions = false;
|
|
@@ -715,42 +714,19 @@
|
|
|
715
714
|
LibTableComponent.prototype.tableGlobalAction = function (actionCode) { this.table.notifyGlobalAction(actionCode); };
|
|
716
715
|
LibTableComponent.prototype.tableSelectionAction = function (actionCode) { this.table.notifySelectionAction(actionCode); };
|
|
717
716
|
LibTableComponent.prototype.tableActionSelected = function (actionEvent) { this.table.notifyInlineAction(actionEvent); };
|
|
718
|
-
LibTableComponent.prototype.changePage = function (requestedPage) { !this.clientPaging && this.table.notifyGetDataAction(requestedPage); };
|
|
719
717
|
LibTableComponent.prototype.tableSelectionToggle = function (recordId) { this.table.notifyRecordSelection(recordId); };
|
|
720
718
|
LibTableComponent.prototype.toggleSelectAll = function () { return (this.allSelected) ? this.table.unSelectAll() : this.table.selectAll(); };
|
|
721
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 : ''); };
|
|
722
723
|
LibTableComponent.prototype.syncAttribute = function (name, value) {
|
|
723
724
|
try {
|
|
724
|
-
// this.hasOwnProperty(name)
|
|
725
725
|
this[name] = value;
|
|
726
726
|
}
|
|
727
727
|
catch (e) {
|
|
728
728
|
console.log('Error asignando valor a un atributo del objeto');
|
|
729
729
|
}
|
|
730
|
-
if (changeViewAttributes.includes(name)) {
|
|
731
|
-
this.updateTableView();
|
|
732
|
-
}
|
|
733
|
-
};
|
|
734
|
-
LibTableComponent.prototype.globalFilterChanged = function () {
|
|
735
|
-
var _a, _b;
|
|
736
|
-
this.table.setGlobalFilterString((_b = (_a = this.globalFilterString) === null || _a === void 0 ? void 0 : _a.trim()) !== null && _b !== void 0 ? _b : '');
|
|
737
|
-
if (this.clientPaging) {
|
|
738
|
-
this.table.setAttr('currentPage', 1);
|
|
739
|
-
this.table.updateVisibleRecords();
|
|
740
|
-
}
|
|
741
|
-
};
|
|
742
|
-
LibTableComponent.prototype.tableColumnSort = function (columnName) {
|
|
743
|
-
this.table.setRequiredOrder(columnName);
|
|
744
|
-
return this.clientPaging ? this.table.localSortData() : this.table.notifyGetDataAction();
|
|
745
|
-
};
|
|
746
|
-
LibTableComponent.prototype.updateTableView = function () {
|
|
747
|
-
var currentPageRecords = this.visibleRecords;
|
|
748
|
-
if (this.clientPaging) {
|
|
749
|
-
currentPageRecords = currentPageRecords.map(function (record, i) { return (Object.assign({ id: i + 1 }, record)); })
|
|
750
|
-
.slice((this.currentPage - 1) * this.recordsPerPage, (this.currentPage - 1) * this.recordsPerPage + this.recordsPerPage);
|
|
751
|
-
this.totalRecordsNumber = this.visibleRecords.length;
|
|
752
|
-
}
|
|
753
|
-
this.currentPageRecords = currentPageRecords;
|
|
754
730
|
};
|
|
755
731
|
return LibTableComponent;
|
|
756
732
|
}());
|
|
@@ -1310,6 +1286,7 @@
|
|
|
1310
1286
|
function RecordTableColumn(recTableColReceived, formConfig) {
|
|
1311
1287
|
var _a, _b, _c;
|
|
1312
1288
|
this._formConfig = formConfig;
|
|
1289
|
+
this.filterDef = null;
|
|
1313
1290
|
if (recTableColReceived) {
|
|
1314
1291
|
this.fieldCode = recTableColReceived.fieldCode;
|
|
1315
1292
|
this.fieldTitle = recTableColReceived.fieldTitle;
|
|
@@ -1353,6 +1330,17 @@
|
|
|
1353
1330
|
RecordTableColumn.prototype.removeFilter = function () {
|
|
1354
1331
|
this.filterSetup = null;
|
|
1355
1332
|
};
|
|
1333
|
+
Object.defineProperty(RecordTableColumn.prototype, "options", {
|
|
1334
|
+
get: function () {
|
|
1335
|
+
var _a, _b, _c, _d;
|
|
1336
|
+
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') {
|
|
1337
|
+
return (_d = this.filterDef) === null || _d === void 0 ? void 0 : _d.options;
|
|
1338
|
+
}
|
|
1339
|
+
return null;
|
|
1340
|
+
},
|
|
1341
|
+
enumerable: false,
|
|
1342
|
+
configurable: true
|
|
1343
|
+
});
|
|
1356
1344
|
return RecordTableColumn;
|
|
1357
1345
|
}());
|
|
1358
1346
|
|
|
@@ -1548,12 +1536,12 @@
|
|
|
1548
1536
|
_this.tableTitle = tableReceived.tableTitle;
|
|
1549
1537
|
_this._appendPages = (_a = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.append) !== null && _a !== void 0 ? _a : false;
|
|
1550
1538
|
_this.selectable = (_b = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.selectable) !== null && _b !== void 0 ? _b : false;
|
|
1539
|
+
_this.selectionBackend = (_c = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.selectionBackend) !== null && _c !== void 0 ? _c : false;
|
|
1540
|
+
_this.sortable = (_d = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.sortable) !== null && _d !== void 0 ? _d : false;
|
|
1551
1541
|
_this.setAttr('allSelected', false);
|
|
1552
1542
|
_this.setAttr('tableCode', tableReceived.tableCode);
|
|
1553
|
-
_this.setAttr('clientPaging', (
|
|
1554
|
-
_this.setAttr('globalSearch', (
|
|
1555
|
-
_this.setAttr('selectionBackend', (_e = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.selectionBackend) !== null && _e !== void 0 ? _e : false);
|
|
1556
|
-
_this.setAttr('sortable', (_f = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.sortable) !== null && _f !== void 0 ? _f : false);
|
|
1543
|
+
_this.setAttr('clientPaging', (_e = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.clientPaging) !== null && _e !== void 0 ? _e : true);
|
|
1544
|
+
_this.setAttr('globalSearch', (_f = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.simpleFilter) !== null && _f !== void 0 ? _f : false);
|
|
1557
1545
|
_this.setAttr('sorting', { columnName: '', direction: '' });
|
|
1558
1546
|
_this.setAttr('recordsPerPage', formConfig.defaultRecordsPerPage);
|
|
1559
1547
|
if (tableReceived.fields) {
|
|
@@ -1720,10 +1708,10 @@
|
|
|
1720
1708
|
return null;
|
|
1721
1709
|
};
|
|
1722
1710
|
RecordTable.prototype.clean = function () {
|
|
1723
|
-
this.visibleRecords = [];
|
|
1724
1711
|
this.tableRecords = [];
|
|
1725
1712
|
this.unSelectAll();
|
|
1726
1713
|
this.tableRecordObj = {};
|
|
1714
|
+
this.updateVisibleRecords();
|
|
1727
1715
|
};
|
|
1728
1716
|
RecordTable.prototype.selectAll = function () {
|
|
1729
1717
|
this.setAttr('allSelected', true);
|
|
@@ -1767,14 +1755,27 @@
|
|
|
1767
1755
|
};
|
|
1768
1756
|
RecordTable.prototype.appendRecords = function (records) { this.setTableRecords(records, true); };
|
|
1769
1757
|
RecordTable.prototype.replaceRecords = function (records) { this.setTableRecords(records, false); };
|
|
1758
|
+
RecordTable.prototype.changePage = function (requestedPage) {
|
|
1759
|
+
if (this.clientPaging) {
|
|
1760
|
+
this.setAttr('currentPage', requestedPage);
|
|
1761
|
+
this.updateVisibleRecords();
|
|
1762
|
+
}
|
|
1763
|
+
else {
|
|
1764
|
+
this.notifyGetDataAction(requestedPage);
|
|
1765
|
+
}
|
|
1766
|
+
};
|
|
1770
1767
|
RecordTable.prototype.updateVisibleRecords = function () {
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1768
|
+
// updateView const changeViewAttributes = ['currentPage', 'recordsPerPage', 'sorting'];
|
|
1769
|
+
var visibleRecords;
|
|
1770
|
+
if (this.clientPaging) {
|
|
1771
|
+
var filteredRecords = this.getFilteredRecords();
|
|
1772
|
+
this.setAttr('totalRecordsNumber', filteredRecords.length);
|
|
1773
|
+
visibleRecords = filteredRecords.slice((this.currentPage - 1) * this.recordsPerPage, (this.currentPage - 1) * this.recordsPerPage + this.recordsPerPage);
|
|
1774
1774
|
}
|
|
1775
1775
|
else {
|
|
1776
|
-
|
|
1776
|
+
visibleRecords = this.tableRecords;
|
|
1777
1777
|
}
|
|
1778
|
+
this.setAttr('visibleRecords', visibleRecords);
|
|
1778
1779
|
};
|
|
1779
1780
|
RecordTable.prototype.updateFromServer = function (tableReceived) {
|
|
1780
1781
|
var _a;
|
|
@@ -1785,7 +1786,7 @@
|
|
|
1785
1786
|
this.recordsNumber = tableReceived.recordsNumber;
|
|
1786
1787
|
this.setAttr('currentPage', (_a = +(tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.currentPage)) !== null && _a !== void 0 ? _a : 1);
|
|
1787
1788
|
this.setAttr('recordsPerPage', +tableReceived.recordsPerPage);
|
|
1788
|
-
this.setAttr('totalRecordsNumber', +tableReceived.totalRecordsNumber);
|
|
1789
|
+
this.setAttr('totalRecordsNumber', (this.clientPaging) ? tableReceived.tableRecords.length : +tableReceived.totalRecordsNumber);
|
|
1789
1790
|
this.setAttr('sorting', {
|
|
1790
1791
|
columnName: tableReceived.sortingColumn || '',
|
|
1791
1792
|
direction: tableReceived.sortingDirection || ''
|
|
@@ -1820,6 +1821,9 @@
|
|
|
1820
1821
|
RecordTable.prototype.setGlobalFilterString = function (text) {
|
|
1821
1822
|
var _a;
|
|
1822
1823
|
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 : [];
|
|
1824
|
+
if (this.clientPaging) {
|
|
1825
|
+
this.changePage(1);
|
|
1826
|
+
}
|
|
1823
1827
|
};
|
|
1824
1828
|
RecordTable.prototype.addFilterDefinition = function (filterDefinition) {
|
|
1825
1829
|
var tableColumn = this.columnDefinition(filterDefinition.fieldCode);
|
|
@@ -1875,6 +1879,15 @@
|
|
|
1875
1879
|
configurable: true
|
|
1876
1880
|
});
|
|
1877
1881
|
// Ordenamiento de registros local
|
|
1882
|
+
RecordTable.prototype.sort = function (columnName) {
|
|
1883
|
+
this.setRequiredOrder(columnName);
|
|
1884
|
+
if (this.clientPaging) {
|
|
1885
|
+
this.localSortData();
|
|
1886
|
+
}
|
|
1887
|
+
else {
|
|
1888
|
+
this.notifyGetDataAction();
|
|
1889
|
+
}
|
|
1890
|
+
};
|
|
1878
1891
|
RecordTable.prototype.setRequiredOrder = function (columnField) {
|
|
1879
1892
|
if (columnField !== this.sorting.columnName) {
|
|
1880
1893
|
this.setAttr('sorting', {
|