tuain-ng-forms-lib 15.1.10 → 15.1.12

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.
@@ -162,13 +162,11 @@ class FieldComponent extends ElementComponent {
162
162
  }
163
163
  // Subscripción a cambios en atributos
164
164
  (_l = this.field) === null || _l === void 0 ? void 0 : _l.attributeChange.subscribe(event => {
165
- console.log('FieldComponent attributeChange');
166
- console.log(event);
167
165
  const { name: componentAttr, value = null } = event !== null && event !== void 0 ? event : {};
168
- // if (componentAttr) {
169
- this.defaultProcessAttributeChange(componentAttr, value);
170
- this.customProcessAttributeChange(componentAttr, value);
171
- // }
166
+ if (componentAttr) {
167
+ this.defaultProcessAttributeChange(componentAttr, value);
168
+ this.customProcessAttributeChange(componentAttr, value);
169
+ }
172
170
  });
173
171
  if (this.field) {
174
172
  this.field.widget = this;
@@ -272,13 +270,11 @@ class SectionComponent extends PieceComponent {
272
270
  }
273
271
  // Subscripción a cambios en atributos
274
272
  (_d = this.section) === null || _d === void 0 ? void 0 : _d.attributeChange.subscribe(event => {
275
- console.log('SectionComponent attributeChange');
276
- console.log(event);
277
273
  const { name: attrName, value = null } = event !== null && event !== void 0 ? event : {};
278
- // if (attrName) {
279
- this.defaultProcessAttributeChange(attrName, value);
280
- this.customProcessAttributeChange(attrName, value);
281
- // }
274
+ if (attrName) {
275
+ this.defaultProcessAttributeChange(attrName, value);
276
+ this.customProcessAttributeChange(attrName, value);
277
+ }
282
278
  });
283
279
  this.start();
284
280
  }
@@ -312,13 +308,11 @@ class SubSectionComponent extends PieceComponent {
312
308
  }
313
309
  // Subscripción a cambios en atributos
314
310
  (_d = this.subSection) === null || _d === void 0 ? void 0 : _d.attributeChange.subscribe(event => {
315
- console.log('SubSectionComponent attributeChange');
316
- console.log(event);
317
311
  const { name: attrName, value = null } = event !== null && event !== void 0 ? event : {};
318
- // if (attrName) {
319
- this.defaultProcessAttributeChange(attrName, value);
320
- this.customProcessAttributeChange(attrName, value);
321
- // }
312
+ if (attrName) {
313
+ this.defaultProcessAttributeChange(attrName, value);
314
+ this.customProcessAttributeChange(attrName, value);
315
+ }
322
316
  });
323
317
  this.start();
324
318
  }
@@ -468,13 +462,11 @@ class LibTableComponent extends ElementComponent {
468
462
  }
469
463
  // Subscripción a cambios en atributos
470
464
  (_s = this.table) === null || _s === void 0 ? void 0 : _s.attributeChange.subscribe(event => {
471
- console.log('LibTableComponent attributeChange');
472
- console.log(event);
473
465
  const { name: attrName, value = null } = event !== null && event !== void 0 ? event : {};
474
- // if (attrName) {
475
- this.defaultProcessAttributeChange(attrName, value);
476
- this.customProcessAttributeChange(attrName, value);
477
- // }
466
+ if (attrName) {
467
+ this.defaultProcessAttributeChange(attrName, value);
468
+ this.customProcessAttributeChange(attrName, value);
469
+ }
478
470
  });
479
471
  this.start();
480
472
  }
