tuain-ng-forms-lib 12.0.60 → 12.0.64
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 +56 -47
- package/bundles/tuain-ng-forms-lib.umd.js.map +1 -1
- package/esm2015/lib/classes/forms/table/column.js +11 -1
- package/esm2015/lib/classes/forms/table/table.js +35 -10
- package/esm2015/lib/components/elements/tables/table.component.js +9 -39
- package/fesm2015/tuain-ng-forms-lib.js +52 -47
- package/fesm2015/tuain-ng-forms-lib.js.map +1 -1
- package/lib/classes/forms/table/column.d.ts +2 -0
- package/lib/classes/forms/table/table.d.ts +2 -0
- package/lib/components/elements/tables/table.component.d.ts +7 -14
- 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;
|
|
@@ -719,47 +717,19 @@
|
|
|
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); };
|
|
722
|
-
LibTableComponent.prototype.changePage = function (requestedPage) {
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
this.updateTableView();
|
|
726
|
-
}
|
|
727
|
-
else {
|
|
728
|
-
this.table.notifyGetDataAction(requestedPage);
|
|
729
|
-
}
|
|
730
|
-
};
|
|
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 : ''); };
|
|
731
723
|
LibTableComponent.prototype.syncAttribute = function (name, value) {
|
|
732
724
|
try {
|
|
733
|
-
// this.hasOwnProperty(name)
|
|
734
725
|
this[name] = value;
|
|
735
726
|
}
|
|
736
727
|
catch (e) {
|
|
737
728
|
console.log('Error asignando valor a un atributo del objeto');
|
|
738
729
|
}
|
|
739
|
-
if (changeViewAttributes.includes(name)) {
|
|
740
|
-
this.updateTableView();
|
|
741
|
-
}
|
|
742
730
|
};
|
|
743
|
-
LibTableComponent.prototype.
|
|
744
|
-
|
|
745
|
-
this.table.setGlobalFilterString((_b = (_a = this.globalFilterString) === null || _a === void 0 ? void 0 : _a.trim()) !== null && _b !== void 0 ? _b : '');
|
|
746
|
-
if (this.clientPaging) {
|
|
747
|
-
this.table.setAttr('currentPage', 1);
|
|
748
|
-
this.table.updateVisibleRecords();
|
|
749
|
-
}
|
|
750
|
-
};
|
|
751
|
-
LibTableComponent.prototype.tableColumnSort = function (columnName) {
|
|
752
|
-
this.table.setRequiredOrder(columnName);
|
|
753
|
-
return this.clientPaging ? this.table.localSortData() : this.table.notifyGetDataAction();
|
|
754
|
-
};
|
|
755
|
-
LibTableComponent.prototype.updateTableView = function () {
|
|
756
|
-
var currentPageRecords = this.visibleRecords;
|
|
757
|
-
if (this.clientPaging) {
|
|
758
|
-
currentPageRecords = currentPageRecords.map(function (record, i) { return (Object.assign({ id: i + 1 }, record)); })
|
|
759
|
-
.slice((this.currentPage - 1) * this.recordsPerPage, (this.currentPage - 1) * this.recordsPerPage + this.recordsPerPage);
|
|
760
|
-
this.totalRecordsNumber = this.visibleRecords.length;
|
|
761
|
-
}
|
|
762
|
-
this.currentPageRecords = currentPageRecords;
|
|
731
|
+
LibTableComponent.prototype.filterHasChanged = function (columnName, values) {
|
|
732
|
+
this.table.addColumnFilter(columnName, values);
|
|
763
733
|
};
|
|
764
734
|
return LibTableComponent;
|
|
765
735
|
}());
|
|
@@ -1318,7 +1288,10 @@
|
|
|
1318
1288
|
var RecordTableColumn = /** @class */ (function () {
|
|
1319
1289
|
function RecordTableColumn(recTableColReceived, formConfig) {
|
|
1320
1290
|
var _a, _b, _c;
|
|
1291
|
+
// Filtros
|
|
1292
|
+
this.filterVisible = false;
|
|
1321
1293
|
this._formConfig = formConfig;
|
|
1294
|
+
this.filterDef = null;
|
|
1322
1295
|
if (recTableColReceived) {
|
|
1323
1296
|
this.fieldCode = recTableColReceived.fieldCode;
|
|
1324
1297
|
this.fieldTitle = recTableColReceived.fieldTitle;
|
|
@@ -1362,6 +1335,17 @@
|
|
|
1362
1335
|
RecordTableColumn.prototype.removeFilter = function () {
|
|
1363
1336
|
this.filterSetup = null;
|
|
1364
1337
|
};
|
|
1338
|
+
Object.defineProperty(RecordTableColumn.prototype, "options", {
|
|
1339
|
+
get: function () {
|
|
1340
|
+
var _a, _b, _c, _d;
|
|
1341
|
+
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') {
|
|
1342
|
+
return (_d = this.filterDef) === null || _d === void 0 ? void 0 : _d.options;
|
|
1343
|
+
}
|
|
1344
|
+
return null;
|
|
1345
|
+
},
|
|
1346
|
+
enumerable: false,
|
|
1347
|
+
configurable: true
|
|
1348
|
+
});
|
|
1365
1349
|
return RecordTableColumn;
|
|
1366
1350
|
}());
|
|
1367
1351
|
|
|
@@ -1557,12 +1541,12 @@
|
|
|
1557
1541
|
_this.tableTitle = tableReceived.tableTitle;
|
|
1558
1542
|
_this._appendPages = (_a = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.append) !== null && _a !== void 0 ? _a : false;
|
|
1559
1543
|
_this.selectable = (_b = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.selectable) !== null && _b !== void 0 ? _b : false;
|
|
1544
|
+
_this.selectionBackend = (_c = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.selectionBackend) !== null && _c !== void 0 ? _c : false;
|
|
1545
|
+
_this.sortable = (_d = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.sortable) !== null && _d !== void 0 ? _d : false;
|
|
1560
1546
|
_this.setAttr('allSelected', false);
|
|
1561
1547
|
_this.setAttr('tableCode', tableReceived.tableCode);
|
|
1562
|
-
_this.setAttr('clientPaging', (
|
|
1563
|
-
_this.setAttr('globalSearch', (
|
|
1564
|
-
_this.setAttr('selectionBackend', (_e = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.selectionBackend) !== null && _e !== void 0 ? _e : false);
|
|
1565
|
-
_this.setAttr('sortable', (_f = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.sortable) !== null && _f !== void 0 ? _f : false);
|
|
1548
|
+
_this.setAttr('clientPaging', (_e = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.clientPaging) !== null && _e !== void 0 ? _e : true);
|
|
1549
|
+
_this.setAttr('globalSearch', (_f = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.simpleFilter) !== null && _f !== void 0 ? _f : false);
|
|
1566
1550
|
_this.setAttr('sorting', { columnName: '', direction: '' });
|
|
1567
1551
|
_this.setAttr('recordsPerPage', formConfig.defaultRecordsPerPage);
|
|
1568
1552
|
if (tableReceived.fields) {
|
|
@@ -1729,10 +1713,10 @@
|
|
|
1729
1713
|
return null;
|
|
1730
1714
|
};
|
|
1731
1715
|
RecordTable.prototype.clean = function () {
|
|
1732
|
-
this.visibleRecords = [];
|
|
1733
1716
|
this.tableRecords = [];
|
|
1734
1717
|
this.unSelectAll();
|
|
1735
1718
|
this.tableRecordObj = {};
|
|
1719
|
+
this.updateVisibleRecords();
|
|
1736
1720
|
};
|
|
1737
1721
|
RecordTable.prototype.selectAll = function () {
|
|
1738
1722
|
this.setAttr('allSelected', true);
|
|
@@ -1776,14 +1760,27 @@
|
|
|
1776
1760
|
};
|
|
1777
1761
|
RecordTable.prototype.appendRecords = function (records) { this.setTableRecords(records, true); };
|
|
1778
1762
|
RecordTable.prototype.replaceRecords = function (records) { this.setTableRecords(records, false); };
|
|
1763
|
+
RecordTable.prototype.changePage = function (requestedPage) {
|
|
1764
|
+
if (this.clientPaging) {
|
|
1765
|
+
this.setAttr('currentPage', requestedPage);
|
|
1766
|
+
this.updateVisibleRecords();
|
|
1767
|
+
}
|
|
1768
|
+
else {
|
|
1769
|
+
this.notifyGetDataAction(requestedPage);
|
|
1770
|
+
}
|
|
1771
|
+
};
|
|
1779
1772
|
RecordTable.prototype.updateVisibleRecords = function () {
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1773
|
+
// updateView const changeViewAttributes = ['currentPage', 'recordsPerPage', 'sorting'];
|
|
1774
|
+
var visibleRecords;
|
|
1775
|
+
if (this.clientPaging) {
|
|
1776
|
+
var filteredRecords = this.getFilteredRecords();
|
|
1777
|
+
this.setAttr('totalRecordsNumber', filteredRecords.length);
|
|
1778
|
+
visibleRecords = filteredRecords.slice((this.currentPage - 1) * this.recordsPerPage, (this.currentPage - 1) * this.recordsPerPage + this.recordsPerPage);
|
|
1783
1779
|
}
|
|
1784
1780
|
else {
|
|
1785
|
-
|
|
1781
|
+
visibleRecords = this.tableRecords;
|
|
1786
1782
|
}
|
|
1783
|
+
this.setAttr('visibleRecords', visibleRecords);
|
|
1787
1784
|
};
|
|
1788
1785
|
RecordTable.prototype.updateFromServer = function (tableReceived) {
|
|
1789
1786
|
var _a;
|
|
@@ -1829,6 +1826,9 @@
|
|
|
1829
1826
|
RecordTable.prototype.setGlobalFilterString = function (text) {
|
|
1830
1827
|
var _a;
|
|
1831
1828
|
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 : [];
|
|
1829
|
+
if (this.clientPaging) {
|
|
1830
|
+
this.changePage(1);
|
|
1831
|
+
}
|
|
1832
1832
|
};
|
|
1833
1833
|
RecordTable.prototype.addFilterDefinition = function (filterDefinition) {
|
|
1834
1834
|
var tableColumn = this.columnDefinition(filterDefinition.fieldCode);
|
|
@@ -1884,6 +1884,15 @@
|
|
|
1884
1884
|
configurable: true
|
|
1885
1885
|
});
|
|
1886
1886
|
// Ordenamiento de registros local
|
|
1887
|
+
RecordTable.prototype.sort = function (columnName) {
|
|
1888
|
+
this.setRequiredOrder(columnName);
|
|
1889
|
+
if (this.clientPaging) {
|
|
1890
|
+
this.localSortData();
|
|
1891
|
+
}
|
|
1892
|
+
else {
|
|
1893
|
+
this.notifyGetDataAction();
|
|
1894
|
+
}
|
|
1895
|
+
};
|
|
1887
1896
|
RecordTable.prototype.setRequiredOrder = function (columnField) {
|
|
1888
1897
|
if (columnField !== this.sorting.columnName) {
|
|
1889
1898
|
this.setAttr('sorting', {
|