tuain-ng-forms-lib 12.0.7 → 12.0.11

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.
@@ -372,6 +372,7 @@
372
372
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
373
373
  }
374
374
 
375
+ var VALUE = '';
375
376
  var FieldComponent = /** @class */ (function () {
376
377
  function FieldComponent() {
377
378
  }
@@ -390,13 +391,20 @@
390
391
  this.fieldObject.attributeChange.subscribe(function (event) {
391
392
  var fieldAttr = event.name, value = event.value;
392
393
  var compAttr = _this.formConfig.componentFieldAttrMap[fieldAttr];
393
- _this.hasOwnProperty(compAttr) && (_this[compAttr] = value);
394
+ if (compAttr === VALUE) {
395
+ _this.updateValue();
396
+ }
397
+ else if (_this.hasOwnProperty(compAttr)) {
398
+ _this[compAttr] = value;
399
+ }
394
400
  });
395
401
  }
396
402
  this.start();
397
403
  };
398
404
  FieldComponent.prototype.start = function () { };
399
405
  FieldComponent.prototype.focus = function () { };
406
+ FieldComponent.prototype.updateValue = function () { };
407
+ FieldComponent.prototype.updateObject = function () { };
400
408
  FieldComponent.prototype.onInputChange = function () {
401
409
  var _this = this;
402
410
  setTimeout(function () { return _this.fieldObject.notifyEditionPartial(); }, 50);
@@ -2310,7 +2318,7 @@
2310
2318
  }
2311
2319
  break;
2312
2320
  case this._formConfig.fieldTypes.currency:
2313
- newFinalValue = formatCurrency(this._fieldValue);
2321
+ newFinalValue = formatCurrency(newValue);
2314
2322
  break;
2315
2323
  default:
2316
2324
  newFinalValue = newValue;
@@ -2592,6 +2600,11 @@
2592
2600
  ? this._sectionsObj[sectionCode] : null;
2593
2601
  return (section) ? section.getSubsection(subsectionCode) : null;
2594
2602
  };
2603
+ Object.defineProperty(FormStructureAndData.prototype, "actions", {
2604
+ get: function () { return this.getActions(); },
2605
+ enumerable: false,
2606
+ configurable: true
2607
+ });
2595
2608
  FormStructureAndData.prototype.getSection = function (sectionCode) {
2596
2609
  return (this._sectionsObj && this._sectionsObj[sectionCode])
2597
2610
  ? this._sectionsObj[sectionCode] : null;
@@ -2601,6 +2614,13 @@
2601
2614
  FormStructureAndData.prototype.getSections = function () {
2602
2615
  return this._sections;
2603
2616
  };
2617
+ Object.defineProperty(FormStructureAndData.prototype, "visibleSections", {
2618
+ get: function () {
2619
+ return this._sections.filter(function (sec) { return sec.visible; });
2620
+ },
2621
+ enumerable: false,
2622
+ configurable: true
2623
+ });
2604
2624
  FormStructureAndData.prototype.numSections = function () {
2605
2625
  return this._sections.length;
2606
2626
  };
@@ -2769,6 +2789,11 @@
2769
2789
  var actionNames = (Array.isArray(actionArray)) ? actionArray : [actionArray];
2770
2790
  actionNames.forEach(function (actionCode) { return _this.disableAction(actionCode); });
2771
2791
  };
2792
+ Object.defineProperty(FormStructureAndData.prototype, "fields", {
2793
+ get: function () { return this.getFields(); },
2794
+ enumerable: false,
2795
+ configurable: true
2796
+ });
2772
2797
  FormStructureAndData.prototype.enableField = function (fieldCode) {
2773
2798
  var fieldObject = this.getFieldObject(fieldCode);
2774
2799
  return (fieldObject) ? fieldObject.enable() : null;
@@ -3258,6 +3283,8 @@
3258
3283
  this.errorMessage = '';
3259
3284
  this.errorDetail = '';
3260
3285
  this.formStructure = null;
3286
+ this.fields = null;
3287
+ this.actions = null;
3261
3288
  this.controlToken = null;
3262
3289
  this.inputDataFields = {};
3263
3290
  this.definitionObtained = false;
@@ -3393,6 +3420,11 @@
3393
3420
  BasicFormComponent.prototype.disableActions = function (actionArray) { return this.formStructure.disableActions(actionArray); };
3394
3421
  BasicFormComponent.prototype.getStates = function () { return this.formStructure.getStates(); };
3395
3422
  BasicFormComponent.prototype.getSections = function () { return this.formStructure.getSections(); };
3423
+ Object.defineProperty(BasicFormComponent.prototype, "visibleSections", {
3424
+ get: function () { return this.formStructure.visibleSections; },
3425
+ enumerable: false,
3426
+ configurable: true
3427
+ });
3396
3428
  BasicFormComponent.prototype.getSection = function (sectionCode) { return this.formStructure.getSection(sectionCode); };
3397
3429
  BasicFormComponent.prototype.activateSection = function (sectionCode) { return this.formStructure.activateSection(sectionCode); };
3398
3430
  BasicFormComponent.prototype.getSubSection = function (sectionCode, subsectionCode) { return this.formStructure.getSubSection(sectionCode, subsectionCode); };
@@ -3492,7 +3524,6 @@
3492
3524
  this.controlToken = (_a = params === null || params === void 0 ? void 0 : params[TOKEN]) !== null && _a !== void 0 ? _a : null;
3493
3525
  var _j = this.formManagerService.getFormInfo(this.controlToken), token = _j.token, subject = _j.subject, state = _j.state, fields = _j.fields, extra = _j.extra, originToken = _j.originToken;
3494
3526
  if (!this.controlToken || this.controlToken !== token) {
3495
- console.log("No se obtuvo un token v\u00E1lido para abrir el formulario " + this.name + ":" + this.controlToken + "->" + token);
3496
3527
  return;
3497
3528
  }
3498
3529
  this.formSubject = (_c = (_b = params === null || params === void 0 ? void 0 : params[SUBJECT]) !== null && _b !== void 0 ? _b : subject) !== null && _c !== void 0 ? _c : null;
@@ -3567,6 +3598,8 @@
3567
3598
  formDefinition = _j.sent();
3568
3599
  this.inServerProcess = false;
3569
3600
  this.formStructure = new FormStructureAndData(formDefinition, this.formConfig);
3601
+ this.fields = this.formStructure.fields;
3602
+ this.actions = this.formStructure.actions;
3570
3603
  this.definitionObtained = true;
3571
3604
  return [3 /*break*/, 3];
3572
3605
  case 2: