tuain-ng-forms-lib 14.5.31 → 14.5.33
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/esm2020/lib/classes/forms/element.mjs +2 -1
- package/esm2020/lib/classes/forms/piece-propagate.mjs +2 -1
- package/esm2020/lib/classes/forms/table/column.mjs +2 -2
- package/esm2020/lib/classes/forms/table/row-data.mjs +6 -1
- package/esm2020/lib/classes/forms/table/table.mjs +22 -1
- package/esm2020/lib/components/elements/tables/table.component.mjs +3 -1
- package/fesm2015/tuain-ng-forms-lib.mjs +32 -2
- package/fesm2015/tuain-ng-forms-lib.mjs.map +1 -1
- package/fesm2020/tuain-ng-forms-lib.mjs +31 -1
- package/fesm2020/tuain-ng-forms-lib.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -433,6 +433,7 @@ class LibTableComponent extends ElementComponent {
|
|
|
433
433
|
// Subscripción a cambios en atributos
|
|
434
434
|
this.table?.attributeChange.subscribe(event => {
|
|
435
435
|
const { name: attrName, value } = event;
|
|
436
|
+
console.log(`Llegó atributo ${attrName} propagado...`);
|
|
436
437
|
this.defaultProcessAttributeChange(attrName, value);
|
|
437
438
|
this.customProcessAttributeChange(attrName, value);
|
|
438
439
|
});
|
|
@@ -451,6 +452,7 @@ class LibTableComponent extends ElementComponent {
|
|
|
451
452
|
defaultProcessAttributeChange(attribute, value) {
|
|
452
453
|
try {
|
|
453
454
|
if (attribute === 'visibleRecords') {
|
|
455
|
+
console.log('Se deben actualizar los visibleRecords');
|
|
454
456
|
this.updateTableData();
|
|
455
457
|
}
|
|
456
458
|
return super.defaultProcessAttributeChange(attribute, value);
|
|
@@ -640,6 +642,7 @@ class FormPiecePropagate extends FormPiece {
|
|
|
640
642
|
}
|
|
641
643
|
get attributeChange() { return this._attributeChange; }
|
|
642
644
|
propagateAttribute(name, value) {
|
|
645
|
+
console.log(`Propagando atributo ${name}`);
|
|
643
646
|
this._attributeChange?.next({ name, value });
|
|
644
647
|
}
|
|
645
648
|
setCustomAttribute(name, value) {
|
|
@@ -674,6 +677,7 @@ class FormElement extends FormPiecePropagate {
|
|
|
674
677
|
;
|
|
675
678
|
setAttr(attr, value) {
|
|
676
679
|
const { name: attrName, propagate: name } = attr;
|
|
680
|
+
console.log(`Asignando valor a ${attrName}`);
|
|
677
681
|
this[attrName] = value;
|
|
678
682
|
name && this.propagateAttribute(name, value);
|
|
679
683
|
}
|
|
@@ -1229,7 +1233,7 @@ class RecordTableColumn extends FormPiece {
|
|
|
1229
1233
|
addFilter(columnValues, operator) {
|
|
1230
1234
|
this.filterSetup = {
|
|
1231
1235
|
fieldCode: this.fieldCode,
|
|
1232
|
-
operator: operator ?? this.filterDef?.operators[0],
|
|
1236
|
+
operator: operator ?? this.filterDef?.operators[0] ?? 'IN',
|
|
1233
1237
|
values: columnValues,
|
|
1234
1238
|
};
|
|
1235
1239
|
}
|
|
@@ -1349,13 +1353,17 @@ class TableRecordData {
|
|
|
1349
1353
|
return true;
|
|
1350
1354
|
}
|
|
1351
1355
|
hasCondition(columnFilters) {
|
|
1356
|
+
console.log(`Evaluación de condición sobre un registro...`);
|
|
1352
1357
|
if (!columnFilters || columnFilters.length === 0) {
|
|
1353
1358
|
return true;
|
|
1354
1359
|
}
|
|
1355
1360
|
for (const condition of columnFilters) {
|
|
1356
1361
|
const { fieldCode, operator, values } = condition;
|
|
1362
|
+
console.log(`1. Evaluación condición columna ${fieldCode} / ${operator}`);
|
|
1357
1363
|
if (this.recordData.hasOwnProperty(fieldCode)) {
|
|
1358
1364
|
const fieldValue = this.recordData[fieldCode];
|
|
1365
|
+
console.log(`2. Evaluación condición columna ${fieldCode}/(${fieldValue}) con ${operator}`);
|
|
1366
|
+
console.log(values);
|
|
1359
1367
|
const stringValue = fieldValue.toString().toUpperCase();
|
|
1360
1368
|
if (operator === operators.G && fieldValue <= values[0]) {
|
|
1361
1369
|
return false;
|
|
@@ -1370,6 +1378,7 @@ class TableRecordData {
|
|
|
1370
1378
|
return false;
|
|
1371
1379
|
}
|
|
1372
1380
|
if (operator === operators.IN && !values.includes(fieldValue)) {
|
|
1381
|
+
console.log(`Evaluación falsa de condición IN...`);
|
|
1373
1382
|
return false;
|
|
1374
1383
|
}
|
|
1375
1384
|
if (operator === operators.EQ) {
|
|
@@ -1624,12 +1633,17 @@ class RecordTable extends FormElement {
|
|
|
1624
1633
|
}
|
|
1625
1634
|
}
|
|
1626
1635
|
updateVisibleRecords() {
|
|
1636
|
+
console.log('updateVisibleRecords');
|
|
1627
1637
|
let visibleRecords;
|
|
1628
1638
|
if (this.clientPaging) {
|
|
1639
|
+
console.log('this.clientPaging');
|
|
1640
|
+
console.log('a por getFilteredRecords');
|
|
1629
1641
|
let filteredRecords = this.getFilteredRecords();
|
|
1642
|
+
console.log('regresando de getFilteredRecords');
|
|
1630
1643
|
this.setAttr(attrs.totalRecordsNumber, filteredRecords.length);
|
|
1631
1644
|
const sliceNumber1 = (this.currentPage - 1) * this.recordsPerPage;
|
|
1632
1645
|
const sliceNumber2 = (this.currentPage - 1) * this.recordsPerPage + this.recordsPerPage;
|
|
1646
|
+
console.log('Actualizando visibleRecords');
|
|
1633
1647
|
visibleRecords = filteredRecords.slice(sliceNumber1, sliceNumber2);
|
|
1634
1648
|
const recordsLastPage = this.totalRecordsNumber % this.recordsPerPage;
|
|
1635
1649
|
const totalPages = Math.trunc(this.totalRecordsNumber / this.recordsPerPage + (recordsLastPage ? 1 : 0));
|
|
@@ -1640,6 +1654,7 @@ class RecordTable extends FormElement {
|
|
|
1640
1654
|
else {
|
|
1641
1655
|
visibleRecords = this.tableRecords;
|
|
1642
1656
|
}
|
|
1657
|
+
console.log('Actualizando visibleRecords al cierre');
|
|
1643
1658
|
this.setAttr(attrs.visibleRecords, visibleRecords);
|
|
1644
1659
|
}
|
|
1645
1660
|
updateFromServer(tableReceived) {
|
|
@@ -1754,15 +1769,19 @@ class RecordTable extends FormElement {
|
|
|
1754
1769
|
tableColumn && tableColumn.addFilterDefinition(filterDefinition);
|
|
1755
1770
|
}
|
|
1756
1771
|
getFilteredRecords() {
|
|
1772
|
+
console.log('getFilteredRecords');
|
|
1757
1773
|
let filteredRecords = this.tableRecords;
|
|
1758
1774
|
if (this.restrictedId) {
|
|
1775
|
+
console.log('por id');
|
|
1759
1776
|
filteredRecords = filteredRecords.filter(record => record.recordId === this.restrictedId);
|
|
1760
1777
|
}
|
|
1761
1778
|
if (this.globalFilterStrings.length > 0) {
|
|
1779
|
+
console.log('global');
|
|
1762
1780
|
filteredRecords = filteredRecords.filter(record => record.hasPattern(this.globalFilterStrings, this._tableColumnObj));
|
|
1763
1781
|
}
|
|
1764
1782
|
const columnFilters = this.columns.filter(column => column.filter).map(column => column.filter);
|
|
1765
1783
|
if (columnFilters.length > 0) {
|
|
1784
|
+
console.log('Hay columnFilters...');
|
|
1766
1785
|
filteredRecords = filteredRecords.filter(record => record.hasCondition(columnFilters));
|
|
1767
1786
|
}
|
|
1768
1787
|
return filteredRecords;
|
|
@@ -1772,12 +1791,23 @@ class RecordTable extends FormElement {
|
|
|
1772
1791
|
return tableColumn?.filter ?? null;
|
|
1773
1792
|
}
|
|
1774
1793
|
addColumnFilter(columnName, columnValues, operator = null) {
|
|
1794
|
+
console.log('1. addColumnFilter');
|
|
1775
1795
|
const tableColumn = this.columnDefinition(columnName);
|
|
1796
|
+
console.log('2. addColumnFilter');
|
|
1797
|
+
console.log(tableColumn);
|
|
1776
1798
|
const columnFilterDefinition = tableColumn?.filterDefinition ?? null;
|
|
1799
|
+
console.log('3. addColumnFilter');
|
|
1800
|
+
console.log(columnFilterDefinition);
|
|
1777
1801
|
if (!columnFilterDefinition) {
|
|
1778
1802
|
return;
|
|
1779
1803
|
}
|
|
1804
|
+
console.log('4. addColumnFilter');
|
|
1805
|
+
console.log('tableColumn');
|
|
1806
|
+
console.log(tableColumn);
|
|
1807
|
+
console.log({ columnValues, operator });
|
|
1808
|
+
console.log('5. Adicionando filtro');
|
|
1780
1809
|
tableColumn && tableColumn.addFilter(columnValues, operator);
|
|
1810
|
+
console.log('4. updateVisibleRecords');
|
|
1781
1811
|
this.updateVisibleRecords();
|
|
1782
1812
|
}
|
|
1783
1813
|
removeColumnFilter(columnName) {
|