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.
@@ -447,6 +447,7 @@ class LibTableComponent extends ElementComponent {
447
447
  // Subscripción a cambios en atributos
448
448
  (_s = this.table) === null || _s === void 0 ? void 0 : _s.attributeChange.subscribe(event => {
449
449
  const { name: attrName, value } = event;
450
+ console.log(`Llegó atributo ${attrName} propagado...`);
450
451
  this.defaultProcessAttributeChange(attrName, value);
451
452
  this.customProcessAttributeChange(attrName, value);
452
453
  });
@@ -465,6 +466,7 @@ class LibTableComponent extends ElementComponent {
465
466
  defaultProcessAttributeChange(attribute, value) {
466
467
  try {
467
468
  if (attribute === 'visibleRecords') {
469
+ console.log('Se deben actualizar los visibleRecords');
468
470
  this.updateTableData();
469
471
  }
470
472
  return super.defaultProcessAttributeChange(attribute, value);
@@ -658,6 +660,7 @@ class FormPiecePropagate extends FormPiece {
658
660
  get attributeChange() { return this._attributeChange; }
659
661
  propagateAttribute(name, value) {
660
662
  var _a;
663
+ console.log(`Propagando atributo ${name}`);
661
664
  (_a = this._attributeChange) === null || _a === void 0 ? void 0 : _a.next({ name, value });
662
665
  }
663
666
  setCustomAttribute(name, value) {
@@ -693,6 +696,7 @@ class FormElement extends FormPiecePropagate {
693
696
  ;
694
697
  setAttr(attr, value) {
695
698
  const { name: attrName, propagate: name } = attr;
699
+ console.log(`Asignando valor a ${attrName}`);
696
700
  this[attrName] = value;
697
701
  name && this.propagateAttribute(name, value);
698
702
  }
@@ -1255,10 +1259,10 @@ class RecordTableColumn extends FormPiece {
1255
1259
  return this.filterDef;
1256
1260
  }
1257
1261
  addFilter(columnValues, operator) {
1258
- var _a;
1262
+ var _a, _b;
1259
1263
  this.filterSetup = {
1260
1264
  fieldCode: this.fieldCode,
1261
- operator: operator !== null && operator !== void 0 ? operator : (_a = this.filterDef) === null || _a === void 0 ? void 0 : _a.operators[0],
1265
+ operator: (_b = operator !== null && operator !== void 0 ? operator : (_a = this.filterDef) === null || _a === void 0 ? void 0 : _a.operators[0]) !== null && _b !== void 0 ? _b : 'IN',
1262
1266
  values: columnValues,
1263
1267
  };
1264
1268
  }
@@ -1380,13 +1384,17 @@ class TableRecordData {
1380
1384
  return true;
1381
1385
  }
1382
1386
  hasCondition(columnFilters) {
1387
+ console.log(`Evaluación de condición sobre un registro...`);
1383
1388
  if (!columnFilters || columnFilters.length === 0) {
1384
1389
  return true;
1385
1390
  }
1386
1391
  for (const condition of columnFilters) {
1387
1392
  const { fieldCode, operator, values } = condition;
1393
+ console.log(`1. Evaluación condición columna ${fieldCode} / ${operator}`);
1388
1394
  if (this.recordData.hasOwnProperty(fieldCode)) {
1389
1395
  const fieldValue = this.recordData[fieldCode];
1396
+ console.log(`2. Evaluación condición columna ${fieldCode}/(${fieldValue}) con ${operator}`);
1397
+ console.log(values);
1390
1398
  const stringValue = fieldValue.toString().toUpperCase();
1391
1399
  if (operator === operators.G && fieldValue <= values[0]) {
1392
1400
  return false;
@@ -1401,6 +1409,7 @@ class TableRecordData {
1401
1409
  return false;
1402
1410
  }
1403
1411
  if (operator === operators.IN && !values.includes(fieldValue)) {
1412
+ console.log(`Evaluación falsa de condición IN...`);
1404
1413
  return false;
1405
1414
  }
1406
1415
  if (operator === operators.EQ) {
@@ -1653,12 +1662,17 @@ class RecordTable extends FormElement {
1653
1662
  }
1654
1663
  }
1655
1664
  updateVisibleRecords() {
1665
+ console.log('updateVisibleRecords');
1656
1666
  let visibleRecords;
1657
1667
  if (this.clientPaging) {
1668
+ console.log('this.clientPaging');
1669
+ console.log('a por getFilteredRecords');
1658
1670
  let filteredRecords = this.getFilteredRecords();
1671
+ console.log('regresando de getFilteredRecords');
1659
1672
  this.setAttr(attrs.totalRecordsNumber, filteredRecords.length);
1660
1673
  const sliceNumber1 = (this.currentPage - 1) * this.recordsPerPage;
1661
1674
  const sliceNumber2 = (this.currentPage - 1) * this.recordsPerPage + this.recordsPerPage;
1675
+ console.log('Actualizando visibleRecords');
1662
1676
  visibleRecords = filteredRecords.slice(sliceNumber1, sliceNumber2);
1663
1677
  const recordsLastPage = this.totalRecordsNumber % this.recordsPerPage;
1664
1678
  const totalPages = Math.trunc(this.totalRecordsNumber / this.recordsPerPage + (recordsLastPage ? 1 : 0));
@@ -1669,6 +1683,7 @@ class RecordTable extends FormElement {
1669
1683
  else {
1670
1684
  visibleRecords = this.tableRecords;
1671
1685
  }
1686
+ console.log('Actualizando visibleRecords al cierre');
1672
1687
  this.setAttr(attrs.visibleRecords, visibleRecords);
1673
1688
  }
1674
1689
  updateFromServer(tableReceived) {
@@ -1785,15 +1800,19 @@ class RecordTable extends FormElement {
1785
1800
  tableColumn && tableColumn.addFilterDefinition(filterDefinition);
1786
1801
  }
1787
1802
  getFilteredRecords() {
1803
+ console.log('getFilteredRecords');
1788
1804
  let filteredRecords = this.tableRecords;
1789
1805
  if (this.restrictedId) {
1806
+ console.log('por id');
1790
1807
  filteredRecords = filteredRecords.filter(record => record.recordId === this.restrictedId);
1791
1808
  }
1792
1809
  if (this.globalFilterStrings.length > 0) {
1810
+ console.log('global');
1793
1811
  filteredRecords = filteredRecords.filter(record => record.hasPattern(this.globalFilterStrings, this._tableColumnObj));
1794
1812
  }
1795
1813
  const columnFilters = this.columns.filter(column => column.filter).map(column => column.filter);
1796
1814
  if (columnFilters.length > 0) {
1815
+ console.log('Hay columnFilters...');
1797
1816
  filteredRecords = filteredRecords.filter(record => record.hasCondition(columnFilters));
1798
1817
  }
1799
1818
  return filteredRecords;
@@ -1805,12 +1824,23 @@ class RecordTable extends FormElement {
1805
1824
  }
1806
1825
  addColumnFilter(columnName, columnValues, operator = null) {
1807
1826
  var _a;
1827
+ console.log('1. addColumnFilter');
1808
1828
  const tableColumn = this.columnDefinition(columnName);
1829
+ console.log('2. addColumnFilter');
1830
+ console.log(tableColumn);
1809
1831
  const columnFilterDefinition = (_a = tableColumn === null || tableColumn === void 0 ? void 0 : tableColumn.filterDefinition) !== null && _a !== void 0 ? _a : null;
1832
+ console.log('3. addColumnFilter');
1833
+ console.log(columnFilterDefinition);
1810
1834
  if (!columnFilterDefinition) {
1811
1835
  return;
1812
1836
  }
1837
+ console.log('4. addColumnFilter');
1838
+ console.log('tableColumn');
1839
+ console.log(tableColumn);
1840
+ console.log({ columnValues, operator });
1841
+ console.log('5. Adicionando filtro');
1813
1842
  tableColumn && tableColumn.addFilter(columnValues, operator);
1843
+ console.log('4. updateVisibleRecords');
1814
1844
  this.updateVisibleRecords();
1815
1845
  }
1816
1846
  removeColumnFilter(columnName) {