tuain-ng-forms-lib 14.2.14 → 14.3.0

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.
@@ -75,23 +75,24 @@ class FieldComponent {
75
75
  this.field = null;
76
76
  }
77
77
  ngOnInit() {
78
- if (this.field) {
79
- this.formConfig = this.field?._formConfig;
80
- // Inicialización
81
- const mapping = this.formConfig.fieldPropagateAttributes;
82
- for (let index = 0; index < mapping.length; index++) {
83
- const attrName = mapping[index].toString();
84
- const attributeValue = this.field?.[attrName];
85
- this.dafaultProcessFieldChange(attrName, attributeValue);
86
- this.processFieldChange(attrName, attributeValue);
87
- }
88
- // Subscripción a cambios en atributos
89
- this.field.attributeChange.subscribe(event => {
90
- const { name: attrName, value } = event;
91
- this.dafaultProcessFieldChange(attrName, value);
92
- this.processFieldChange(attrName, value);
93
- });
78
+ if (!this.field) {
79
+ return;
94
80
  }
81
+ this.formConfig = this.field?._formConfig;
82
+ // Inicialización
83
+ const mapping = this.formConfig.fieldPropagateAttributes;
84
+ for (let index = 0; index < mapping.length; index++) {
85
+ const attrName = mapping[index].toString();
86
+ const attributeValue = this.field?.[attrName];
87
+ this.dafaultProcessFieldChange(attrName, attributeValue);
88
+ this.processFieldChange(attrName, attributeValue);
89
+ }
90
+ // Subscripción a cambios en atributos
91
+ this.field?.attributeChange.subscribe(event => {
92
+ const { name: attrName, value } = event;
93
+ this.dafaultProcessFieldChange(attrName, value);
94
+ this.processFieldChange(attrName, value);
95
+ });
95
96
  this.start();
96
97
  }
97
98
  dafaultProcessFieldChange(attribute, value) {
@@ -105,42 +106,28 @@ class FieldComponent {
105
106
  this[attribute] = value;
106
107
  }
107
108
  }
109
+ get visible() { return this.field?.visibleOn(this.state); }
110
+ get disabled() { return !this.field?.enabledOn(this.state); }
111
+ updateValue() { this.value = this.field?.value; }
112
+ onInputChange() { setTimeout(() => this.field?.notifyEditionPartial(), 50); }
113
+ onChangeContent() { setTimeout(() => this.field?.notifyEditionFinish(), 50); }
114
+ onShowInfo(detail = null) { setTimeout(() => this.field?.notifyEditionDetailRequest(detail), 50); }
108
115
  processFieldChange(attribute, value) { }
109
116
  start() { }
110
117
  focus() { }
111
- updateObject() {
112
- this.field.setValue(this.value);
113
- }
118
+ updateObject() { this.field?.setValue(this.value); }
114
119
  inputChanged() {
115
- this.field.setValue(this.value);
120
+ this.field?.setValue(this.value);
116
121
  this.onChangeContent();
117
122
  }
118
123
  inputTyped() {
119
- this.field.setValue(this.value);
124
+ this.field?.setValue(this.value);
120
125
  this.onInputChange();
121
126
  }
122
- updateValue() {
123
- this.value = this.field.getValue();
124
- }
125
- onInputChange() {
126
- setTimeout(() => this.field.notifyEditionPartial(), 50);
127
- }
128
- onChangeContent() {
129
- setTimeout(() => this.field.notifyEditionFinish(), 50);
130
- }
131
- onShowInfo(detail = null) {
132
- setTimeout(() => this.field.notifyEditionDetailRequest(detail), 50);
133
- }
134
127
  numberInputValidation(event) {
135
128
  const k = event.charCode;
136
129
  return (k > 47 && k < 58);
137
130
  }
138
- get visible() {
139
- return this.field?.visibleOn(this.state);
140
- }
141
- get disabled() {
142
- return !this.field?.enabledOn(this.state);
143
- }
144
131
  }
145
132
  FieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: FieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
146
133
  FieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.6", type: FieldComponent, selector: "lib-field", inputs: { field: "field", state: "state" }, ngImport: i0, template: `<ng-content></ng-content>`, isInline: true });
@@ -2980,6 +2967,7 @@ class BasicFormComponent {
2980
2967
  return true;
2981
2968
  }