@@ -482,7 +474,7 @@ class LibTableComponent extends ElementComponent {
482
474
  tableGlobalAction(actionCode) { var _a; (_a = this.table) === null || _a === void 0 ? void 0 : _a.notifyGlobalAction(actionCode); }
483
475
  tableSelectionAction(actionCode) { var _a; (_a = this.table) === null || _a === void 0 ? void 0 : _a.notifySelectionAction(actionCode); }
484
476
  tableActionSelected(actionEvent) { var _a; (_a = this.table) === null || _a === void 0 ? void 0 : _a.notifyInlineAction(actionEvent); }
485
- tableSelectionToggle(recordId) { var _a; (_a = this.table) === null || _a === void 0 ? void 0 : _a.notifyRecordSelection(recordId); }
477
+ tableSelectionToggle(recordId) { var _a; console.log('tableSelectionToggle 1'); (_a = this.table) === null || _a === void 0 ? void 0 : _a.notifyRecordSelection(recordId); }
486
478
  toggleSelectAll() { var _a, _b, _c; return ((_a = this.table) === null || _a === void 0 ? void 0 : _a.allSelected) ? (_b = this.table) === null || _b === void 0 ? void 0 : _b.unSelectAll() : (_c = this.table) === null || _c === void 0 ? void 0 : _c.selectAll(); }
487
479
  globalFilterCompleted() { this.changePage(1); }
488
480
  changePage(requestedPage) { var _a; (_a = this.table) === null || _a === void 0 ? void 0 : _a.changePage(requestedPage); }
@@ -688,7 +680,6 @@ class FormPiecePropagate extends FormPiece {
688
680
  get attributeChange() { return this._attributeChange; }
689
681
  propagateAttribute(name, value) {
690
682
  var _a;
691
- console.log(`Propagación ${name} : ${JSON.stringify(value)}`);
692
683
  (_a = this._attributeChange) === null || _a === void 0 ? void 0 : _a.next({ name, value });
693
684
  }
694
685
  setCustomAttribute(name, value) {
@@ -696,26 +687,21 @@ class FormPiecePropagate extends FormPiece {
696
687
  super.setCustomAttribute(name, value);
697
688
  if ((_a = this.propagationCustomAttributes) === null || _a === void 0 ? void 0 : _a.includes(name)) {
698
689
  const fullName = `customAttributes.${name}`;
699
- console.log('piece setCustomAttribute');
700
690
  this.propagateAttribute(fullName, value);
701
691
  }
702
692
  }
703
693
  setVisibility(visible, forced = null) {
704
694
  super.setVisibility(visible, forced);
705
- console.log('piece setVisibility');
706
695
  this.propagateAttribute(VISIBLE, this._visible);
707
696
  }
708
697
  set enabled(enabled) {
709
698
  super.enabled = enabled;
710
- console.log('piece enabled');
711
699
  this.propagateAttribute(DISABLED, this._disabled);
712
700
  }
713
701
  formStateChange(state) {
714
702
  super.formStateChange(state);
715
703
  if (state) {
716
- console.log('piece 1 formStateChange');
717
704
  this.propagateAttribute(VISIBLE, this._visible);
718
- console.log('piece 2 formStateChange');
719
705
  this.propagateAttribute(DISABLED, this._disabled);
720
706
  }
721
707
  }
@@ -730,8 +716,6 @@ class FormElement extends FormPiecePropagate {
730
716
  setAttr(attr, value) {
731
717
  const { name: attrName, propagate: name } = attr;
732
718
  this[attrName] = value;
733
- console.log(`Element setAttr name: ${name}`);
734
- console.log(value);
735
719
  name && this.propagateAttribute(name, value);
736
720
  }
737
721
  isField() { return this.elementType === elementTypes.field; }
@@ -1626,11 +1610,15 @@ class RecordTable extends FormElement {
1626
1610
  }
1627
1611
  notifyRecordSelection(recordId) {
1628
1612
  var _a;
1613
+ console.log('notifyRecordSelection 1');
1629
1614
  const record = this.getTableRecord(recordId);
1615
+ console.log('notifyRecordSelection 2');
1630
1616
  if (!record) {
1631
1617
  return;
1632
1618
  }
1619
+ console.log('notifyRecordSelection 3');
1633
1620
  record.toggleSelect();
1621
+ console.log('notifyRecordSelection 4');
1634
1622
  this.requestedPage = (_a = this.currentPage) !== null && _a !== void 0 ? _a : 1;
1635
1623
  const tableEvent = {
1636
1624
  tableCode: this.tableCode,
@@ -1640,6 +1628,7 @@ class RecordTable extends FormElement {
1640
1628
  recordData: record.recordData
1641
1629
  }
1642
1630
  };
1631
+ console.log(`notifyRecordSelection 5 ${JSON.stringify(tableEvent, null, 2)}`);
1643
1632
  this.recordSelectionTrigger.next(tableEvent);
1644
1633
  }
1645
1634
  notifySelectionAction(actionCode) {
@@ -3075,7 +3064,10 @@ class BasicFormComponent extends FormStructureAndData {
3075
3064
  formTables.forEach(table => {
3076
3065
  table.inlineActionTrigger.subscribe(event => this.startTableAction(event));
3077
3066
  table.globalActionTrigger.subscribe(event => this.startTableGlobalAction(event));
3078
- table.recordSelectionTrigger.subscribe(event => this.startTableRecordSelection(event));
3067
+ table.recordSelectionTrigger.subscribe(event => {
3068
+ console.log(`recordSelectionTrigger subscribe ${JSON.stringify(event, null, 2)}`);
3069
+ this.startTableRecordSelection(event);
3070
+ });
3079
3071
  table.selectionActionTrigger.subscribe(event => this.startTableSelectionAction(event));
3080
3072
  table.getDataTrigger.subscribe(event => this.startTableGetData(event));
3081
3073
  // Adicionalmente se le pide a la tabla se subscriba al cambio de estado del formulario
@@ -3826,12 +3818,16 @@ class BasicFormComponent extends FormStructureAndData {
3826
3818
  }
3827
3819
  startTableRecordSelection(tableActionEvent) {
3828
3820
  return __awaiter(this, void 0, void 0, function* () {
3821
+ console.log(`startTableRecordSelection ${JSON.stringify(tableActionEvent, null, 2)}`);
3829
3822
  this.notifyFormActivity();
3823
+ console.log(`startTableRecordSelection 2`);
3830
3824
  const { tableCode, actionDetail } = tableActionEvent;
3831
3825
  const tableObject = this.getTable(tableCode);
3826
+ console.log(`startTableRecordSelection 3`);
3832
3827
  if (!tableObject) {
3833
3828
  return;
3834
3829
  }
3830
+ console.log(`startTableRecordSelection 4`);
3835
3831
  this.resetError();
3836
3832
  const { recordId, recordData } = actionDetail;
3837
3833
  const tableSelectionDetail = {
@@ -3840,26 +3836,33 @@ class BasicFormComponent extends FormStructureAndData {
3840
3836
  recordId,
3841
3837
  recordData
3842
3838
  };
3839
+ console.log(`startTableRecordSelection 5`);
3843
3840
  const tableEventHandlers = this._tableSelectionsStart[tableCode];
3841
+ console.log(`startTableRecordSelection 6 ${tableEventHandlers === null || tableEventHandlers === void 0 ? void 0 : tableEventHandlers.length}`);
3844
3842
  if (tableEventHandlers) {
3845
3843
  const clientActionPromises = [];
3846
3844
  for (const tableSelectionMethod of tableEventHandlers) {
3847
3845
  const { callback, properties } = tableSelectionMethod;
3846
+ console.log(`startTableRecordSelection 7`);
3847
+ console.log(callback);
3848
3848
  const clientActionPromise = callback(tableSelectionDetail);
3849
3849
  clientActionPromises.push(clientActionPromise);
3850
3850
  }
3851
3851
  const clientActionResults = yield Promise.all(clientActionPromises);
3852
3852
  const continueAction = clientActionResults.reduce((total, curr) => (total && (curr !== false)), true);
3853
+ console.log(`startTableRecordSelection 8 ${continueAction}`);
3853
3854
  if (!continueAction) {
3854
3855
  return;
3855
3856
  }
3856
3857
  }
3858
+ console.log(`startTableRecordSelection 9 ${JSON.stringify(tableSelectionDetail, null, 2)}`);
3857
3859
  this.startTableServerRecordSelection(tableSelectionDetail);
3858
3860
  });
3859
3861
  }
3860
3862
  startTableServerRecordSelection(tableSelectionDetail) {
3861
3863
  var _a;
3862
3864
  return __awaiter(this, void 0, void 0, function* () {
3865
+ console.log(`startTableServerRecordSelection 1 ${JSON.stringify(tableSelectionDetail, null, 2)}`);
3863
3866
  const { tableObject, tableCode, recordId, recordData } = tableSelectionDetail;
3864
3867
  if (!tableObject) {
3865
3868
  return;
@@ -3875,14 +3878,17 @@ class BasicFormComponent extends FormStructureAndData {
3875
3878
  tableRecordId: recordId,
3876
3879
  tableRecordData: recordData
3877
3880
  };
3881
+ console.log(`startTableServerRecordSelection 2 ${JSON.stringify(actionSubject, null, 2)}`);
3878
3882
  actionResult = yield this
3879
3883
  .requestFormAction(formActions.tableAction, actionSubject);
3880
3884
  serverError = !!this.errorOccured();
3881
3885
  }
3886
+ console.log(`startTableServerRecordSelection 3`);
3882
3887
  yield this.finishTableRecordSelection(tableSelectionDetail, actionResult, serverError);
3883
3888
  if (serverError) {
3884
3889
  this.displayTableServerError();
3885
3890
  }
3891
+ console.log(`startTableServerRecordSelection 4`);
3886
3892
  tableObject.freeWaiting();
3887
3893
  });
3888
3894
  }
@@ -4117,6 +4123,7 @@ class BasicFormComponent extends FormStructureAndData {
4117
4123
  }
4118
4124
  notifyFormActivity() {
4119
4125
  if (this._notifyFormActivity) {
4126
+ console.log(`notifyFormActivity ${this.name}`);
4120
4127
  this._eventEmiter.next('formActivity', { code: this.formCode });
4121
4128
  }
4122
4129
  }