tuain-ng-forms-lib 12.0.67 → 12.0.71

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.
@@ -726,13 +726,14 @@
726
726
  LibTableComponent.prototype.syncAttribute = function (name, value) {
727
727
  try {
728
728
  this[name] = value;
729
+ return true;
729
730
  }
730
- catch (e) {
731
- console.log('Error asignando valor a un atributo del objeto');
731
+ catch (_a) {
732
+ return false;
732
733
  }
733
734
  };
734
- LibTableComponent.prototype.filterHasChanged = function (columnName, values) {
735
- this.table.addColumnFilter(columnName, values);
735
+ LibTableComponent.prototype.filterHasChanged = function (column, values) {
736
+ this.table.addColumnFilter(column.fieldCode, values);
736
737
  };
737
738
  return LibTableComponent;
738
739
  }());
@@ -765,16 +766,16 @@
765
766
  validate: 'VALIDATE',
766
767
  };
767
768
  var operators = {
768
- G: '>',
769
- L: '<',
770
- GE: '>=',
771
- LE: '<=',
772
- EQ: '==',
773
- NOT_EQ: '!=',
774
- CONTENT: 'Contiene',
775
- NOT_CONTENT: 'No Contiene',
776
- BETWEEN: 'Entre',
777
- IN: 'En'
769
+ G: 'G',
770
+ L: 'L',
771
+ GE: 'GE',
772
+ LE: 'LE',
773
+ EQ: 'EQ',
774
+ NEQ: 'NEQ',
775
+ HAS: 'HAS',
776
+ NOTHAS: 'NOTHAS',
777
+ BETWEEN: 'BETWEEN',
778
+ IN: 'IN',
778
779
  };
779
780
 
780
781
  var FormElement = /** @class */ (function () {
@@ -1303,11 +1304,14 @@
1303
1304
  this.fieldAlignment = (recTableColReceived.alignment != null) ? recTableColReceived.alignment.toLowerCase() : defaultTypeAlignment;
1304
1305
  this.visible = (_a = recTableColReceived === null || recTableColReceived === void 0 ? void 0 : recTableColReceived.visible) !== null && _a !== void 0 ? _a : true;
1305
1306
  this.sortable = (_b = recTableColReceived === null || recTableColReceived === void 0 ? void 0 : recTableColReceived.sortable) !== null && _b !== void 0 ? _b : false;
1306
- this.sortDirections = (this.sortable) ? ['ascend', 'descend', null] : [null];
1307
+ this.sortDirections = (this.sortable) ? ['ascend', 'descend'] : [null];
1307
1308
  this.fieldFormat = recTableColReceived.format || '';
1308
1309
  this.customAttributes = (_c = recTableColReceived === null || recTableColReceived === void 0 ? void 0 : recTableColReceived.customAttributes) !== null && _c !== void 0 ? _c : {};
1309
1310
  }
1310
1311
  }
1312
+ RecordTableColumn.prototype.hideFilter = function () {
1313
+ this.filterVisible = false;
1314
+ };
1311
1315
  RecordTableColumn.prototype.addFilterDefinition = function (filterDefinition) {
1312
1316
  var _a;
1313
1317
  this.filterDef = {
@@ -1351,7 +1355,7 @@
1351
1355
  configurable: true
1352
1356
  });
1353
1357
  RecordTableColumn.prototype.serSortDirections = function (ascend, descend) {
1354
- this.sortDirections = [null];
1358
+ this.sortDirections = [];
1355
1359
  if (ascend) {
1356
1360
  this.sortDirections.unshift('ascend');
1357
1361
  }
@@ -1492,13 +1496,13 @@
1492
1496
  if (operator === operators.EQ) {
1493
1497
  return fieldValue === values[0];
1494
1498
  }
1495
- if (operator === operators.NOT_EQ && fieldValue === values[0]) {
1499
+ if (operator === operators.NEQ && fieldValue === values[0]) {
1496
1500
  return false;
1497
1501
  }
1498
- if (operator === operators.CONTENT && !stringValue.includes(values[0].toString().toUpperCase())) {
1502
+ if (operator === operators.HAS && !stringValue.includes(values[0].toString().toUpperCase())) {
1499
1503
  return false;
1500
1504
  }
1501
- if (operator === operators.NOT_CONTENT && stringValue.includes(values[0].toString().toUpperCase())) {
1505
+ if (operator === operators.NOTHAS && stringValue.includes(values[0].toString().toUpperCase())) {
1502
1506
  return false;
1503
1507
  }
1504
1508
  if (operator === operators.BETWEEN && (fieldValue < values[0] || fieldValue > values[1])) {
@@ -1551,6 +1555,7 @@
1551
1555
  _this._actionsObj = {};
1552
1556
  _this.tableRecords = [];
1553
1557
  _this.globalSearch = false;
1558
+ _this.restrictedId = null;
1554
1559
  _this.tableTitle = tableReceived.tableTitle;
1555
1560
  _this._appendPages = (_a = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.append) !== null && _a !== void 0 ? _a : false;
1556
1561
  _this.selectable = (_b = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.selectable) !== null && _b !== void 0 ? _b : false;
@@ -1615,7 +1620,7 @@
1615
1620
  // Filtros predefinidos en el formulario
1616
1621
  if (tableReceived.filters) {
1617
1622
  for (var index = 0; index < tableReceived.filters.length; index++) {
1618
- _this.addFilterDefinition(tableReceived.filters[index]);
1623
+ _this.addFilterDefinition(tableReceived.filters[index].fieldCode, tableReceived.filters[index]);
1619
1624
  }
1620
1625
  }
1621
1626
  return _this;
@@ -1836,6 +1841,20 @@
1836
1841
  });
1837
1842
  };
1838
1843
  // Filtros
1844
+ RecordTable.prototype.setFilterById = function (id) {
1845
+ if (this.restrictedId === id) {
1846
+ return;
1847
+ }
1848
+ this.restrictedId = id;
1849
+ this.updateVisibleRecords();
1850
+ };
1851
+ RecordTable.prototype.cleanIdFilter = function () {
1852
+ if (this.restrictedId === null) {
1853
+ return;
1854
+ }
1855
+ this.restrictedId = null;
1856
+ this.updateVisibleRecords();
1857
+ };
1839
1858
  RecordTable.prototype.setGlobalFilterString = function (text) {
1840
1859
  var _a;
1841
1860
  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 : [];
@@ -1843,13 +1862,16 @@
1843
1862
  this.changePage(1);
1844
1863
  }
1845
1864
  };
1846
- RecordTable.prototype.addFilterDefinition = function (filterDefinition) {
1847
- var tableColumn = this.columnDefinition(filterDefinition.fieldCode);
1865
+ RecordTable.prototype.addFilterDefinition = function (columnName, filterDefinition) {
1866
+ var tableColumn = this.columnDefinition(columnName);
1848
1867
  tableColumn && tableColumn.addFilterDefinition(filterDefinition);
1849
1868
  };
1850
1869
  RecordTable.prototype.getFilteredRecords = function () {
1851
1870
  var _this = this;
1852
1871
  var filteredRecords = this.tableRecords;
1872
+ if (this.restrictedId) {
1873
+ filteredRecords = filteredRecords.filter(function (record) { return record.recordId === _this.restrictedId; });
1874
+ }
1853
1875
  if (this.globalFilterStrings.length > 0) {
1854
1876
  filteredRecords = filteredRecords.filter(function (record) { return record.hasPattern(_this.globalFilterStrings); });
1855
1877
  }