tuain-ng-forms-lib 15.0.27 → 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; }