tuain-ng-forms-lib 17.2.5 → 17.2.7

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.
@@ -436,16 +436,23 @@ class LibTableRecordActionComponent extends PieceComponent {
436
436
  if (this.action && this.action.restrictedOnField && this.recordData) {
437
437
  const relatedField = this.action.restrictedOnField;
438
438
  if (relatedField) {
439
+ console.log('this.action.actionCode');
440
+ console.log(this.action.actionCode);
441
+ console.log(this.action);
439
442
  const relatedFieldValue = this.recordData[relatedField];
440
443
  const restrictionOper = this.action.restrictedOnOperator;
441
444
  const restrictionValue = this.action.restrictedOnValue;
442
- if ((restrictionOper === '==' && relatedFieldValue !== restrictionValue)
443
- || (restrictionOper === '!=' && relatedFieldValue === restrictionValue)) {
444
- this.visible.set(false);
445
+ let visibility = false;
446
+ if ((restrictionOper === '==' || restrictionOper === '===') && relatedFieldValue === restrictionValue) {
447
+ visibility = true;
445
448
  }
446
- else {
447
- this.visible.set(true);
449
+ else if ((restrictionOper === '!=' || restrictionOper === '!==') && relatedFieldValue !== restrictionValue) {
450
+ visibility = true;
448
451
  }
452
+ console.log({
453
+ relatedField, relatedFieldValue, restrictionOper, restrictionValue, visibility
454
+ });
455
+ this.visible.set(visibility);
449
456
  }
450
457
  }
451
458
  }
@@ -3161,6 +3168,8 @@ class BasicFormComponent extends FormStructureAndData {
3161
3168
  _actionServerError = [];
3162
3169
  _fieldServerError = [];
3163
3170
  _tableServerError = [];
3171
+ // Acciones en curso dentro del formulario
3172
+ _actionsInProgress = {};
3164
3173
  // Datos complementarios del formulario
3165
3174
  inputDataFields = {};
3166
3175
  extraData = {};
@@ -3662,7 +3671,16 @@ class BasicFormComponent extends FormStructureAndData {
3662
3671
  let serverError = false;
3663
3672
  let actionResult = null;
3664
3673
  if (action.backend) {
3665
- actionResult = await this.requestFormAction(action.actionCode);
3674
+ if (this._actionsInProgress[action.actionCode]) {
3675
+ const { sent } = this._actionsInProgress[action.actionCode];
3676
+ console.log(`Acción ${action.actionCode} en ejecución desde ${sent}`);
3677
+ }
3678
+ else {
3679
+ this._actionsInProgress[action.actionCode] = { sent: new Date() };
3680
+ actionResult = await this.requestFormAction(action.actionCode);
3681
+ this._actionsInProgress[action.actionCode] = null;
3682
+ delete this._actionsInProgress[action.actionCode];
3683
+ }
3666
3684
  }
3667
3685
  await this.finishAction(action, actionResult, serverError);
3668
3686
  serverError = !!this.errorOccured();