tuain-ng-forms-lib 15.0.26 → 15.0.28

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.
@@ -2110,6 +2110,7 @@ class FormStructureAndData {
2110
2110
  this._immutableData = {};
2111
2111
  this._extraInfo = {};
2112
2112
  this._exclusiveSectionsByAttr = {};
2113
+ this.customAttributes = {};
2113
2114
  this.state = '';
2114
2115
  this.actionArray = [];
2115
2116
  this.fieldArray = [];
@@ -2147,6 +2148,10 @@ class FormStructureAndData {
2147
2148
  this.setStateFlow(definitionReceived?.states, definitionReceived?.transitions, definitionReceived?.defaultState);
2148
2149
  this.immutableData = definitionReceived.immutableData;
2149
2150
  this.extraInfo = definitionReceived.extraInfo;
2151
+ this.customAttributes = {};
2152
+ if (definitionReceived?.customAttributes) {
2153
+ this.setCustomAttributes(definitionReceived?.customAttributes);
2154
+ }
2150
2155
  if (definitionReceived.actions) {
2151
2156
  const formActions = definitionReceived.actions.map(objDef => {
2152
2157
  let visibleStates = objDef.visibleStates;
@@ -2270,6 +2275,18 @@ class FormStructureAndData {
2270
2275
  getExtraInfo(name) { return this._extraInfo?.[name]?.value ?? null; }
2271
2276
  set extraInfo(extraInfo) { Object.assign(this._extraInfo, extraInfo); }
2272
2277
  get extraInfo() { return JSON.parse(JSON.stringify(this._extraInfo)); }
2278
+ // Custom Attributes
2279
+ getCustomAttribute(name) { return this.customAttributes?.[name] ?? null; }
2280
+ setCustomAttribute(name, value) { if (name) {
2281
+ this.customAttributes[name] = value;
2282
+ } }
2283
+ setCustomAttributes(attributes) {
2284
+ if (attributes && typeof attributes === 'object') {
2285
+ Object.entries(attributes).forEach(([name, value]) => {
2286
+ this.setCustomAttribute(name, value);
2287
+ });
2288
+ }
2289
+ }
2273
2290
  // Fields
2274
2291
  get fieldNames() { return this.getFieldNames(); }
2275
2292
  getFields() { return this.fieldArray; }
@@ -2738,6 +2755,7 @@ class BasicFormComponent extends FormStructureAndData {
2738
2755
  this._originToken = null;
2739
2756
  this._formRoute = null;
2740
2757
  this._definitionObtained = false;
2758
+ this._notifyFormActivity = true;
2741
2759
  // Eventos de acciones y campos
2742
2760
  this._formChangeState = [];
2743
2761
  this._formSectionsCanDeactivate = {};
@@ -2844,6 +2862,8 @@ class BasicFormComponent extends FormStructureAndData {
2844
2862
  target.extra = target?.extra ?? {};
2845
2863
  this.formManagerService.openForm(origin, target);
2846
2864
  }
2865
+ enableActivityNotification() { this._notifyFormActivity = true; }
2866
+ disableActivityNotification() { this._notifyFormActivity = false; }
2847
2867
  canGoBack() { return this._originToken !== null; }
2848
2868
  goBack() { return this.formManagerService.backTo(); }
2849
2869
  goBackForm() { return this.goBack(); }
@@ -3895,7 +3915,11 @@ class BasicFormComponent extends FormStructureAndData {
3895
3915
  }
3896
3916
  return false;
3897
3917
  }
3898
- notifyFormActivity() { this._eventEmiter.next('formActivity', { code: this.formCode }); }
3918
+ notifyFormActivity() {
3919
+ if (this._notifyFormActivity) {
3920
+ this._eventEmiter.next('formActivity', { code: this.formCode });
3921
+ }
3922
+ }
3899
3923
  /**
3900
3924
  * Métodos Legacy de compatibilidad hacia atrás
3901
3925
  */