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.
- package/bundles/tuain-ng-forms-lib.umd.js +36 -3
- package/bundles/tuain-ng-forms-lib.umd.js.map +1 -1
- package/esm2015/lib/classes/forms/field.js +2 -2
- package/esm2015/lib/classes/forms/form.js +6 -1
- package/esm2015/lib/components/elements/field.component.js +10 -2
- package/esm2015/lib/components/forms/basic-form.js +6 -2
- package/fesm2015/tuain-ng-forms-lib.js +20 -3
- package/fesm2015/tuain-ng-forms-lib.js.map +1 -1
- package/lib/classes/forms/form.d.ts +3 -0
- package/lib/components/elements/field.component.d.ts +3 -0
- package/lib/components/forms/basic-form.d.ts +3 -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
|
}
|
|
@@ -1643,7 +1651,7 @@ class FieldDescriptor extends FormElement {
|
|
|
1643
1651
|
}
|
|
1644
1652
|
break;
|
|
1645
1653
|
case this._formConfig.fieldTypes.currency:
|
|
1646
|
-
newFinalValue = formatCurrency(
|
|
1654
|
+
newFinalValue = formatCurrency(newValue);
|
|
1647
1655
|
break;
|
|
1648
1656
|
default:
|
|
1649
1657
|
newFinalValue = newValue;
|
|
@@ -1860,6 +1868,7 @@ class FormStructureAndData {
|
|
|
1860
1868
|
? this._sectionsObj[sectionCode] : null;
|
|
1861
1869
|
return (section) ? section.getSubsection(subsectionCode) : null;
|
|
1862
1870
|
}
|
|
1871
|
+
get actions() { return this.getActions(); }
|
|
1863
1872
|
getSection(sectionCode) {
|
|
1864
1873
|
return (this._sectionsObj && this._sectionsObj[sectionCode])
|
|
1865
1874
|
? this._sectionsObj[sectionCode] : null;
|
|
@@ -1869,6 +1878,9 @@ class FormStructureAndData {
|
|
|
1869
1878
|
getSections() {
|
|
1870
1879
|
return this._sections;
|
|
1871
1880
|
}
|
|
1881
|
+
get visibleSections() {
|
|
1882
|
+
return this._sections.filter(sec => sec.visible);
|
|
1883
|
+
}
|
|
1872
1884
|
numSections() {
|
|
1873
1885
|
return this._sections.length;
|
|
1874
1886
|
}
|
|
@@ -1988,6 +2000,7 @@ class FormStructureAndData {
|
|
|
1988
2000
|
const actionNames = (Array.isArray(actionArray)) ? actionArray : [actionArray];
|
|
1989
2001
|
actionNames.forEach(actionCode => this.disableAction(actionCode));
|
|
1990
2002
|
}
|
|
2003
|
+
get fields() { return this.getFields(); }
|
|
1991
2004
|
enableField(fieldCode) {
|
|
1992
2005
|
const fieldObject = this.getFieldObject(fieldCode);
|
|
1993
2006
|
return (fieldObject) ? fieldObject.enable() : null;
|
|
@@ -2368,6 +2381,8 @@ class BasicFormComponent {
|
|
|
2368
2381
|
this.errorMessage = '';
|
|
2369
2382
|
this.errorDetail = '';
|
|
2370
2383
|
this.formStructure = null;
|
|
2384
|
+
this.fields = null;
|
|
2385
|
+
this.actions = null;
|
|
2371
2386
|
this.controlToken = null;
|
|
2372
2387
|
this.inputDataFields = {};
|
|
2373
2388
|
this.definitionObtained = false;
|
|
@@ -2484,6 +2499,7 @@ class BasicFormComponent {
|
|
|
2484
2499
|
disableActions(actionArray) { return this.formStructure.disableActions(actionArray); }
|
|
2485
2500
|
getStates() { return this.formStructure.getStates(); }
|
|
2486
2501
|
getSections() { return this.formStructure.getSections(); }
|
|
2502
|
+
get visibleSections() { return this.formStructure.visibleSections; }
|
|
2487
2503
|
getSection(sectionCode) { return this.formStructure.getSection(sectionCode); }
|
|
2488
2504
|
activateSection(sectionCode) { return this.formStructure.activateSection(sectionCode); }
|
|
2489
2505
|
getSubSection(sectionCode, subsectionCode) { return this.formStructure.getSubSection(sectionCode, subsectionCode); }
|
|
@@ -2568,7 +2584,6 @@ class BasicFormComponent {
|
|
|
2568
2584
|
this.controlToken = (_a = params === null || params === void 0 ? void 0 : params[TOKEN]) !== null && _a !== void 0 ? _a : null;
|
|
2569
2585
|
const { token, subject, state, fields, extra, originToken } = this.formManagerService.getFormInfo(this.controlToken);
|
|
2570
2586
|
if (!this.controlToken || this.controlToken !== token) {
|
|
2571
|
-
console.log(`No se obtuvo un token válido para abrir el formulario ${this.name}:${this.controlToken}->${token}`);
|
|
2572
2587
|
return;
|
|
2573
2588
|
}
|
|
2574
2589
|
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;
|
|
@@ -2633,6 +2648,8 @@ class BasicFormComponent {
|
|
|
2633
2648
|
const formDefinition = yield this.formManagerService.getFormDefinition(this.name);
|
|
2634
2649
|
this.inServerProcess = false;
|
|
2635
2650
|
this.formStructure = new FormStructureAndData(formDefinition, this.formConfig);
|
|
2651
|
+
this.fields = this.formStructure.fields;
|
|
2652
|
+
this.actions = this.formStructure.actions;
|
|
2636
2653
|
this.definitionObtained = true;
|
|
2637
2654
|
}
|
|
2638
2655
|
else {
|