tuain-ng-forms-lib 12.0.37 → 12.0.38

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.
@@ -60,10 +60,11 @@ ActionComponent.propDecorators = {
60
60
  showLabel: [{ type: Input }]
61
61
  };
62
62
 
63
- const VALUE = '';
63
+ const VALUE = 'value';
64
+ const FOCUS = 'focus';
64
65
  class FieldComponent {
65
66
  ngOnInit() {
66
- var _a, _b, _c;
67
+ var _a, _b;
67
68
  if (this.field) {
68
69
  this.formConfig = (_a = this.field) === null || _a === void 0 ? void 0 : _a._formConfig;
69
70
  // Inicialización
@@ -72,8 +73,9 @@ class FieldComponent {
72
73
  const [fieldAttr1, compAttr1] = mapping[index];
73
74
  const compAttr = compAttr1.toString();
74
75
  const fieldAttr = fieldAttr1.toString();
75
- this.dafaultProcessFieldChange(compAttr, (_b = this.field) === null || _b === void 0 ? void 0 : _b[fieldAttr]);
76
- this.processFieldChange(compAttr, (_c = this.field) === null || _c === void 0 ? void 0 : _c[fieldAttr]);
76
+ const attributeValue = (_b = this.field) === null || _b === void 0 ? void 0 : _b[fieldAttr];
77
+ this.dafaultProcessFieldChange(compAttr, attributeValue);
78
+ this.processFieldChange(compAttr, attributeValue);
77
79
  }
78
80
  // Subscripción a cambios en atributos
79
81
  this.field.attributeChange.subscribe(event => {
@@ -89,6 +91,9 @@ class FieldComponent {
89
91
  if (attribute === VALUE) {
90
92
  this.updateValue();
91
93
  }
94
+ else if (attribute === FOCUS) {
95
+ this.focus();
96
+ }
92
97
  else {
93
98
  this[attribute] = value;
94
99
  }
@@ -296,7 +301,6 @@ class FormElement {
296
301
  this._visibleForced = false;
297
302
  this.disabled = (_a = elementDefinition === null || elementDefinition === void 0 ? void 0 : elementDefinition.disabled) !== null && _a !== void 0 ? _a : false;
298
303
  this.setVisibility((_b = elementDefinition === null || elementDefinition === void 0 ? void 0 : elementDefinition.visible) !== null && _b !== void 0 ? _b : true);
299
- this.widget = null;
300
304
  this.customAttributes = (_c = elementDefinition === null || elementDefinition === void 0 ? void 0 : elementDefinition.customAttributes) !== null && _c !== void 0 ? _c : {};
301
305
  }
302
306
  getCustomAttribute(name) { var _a, _b; return (_b = (_a = this.customAttributes) === null || _a === void 0 ? void 0 : _a[name]) !== null && _b !== void 0 ? _b : null; }
@@ -997,7 +1001,6 @@ class LibTableComponent {
997
1001
  this.tableFieldStyles = this.formConfig.tableFieldStyles;
998
1002
  this.selectable = this.table.selectable;
999
1003
  this.hasActions = this.table.hasActions;
1000
- this.table.widget = this;
1001
1004
  this.inlineActions = this.table.getActions(this.formConfig.tableActions.inline);
1002
1005
  this.globalActions = this.table.getActions(this.formConfig.tableActions.global);
1003
1006
  this.selectionActions = this.table.getActions(this.formConfig.tableActions.selection);
@@ -1153,6 +1156,7 @@ const fldAttr = {
1153
1156
  maxValue: '_maxValue',
1154
1157
  maxLength: '_maxLength',
1155
1158
  onValidation: '_onValidation',
1159
+ focus: 'focus',
1156
1160
  intrinsicErrorMessage: '_intrinsicErrorMessage',
1157
1161
  code: 'fieldCode',
1158
1162
  info: 'fieldInfo',
@@ -1225,6 +1229,7 @@ class FieldDescriptor extends FormElement {
1225
1229
  get info() { return this.fieldInfo; }
1226
1230
  get validating() { return this._onValidation; }
1227
1231
  set validating(isValidating) { this.setAttr(fldAttr.onValidation, isValidating); }
1232
+ focus() { this.setAttr(fldAttr.focus, true); }
1228
1233
  setIntrinsicErrorMessage(message) { this.setAttr(fldAttr.intrinsicErrorMessage, message); }
1229
1234
  set intrinsicErrorMessage(message) { this.setIntrinsicErrorMessage(message); }
1230
1235
  get fieldValue() { return this.getValue(); }
@@ -3507,11 +3512,8 @@ class BasicFormComponent {
3507
3512
  this.tagFieldsWithError(requiredEmptyFields, null, this.formConfig.formStandardErrors.requiredField);
3508
3513
  for (const fieldCode of requiredEmptyFields) {
3509
3514
  const requiredEmptyField = this.getField(fieldCode);
3510
- if (requiredEmptyField && requiredEmptyField.widget
3511
- && requiredEmptyField.widget.focus) {
3512
- requiredEmptyField.widget.focus();
3513
- break;
3514
- }
3515
+ requiredEmptyField === null || requiredEmptyField === void 0 ? void 0 : requiredEmptyField.focus();
3516
+ break;
3515
3517
  }
3516
3518
  }
3517
3519
  const validationIssueFields = this.getFieldsWithValidationIssues(null, sectionCode);
@@ -3520,11 +3522,8 @@ class BasicFormComponent {
3520
3522
  this.setError(this.formConfig.formStandardErrors.typeWarning, this.formConfig.formStandardErrors.validationTitle, this.formConfig.formStandardErrors.validationFields);
3521
3523
  for (const fieldCode of validationIssueFields) {
3522
3524
  const validationIssueField = this.getField(fieldCode);
3523
- if (validationIssueField && validationIssueField.widget
3524
- && validationIssueField.widget.focus) {
3525
- validationIssueField.widget.focus();
3526
- break;
3527
- }
3525
+ validationIssueField.focus();
3526
+ break;
3528
3527
  }
3529
3528
  }
3530
3529
  return validationError;