tuain-ng-forms-lib 12.0.6 → 12.0.10
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.
- package/bundles/tuain-ng-forms-lib.umd.js +24 -4
- package/bundles/tuain-ng-forms-lib.umd.js.map +1 -1
- package/esm2015/lib/classes/forms/field.js +4 -3
- package/esm2015/lib/classes/forms/form.js +4 -1
- package/esm2015/lib/components/elements/field.component.js +10 -2
- package/esm2015/lib/components/forms/basic-form.js +2 -2
- package/fesm2015/tuain-ng-forms-lib.js +16 -4
- package/fesm2015/tuain-ng-forms-lib.js.map +1 -1
- package/lib/classes/forms/form.d.ts +1 -0
- package/lib/components/elements/field.component.d.ts +3 -0
- package/lib/components/forms/basic-form.d.ts +1 -0
- package/package.json +1 -1
- package/tuain-ng-forms-lib.metadata.json +1 -1
|
@@ -51,6 +51,7 @@ ActionComponent.propDecorators = {
|
|
|
51
51
|
showLabel: [{ type: Input }]
|
|
52
52
|
};
|
|
53
53
|
|
|
54
|
+
const VALUE = '';
|
|
54
55
|
class FieldComponent {
|
|
55
56
|
ngOnInit() {
|
|
56
57
|
var _a, _b;
|
|
@@ -66,13 +67,20 @@ class FieldComponent {
|
|
|
66
67
|
this.fieldObject.attributeChange.subscribe(event => {
|
|
67
68
|
const { name: fieldAttr, value } = event;
|
|
68
69
|
const compAttr = this.formConfig.componentFieldAttrMap[fieldAttr];
|
|
69
|
-
|
|
70
|
+
if (compAttr === VALUE) {
|
|
71
|
+
this.updateValue();
|
|
72
|
+
}
|
|
73
|
+
else if (this.hasOwnProperty(compAttr)) {
|
|
74
|
+
this[compAttr] = value;
|
|
75
|
+
}
|
|
70
76
|
});
|
|
71
77
|
}
|
|
72
78
|
this.start();
|
|
73
79
|
}
|
|
74
80
|
start() { }
|
|
75
81
|
focus() { }
|
|
82
|
+
updateValue() { }
|
|
83
|
+
updateObject() { }
|
|
76
84
|
onInputChange() {
|
|
77
85
|
setTimeout(() => this.fieldObject.notifyEditionPartial(), 50);
|
|
78
86
|
}
|
|
@@ -1495,7 +1503,8 @@ class FieldDescriptor extends FormElement {
|
|
|
1495
1503
|
return (_b = this._fieldValue) !== null && _b !== void 0 ? _b : false;
|
|
1496
1504
|
break;
|
|
1497
1505
|
case this._formConfig.fieldTypes.currency:
|
|
1498
|
-
return this._fieldValue
|
|
1506
|
+
return (typeof this._fieldValue === 'string')
|
|
1507
|
+
? this._fieldValue.replace(',', '') : this._fieldValue;
|
|
1499
1508
|
break;
|
|
1500
1509
|
default:
|
|
1501
1510
|
return this._fieldValue;
|
|
@@ -1642,7 +1651,7 @@ class FieldDescriptor extends FormElement {
|
|
|
1642
1651
|
}
|
|
1643
1652
|
break;
|
|
1644
1653
|
case this._formConfig.fieldTypes.currency:
|
|
1645
|
-
newFinalValue = formatCurrency(
|
|
1654
|
+
newFinalValue = formatCurrency(newValue);
|
|
1646
1655
|
break;
|
|
1647
1656
|
default:
|
|
1648
1657
|
newFinalValue = newValue;
|
|
@@ -1868,6 +1877,9 @@ class FormStructureAndData {
|
|
|
1868
1877
|
getSections() {
|
|
1869
1878
|
return this._sections;
|
|
1870
1879
|
}
|
|
1880
|
+
get visibleSections() {
|
|
1881
|
+
return this._sections.filter(sec => sec.visible);
|
|
1882
|
+
}
|
|
1871
1883
|
numSections() {
|
|
1872
1884
|
return this._sections.length;
|
|
1873
1885
|
}
|
|
@@ -2483,6 +2495,7 @@ class BasicFormComponent {
|
|
|
2483
2495
|
disableActions(actionArray) { return this.formStructure.disableActions(actionArray); }
|
|
2484
2496
|
getStates() { return this.formStructure.getStates(); }
|
|
2485
2497
|
getSections() { return this.formStructure.getSections(); }
|
|
2498
|
+
get visibleSections() { return this.formStructure.visibleSections; }
|
|
2486
2499
|
getSection(sectionCode) { return this.formStructure.getSection(sectionCode); }
|
|
2487
2500
|
activateSection(sectionCode) { return this.formStructure.activateSection(sectionCode); }
|
|
2488
2501
|
getSubSection(sectionCode, subsectionCode) { return this.formStructure.getSubSection(sectionCode, subsectionCode); }
|
|
@@ -2567,7 +2580,6 @@ class BasicFormComponent {
|
|
|
2567
2580
|
this.controlToken = (_a = params === null || params === void 0 ? void 0 : params[TOKEN]) !== null && _a !== void 0 ? _a : null;
|
|
2568
2581
|
const { token, subject, state, fields, extra, originToken } = this.formManagerService.getFormInfo(this.controlToken);
|
|
2569
2582
|
if (!this.controlToken || this.controlToken !== token) {
|
|
2570
|
-
console.log(`No se obtuvo un token válido para abrir el formulario ${this.name}:${this.controlToken}->${token}`);
|
|
2571
2583
|
return;
|
|
2572
2584
|
}
|
|
2573
2585
|
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;
|