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