tuain-ng-forms-lib 15.0.14 → 15.0.17

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.
@@ -160,17 +160,13 @@ class FieldComponent extends ElementComponent {
160
160
  // Subscripción a cambios en atributos
161
161
  (_l = this.field) === null || _l === void 0 ? void 0 : _l.attributeChange.subscribe(event => {
162
162
  const { name: componentAttr, value } = event;
163
- console.log('El llamado defaultProcessAttributeChange es pos suscripción...');
164
- console.log(event);
165
163
  this.defaultProcessAttributeChange(componentAttr, value);
166
164
  this.customProcessAttributeChange(componentAttr, value);
167
165
  });
168
166
  this.start();
169
167
  }
170
168
  defaultProcessAttributeChange(attribute, value) {
171
- var _a;
172
169
  if (attribute === VALUE) {
173
- console.log(`Llegó un update value de ${(_a = this.field) === null || _a === void 0 ? void 0 : _a.fieldCode} por defaultProcessAttributeChange`);
174
170
  this.updateValue();
175
171
  }
176
172
  else if (attribute === FOCUS) {
@@ -181,20 +177,12 @@ class FieldComponent extends ElementComponent {
181
177
  }
182
178
  return true;
183
179
  }
184
- updateValue() {
185
- var _a, _b;
186
- console.log(`Update value de ${(_a = this.field) === null || _a === void 0 ? void 0 : _a.fieldCode}`);
187
- this.value = (_b = this.field) === null || _b === void 0 ? void 0 : _b.value;
188
- }
180
+ updateValue() { var _a; this.value = (_a = this.field) === null || _a === void 0 ? void 0 : _a.value; }
189
181
  onInputChange() { setTimeout(() => { var _a; return (_a = this.field) === null || _a === void 0 ? void 0 : _a.notifyEditionPartial(); }, 50); }
190
182
  onChangeContent() { setTimeout(() => { var _a; return (_a = this.field) === null || _a === void 0 ? void 0 : _a.notifyEditionFinish(); }, 50); }
191
183
  onShowInfo(detail = null) { setTimeout(() => { var _a; return (_a = this.field) === null || _a === void 0 ? void 0 : _a.notifyEditionDetailRequest(detail); }, 50); }
192
184
  focus() { }
193
- updateObject(widgetUpdate = true) {
194
- var _a, _b;
195
- console.log(`updateObject ${(_a = this.field) === null || _a === void 0 ? void 0 : _a.fieldCode} update ${widgetUpdate}`);
196
- (_b = this.field) === null || _b === void 0 ? void 0 : _b.setValue(this.value, widgetUpdate);
197
- }
185
+ updateObject(widgetUpdate = true) { var _a; (_a = this.field) === null || _a === void 0 ? void 0 : _a.setValue(this.value, widgetUpdate); }
198
186
  inputChanged() {
199
187
  var _a;
200
188
  (_a = this.field) === null || _a === void 0 ? void 0 : _a.setValue(this.value);
@@ -673,7 +661,6 @@ class FormPiecePropagate extends FormPiece {
673
661
  get attributeChange() { return this._attributeChange; }
674
662
  propagateAttribute(name, value) {
675
663
  var _a;
676
- console.log('propagateAttribute...');
677
664
  (_a = this._attributeChange) === null || _a === void 0 ? void 0 : _a.next({ name, value });
678
665
  }
679
666
  setCustomAttribute(name, value) {
@@ -681,7 +668,6 @@ class FormPiecePropagate extends FormPiece {
681
668
  super.setCustomAttribute(name, value);
682
669
  if ((_a = this.propagationCustomAttributes) === null || _a === void 0 ? void 0 : _a.includes(name)) {
683
670
  const fullName = `customAttributes.${name}`;
684
- console.log(`La propagación se origina en setCustomAttribute ${name} ${value}`);
685
671
  this.propagateAttribute(fullName, value);
686
672
  }
687
673
  }
@@ -711,7 +697,6 @@ class FormElement extends FormPiecePropagate {
711
697
  setAttr(attr, value) {
712
698
  const { name: attrName, propagate: name } = attr;
713
699
  this[attrName] = value;
714
- console.log(`La propagacioón se origina en setAttr ${attrName} ${value} (propaga ${name})`);
715
700
  name && this.propagateAttribute(name, value);
716
701
  }
717
702
  isField() { return this.elementType === elementTypes.field; }
@@ -834,7 +819,7 @@ const attrs$1 = {
834
819
  };
835
820
  class FieldDescriptor extends FormElement {
836
821
  constructor(inputFieldReceived, formConfig) {
837
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
822
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
838
823
  super(inputFieldReceived, formConfig);
839
824
  this._editionFinish = new Subject();
840
825
  this._editionPartial = new Subject();
@@ -861,6 +846,7 @@ class FieldDescriptor extends FormElement {
861
846
  this._hasChanged = false;
862
847
  this._outputOnly = false;
863
848
  this._tooltipText = '';
849
+ this.placeholder = '';
864
850
  this.fieldCode = '';
865
851
  this.fieldOptions = null;
866
852
  this.propagationCustomAttributes = (_c = (_b = (_a = this._formConfig) === null || _a === void 0 ? void 0 : _a.propagationCustomAttributes) === null || _b === void 0 ? void 0 : _b.fields) !== null && _c !== void 0 ? _c : [];
@@ -868,9 +854,10 @@ class FieldDescriptor extends FormElement {
868
854
  const fld = (inputFieldReceived) ? inputFieldReceived : {};
869
855
  this.setAttr(attrs$1.fieldCode, fld.fieldCode);
870
856
  this.title = (_d = fld.fieldTitle) !== null && _d !== void 0 ? _d : this.fieldCode;
857
+ this.placeholder = (_e = fld.placeholder) !== null && _e !== void 0 ? _e : this.title;
871
858
  this.type = fld.fieldTypeCode;
872
- this.captureType = (_e = fld.captureType) !== null && _e !== void 0 ? _e : DEFAULT_CAPTURE_TYPE;
873
- const defaultValue = (_f = fld.defaultValue) !== null && _f !== void 0 ? _f : null;
859
+ this.captureType = (_f = fld.captureType) !== null && _f !== void 0 ? _f : DEFAULT_CAPTURE_TYPE;
860
+ const defaultValue = (_g = fld.defaultValue) !== null && _g !== void 0 ? _g : null;
874
861
  if (this._fieldType === this._formConfig.fieldTypes.boolean) {
875
862
  this.defaultValue = defaultValue !== null && defaultValue !== void 0 ? defaultValue : false;
876
863
  }
@@ -890,19 +877,19 @@ class FieldDescriptor extends FormElement {
890
877
  fieldFormat = null;
891
878
  }
892
879
  this.format = fieldFormat;
893
- this.validateOnServer = (_g = fld.serverAction) !== null && _g !== void 0 ? _g : false;
880
+ this.validateOnServer = (_h = fld.serverAction) !== null && _h !== void 0 ? _h : false;
894
881
  this.tooltip = fld.tooltip || '';
895
882
  this.defaultEditable = this.enabled;
896
- this.required = (_h = fld.required) !== null && _h !== void 0 ? _h : false;
897
- this.outputOnly = (_j = fld.outputOnly) !== null && _j !== void 0 ? _j : false;
883
+ this.required = (_j = fld.required) !== null && _j !== void 0 ? _j : false;
884
+ this.outputOnly = (_k = fld.outputOnly) !== null && _k !== void 0 ? _k : false;
898
885
  this.maxLength = fld.maxLength || (this._captureType === 'TEXTAREA' ? BIG_MAX_LENGTH : STD_MAX_LENGTH);
899
- this.intrinsicErrorMessage = (_s = (_o = (_m = (_l = (_k = this._formConfig) === null || _k === void 0 ? void 0 : _k.fieldValidations) === null || _l === void 0 ? void 0 : _l[this._fieldType]) === null || _m === void 0 ? void 0 : _m.message) !== null && _o !== void 0 ? _o : (_r = (_q = (_p = this._formConfig) === null || _p === void 0 ? void 0 : _p.fieldValidations) === null || _q === void 0 ? void 0 : _q.DEFAULT) === null || _r === void 0 ? void 0 : _r.message) !== null && _s !== void 0 ? _s : '';
900
- this.setError(fld.errorCode, fld.errorMessage, (_t = fld.errorType) !== null && _t !== void 0 ? _t : DEFAULT_ERROR_TYPE);
901
- this.setEditable((_u = fld.editable) !== null && _u !== void 0 ? _u : true);
902
- this.visibleLabel = (_v = fld.visibleLabel) !== null && _v !== void 0 ? _v : true;
886
+ this.intrinsicErrorMessage = (_t = (_p = (_o = (_m = (_l = this._formConfig) === null || _l === void 0 ? void 0 : _l.fieldValidations) === null || _m === void 0 ? void 0 : _m[this._fieldType]) === null || _o === void 0 ? void 0 : _o.message) !== null && _p !== void 0 ? _p : (_s = (_r = (_q = this._formConfig) === null || _q === void 0 ? void 0 : _q.fieldValidations) === null || _r === void 0 ? void 0 : _r.DEFAULT) === null || _s === void 0 ? void 0 : _s.message) !== null && _t !== void 0 ? _t : '';
887
+ this.setError(fld.errorCode, fld.errorMessage, (_u = fld.errorType) !== null && _u !== void 0 ? _u : DEFAULT_ERROR_TYPE);
888
+ this.setEditable((_v = fld.editable) !== null && _v !== void 0 ? _v : true);
889
+ this.visibleLabel = (_w = fld.visibleLabel) !== null && _w !== void 0 ? _w : true;
903
890
  this.setVisibility(fld.visible);
904
891
  this.options = fld.fieldOptions;
905
- this._setValue((_x = (_w = fld.fieldValue) !== null && _w !== void 0 ? _w : this._defaultValue) !== null && _x !== void 0 ? _x : '');
892
+ this._setValue((_y = (_x = fld.fieldValue) !== null && _x !== void 0 ? _x : this._defaultValue) !== null && _y !== void 0 ? _y : '');
906
893
  }
907
894
  get alignment() { return this._fieldAlignment; }
908
895
  set alignment(alignment) { this.setAttr(attrs$1._fieldAlignment, alignment); }
@@ -1002,7 +989,6 @@ class FieldDescriptor extends FormElement {
1002
989
  if (this._value) {
1003
990
  if (this._fieldType === this._formConfig.fieldTypes.array && Array.isArray(this._value)) {
1004
991
  const fieldValue = (_a = this._value) === null || _a === void 0 ? void 0 : _a.filter(item => { var _a; return (_a = this.fieldOptions) === null || _a === void 0 ? void 0 : _a.find(opt => opt.fieldOptionId === item); });
1005
- console.log('SetAttr de valor....');
1006
992
  this.setAttr(attrs$1._value, fieldValue);
1007
993
  }
1008
994
  else {
@@ -1218,11 +1204,9 @@ class FieldDescriptor extends FormElement {
1218
1204
  if (this._value !== newFinalValue) {
1219
1205
  this.hasChanged = true;
1220
1206
  if (widgetUpdate) {
1221
- console.log(`SetValue ${this.fieldCode} CON update`);
1222
1207
  this.setAttr(attrs$1._value, newFinalValue);
1223
1208
  }
1224
1209
  else {
1225
- console.log(`SetValue ${this.fieldCode} sin update`);
1226
1210
  this._value = newFinalValue;
1227
1211
  }
1228
1212
  }
@@ -3279,6 +3263,9 @@ class BasicFormComponent extends FormStructureAndData {
3279
3263
  return __awaiter(this, void 0, void 0, function* () {
3280
3264
  const action = (typeof actionInput === 'string')
3281
3265
  ? this.getAction(actionInput) : actionInput;
3266
+ if (!action) {
3267
+ return;
3268
+ }
3282
3269
  let serverError = false;
3283
3270
  let actionResult = null;
3284
3271
  if (action.backend) {