tuain-ng-forms-lib 14.0.6 → 14.0.8

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.
@@ -332,12 +332,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImpor
332
332
  const changeViewAttributes = ['visibleRecords', 'currentPage', 'recordsPerPage'];
333
333
  class LibTableComponent {
334
334
  constructor() {
335
- this.globalFilterString = '';
336
335
  this.currentPage = 1;
337
336
  this.globalSearch = false;
337
+ this.globalFilterString = '';
338
+ this.visibleRecords = [];
338
339
  this.selectedRecords = [];
339
340
  this.totalRecordsNumber = 0;
340
341
  this.allSelected = false;
342
+ this.layout = '';
341
343
  this.loaded = false;
342
344
  this.selectable = false;
343
345
  this.hasActions = false;
@@ -379,8 +381,7 @@ class LibTableComponent {
379
381
  globalFilterCompleted() { this.changePage(1); }
380
382
  changePage(requestedPage) { this.table.changePage(requestedPage); }
381
383
  tableColumnSort(columnName, direction = null) { this.table.sort(columnName, direction ?? 'ascend'); }
382
- globalFilterChanged() { this.table.setGlobalFilterString(this.globalFilterString?.trim() ?? ''); }
383
- cleanGlobalFilter() { this.globalFilterString = ''; this.globalFilterChanged(); }
384
+ globalFilterChanged() { this.table.setGlobalFilterString(this.globalFilterString?.trim() ?? '', false); }
384
385
  syncAttribute(name, value) {
385
386
  try {
386
387
  if (name === 'visibleRecords') {
@@ -667,12 +668,14 @@ class FieldDescriptor extends FormElement {
667
668
  get value() { return this.getValue(); }
668
669
  set value(newValue) { this.setValue(newValue); }
669
670
  notifyEditionPartial() {
671
+ this.resetError();
670
672
  this._editionPartial.next({ code: this.fieldCode, intrinsicValidation: true });
671
673
  }
672
674
  notifyEditionFinish() {
673
675
  let intrinsicValidation = true;
674
676
  const fieldDefaultFormat = this._formConfig.fieldTypesPatterns?.[this.fieldType] ?? null;
675
677
  const fieldValue = this.getValue();
678
+ this.resetError();
676
679
  if (fieldValue && (fieldDefaultFormat || this.fieldFormat)) {
677
680
  intrinsicValidation = (fieldDefaultFormat?.test(fieldValue) ?? true)
678
681
  && (this.fieldFormat?.test(fieldValue) ?? true);
@@ -1104,6 +1107,7 @@ class RecordTable extends FormElement {
1104
1107
  this.setAttr('tableCode', tableReceived.tableCode);
1105
1108
  this.setAttr('clientPaging', tableReceived?.clientPaging ?? true);
1106
1109
  this.setAttr('globalSearch', tableReceived?.simpleFilter ?? false);
1110
+ this.setAttr('globalFilterString', '');
1107
1111
  this.setAttr('sorting', { columnName: '', direction: '' });
1108
1112
  this.setAttr('recordsPerPage', formConfig.defaultRecordsPerPage);
1109
1113
  this.setAttr('layout', '');
@@ -1333,11 +1337,14 @@ class RecordTable extends FormElement {
1333
1337
  this.restrictedId = null;
1334
1338
  this.updateVisibleRecords();
1335
1339
  }
1336
- setGlobalFilterString(text) {
1340
+ setGlobalFilterString(text, notifyComponent = true) {
1337
1341
  this.globalFilterStrings = text.split(' ').filter(t => t && t.trim().length > 0).map(t => t.trim()) ?? [];
1338
1342
  if (this.clientPaging) {
1339
1343
  this.changePage(1);
1340
1344
  }
1345
+ if (notifyComponent) {
1346
+ this.setAttr('globalFilterString', text);
1347
+ }
1341
1348
  }
1342
1349
  addFilterDefinition(columnName, filterDefinition) {
1343
1350
  const tableColumn = this.columnDefinition(columnName);
@@ -1365,7 +1372,7 @@ class RecordTable extends FormElement {
1365
1372
  const tableColumn = this.columnDefinition(columnName);
1366
1373
  const columnFilterDefinition = tableColumn?.filterDefinition ?? null;
1367
1374
  if (!columnFilterDefinition) {
1368
- return null;
1375
+ return;
1369
1376
  }
1370
1377
  tableColumn && tableColumn.addFilter(columnValues, operator);
1371
1378
  this.updateVisibleRecords();
@@ -2919,7 +2926,6 @@ class BasicFormComponent {
2919
2926
  if (!fieldToValidate) {
2920
2927
  return false;
2921
2928
  }
2922
- fieldToValidate.resetError();
2923
2929
  const validationCallbacks = this._fieldInputValidation[fieldCode];
2924
2930
  if (validationCallbacks) {
2925
2931
  const clientValidationPromises = [];
@@ -2937,7 +2943,6 @@ class BasicFormComponent {
2937
2943
  if (!fieldToValidate) {
2938
2944
  return;
2939
2945
  }
2940
- fieldToValidate.resetError();
2941
2946
  const validationCallbacks = this._fieldValidationsStart[fieldCode];
2942
2947
  if (validationCallbacks) {
2943
2948
  const clientValidationPromises = [];