2982
2969
  async launchSectionActivation(code) {
2970
+ this.notifyFormActivity();
2983
2971
  const sectionObject = this._formStructure?.getSection(code);
2984
2972
  if (!sectionObject) {
2985
2973
  return;
@@ -2993,6 +2981,7 @@ class BasicFormComponent {
2993
2981
  }
2994
2982
  }
2995
2983
  async launchSectionInactivation(code) {
2984
+ this.notifyFormActivity();
2996
2985
  const sectionObject = this._formStructure?.getSection(code);
2997
2986
  if (!sectionObject) {
2998
2987
  return;
@@ -3006,6 +2995,7 @@ class BasicFormComponent {
3006
2995
  }
3007
2996
  }
3008
2997
  async startAction(code) {
2998
+ this.notifyFormActivity();
3009
2999
  const actionObject = this.getAction(code);
3010
3000
  if (!actionObject) {
3011
3001
  return;
@@ -3098,6 +3088,7 @@ class BasicFormComponent {
3098
3088
  });
3099
3089
  }
3100
3090
  async startFieldInputValidation(code, intrinsicValidation = true) {
3091
+ this.notifyFormActivity();
3101
3092
  const fieldToValidate = this.getField(code);
3102
3093
  if (!fieldToValidate) {
3103
3094
  return false;
@@ -3115,6 +3106,7 @@ class BasicFormComponent {
3115
3106
  return true;
3116
3107
  }
3117
3108
  async startFieldValidation(code, intrinsicValidation = true) {
3109
+ this.notifyFormActivity();
3118
3110
  const fieldToValidate = this.getField(code);
3119
3111
  if (!fieldToValidate) {
3120
3112
  return;
@@ -3287,6 +3279,7 @@ class BasicFormComponent {
3287
3279
  tableEventHandlers[GET_DATA_ACTION] = { callback, properties };
3288
3280
  }
3289
3281
  async startTableGlobalAction(tableActionEvent) {
3282
+ this.notifyFormActivity();
3290
3283
  const { tableCode, actionCode } = tableActionEvent;
3291
3284
  const tableObject = this.getTable(tableCode);
3292
3285
  if (!tableObject || !actionCode) {
@@ -3367,6 +3360,7 @@ class BasicFormComponent {
3367
3360
  }
3368
3361
  }
3369
3362
  async startTableAction(tableActionEvent) {
3363
+ this.notifyFormActivity();
3370
3364
  const { tableCode, actionCode, actionDetail } = tableActionEvent;
3371
3365
  const tableObject = this.getTable(tableCode);
3372
3366
  if (!tableObject || !actionCode) {
@@ -3452,6 +3446,7 @@ class BasicFormComponent {
3452
3446
  }
3453
3447
  }
3454
3448
  async startTableRecordSelection(tableActionEvent) {
3449
+ this.notifyFormActivity();
3455
3450
  const { tableCode, actionDetail } = tableActionEvent;
3456
3451
  const tableObject = this.getTable(tableCode);
3457
3452
  if (!tableObject) {
@@ -3523,6 +3518,7 @@ class BasicFormComponent {
3523
3518
  }
3524
3519
  }
3525
3520
  async startTableSelectionAction(tableActionEvent) {
3521
+ this.notifyFormActivity();
3526
3522
  const { tableCode, actionCode, actionDetail } = tableActionEvent;
3527
3523
  const tableObject = this.getTable(tableCode);
3528
3524
  if (!tableObject || !actionCode) {
@@ -3603,6 +3599,7 @@ class BasicFormComponent {
3603
3599
  }
3604
3600
  }
3605
3601
  async startTableGetData(tableActionEvent) {
3602
+ this.notifyFormActivity();
3606
3603
  const { tableCode } = tableActionEvent;
3607
3604
  const tableObject = this.getTable(tableCode);
3608
3605
  const tableActionDetail = {
@@ -3709,6 +3706,7 @@ class BasicFormComponent {
3709
3706
  }
3710
3707
  return false;
3711
3708
  }
3709
+ notifyFormActivity() { this._eventEmiter.next('formActivity', { code: this.formCode }); }
3712
3710
  /**
3713
3711
  * Métodos Legacy de compatibilidad hacia atrás
3714
3712
  */