tuain-ng-forms-lib 12.0.24 → 12.0.28
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 +928 -949
- package/bundles/tuain-ng-forms-lib.umd.js.map +1 -1
- package/esm2015/lib/classes/forms/element.js +5 -3
- package/esm2015/lib/classes/forms/field.js +6 -2
- package/esm2015/lib/classes/forms/form.js +123 -190
- package/esm2015/lib/classes/forms/table/row-data.js +1 -1
- package/esm2015/lib/components/forms/basic-form.js +468 -347
- package/fesm2015/tuain-ng-forms-lib.js +771 -711
- package/fesm2015/tuain-ng-forms-lib.js.map +1 -1
- package/lib/classes/forms/element.d.ts +9 -9
- package/lib/classes/forms/field.d.ts +4 -0
- package/lib/classes/forms/form.d.ts +84 -69
- package/lib/components/forms/basic-form.d.ts +145 -153
- package/package.json +1 -1
- package/tuain-ng-forms-lib.metadata.json +1 -1
|
@@ -657,10 +657,14 @@
|
|
|
657
657
|
this.disabled = (_a = elementDefinition === null || elementDefinition === void 0 ? void 0 : elementDefinition.disabled) !== null && _a !== void 0 ? _a : false;
|
|
658
658
|
this.setVisibility((_b = elementDefinition === null || elementDefinition === void 0 ? void 0 : elementDefinition.visible) !== null && _b !== void 0 ? _b : true);
|
|
659
659
|
this.widget = null;
|
|
660
|
-
this.customAttributes = (_c = elementDefinition === null || elementDefinition === void 0 ? void 0 : elementDefinition.customAttributes) !== null && _c !== void 0 ? _c :
|
|
660
|
+
this.customAttributes = (_c = elementDefinition === null || elementDefinition === void 0 ? void 0 : elementDefinition.customAttributes) !== null && _c !== void 0 ? _c : {};
|
|
661
661
|
}
|
|
662
662
|
FormElement.prototype.getCustomAttribute = function (name) { var _a, _b; return (_b = (_a = this.customAttributes) === null || _a === void 0 ? void 0 : _a[name]) !== null && _b !== void 0 ? _b : null; };
|
|
663
|
-
FormElement.prototype.setCustomAttribute = function (name, value) {
|
|
663
|
+
FormElement.prototype.setCustomAttribute = function (name, value) {
|
|
664
|
+
if (name) {
|
|
665
|
+
this.customAttributes[name] = value;
|
|
666
|
+
}
|
|
667
|
+
};
|
|
664
668
|
FormElement.prototype.matchAttribute = function (name, value) { var _a; return ((_a = this.customAttributes) === null || _a === void 0 ? void 0 : _a[name]) === value; };
|
|
665
669
|
FormElement.prototype.isField = function () { return this.elementType === elementTypes.field; };
|
|
666
670
|
FormElement.prototype.isAction = function () { return this.elementType === elementTypes.action; };
|
|
@@ -1638,256 +1642,6 @@
|
|
|
1638
1642
|
waiting: [{ type: core.Input }]
|
|
1639
1643
|
};
|
|
1640
1644
|
|
|
1641
|
-
var RecordFormSubSection = /** @class */ (function () {
|
|
1642
|
-
function RecordFormSubSection(subsectionReceived, formObject) {
|
|
1643
|
-
var e_1, _a;
|
|
1644
|
-
if (!subsectionReceived) {
|
|
1645
|
-
return;
|
|
1646
|
-
}
|
|
1647
|
-
this._customRender = null;
|
|
1648
|
-
this.visible = true;
|
|
1649
|
-
this.subSectionElements = [];
|
|
1650
|
-
this.subSectionFields = [];
|
|
1651
|
-
this.subSectionTables = [];
|
|
1652
|
-
this.subSectionActions = [];
|
|
1653
|
-
this.elementsArray = {};
|
|
1654
|
-
this.subsectionId = (subsectionReceived.subsectionId) ? subsectionReceived.subsectionId.toString() : '';
|
|
1655
|
-
this.subsectionCode = (subsectionReceived.subsectionCode) ? subsectionReceived.subsectionCode : '';
|
|
1656
|
-
this.subsectionTitle = (subsectionReceived.subsectionTitle) ? subsectionReceived.subsectionTitle : '';
|
|
1657
|
-
this.visibleStates = subsectionReceived.visibleStates || [];
|
|
1658
|
-
if (subsectionReceived.elements) {
|
|
1659
|
-
try {
|
|
1660
|
-
for (var _b = __values(subsectionReceived.elements), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
1661
|
-
var receivedElement = _c.value;
|
|
1662
|
-
var elementObject = null;
|
|
1663
|
-
var arrayToAdd = null;
|
|
1664
|
-
var type = receivedElement.type, code = receivedElement.code;
|
|
1665
|
-
switch (type) {
|
|
1666
|
-
case elementTypes.field:
|
|
1667
|
-
elementObject = formObject.getFieldObject(code);
|
|
1668
|
-
arrayToAdd = this.subSectionFields;
|
|
1669
|
-
break;
|
|
1670
|
-
case elementTypes.table:
|
|
1671
|
-
elementObject = formObject.getTableObject(code);
|
|
1672
|
-
arrayToAdd = this.subSectionTables;
|
|
1673
|
-
break;
|
|
1674
|
-
case elementTypes.action:
|
|
1675
|
-
elementObject = formObject.getActionObject(code);
|
|
1676
|
-
arrayToAdd = this.subSectionActions;
|
|
1677
|
-
break;
|
|
1678
|
-
}
|
|
1679
|
-
if (elementObject) {
|
|
1680
|
-
elementObject.elementType = type;
|
|
1681
|
-
arrayToAdd.push(elementObject);
|
|
1682
|
-
this.subSectionElements.push(elementObject);
|
|
1683
|
-
this.elementsArray[code] = elementObject;
|
|
1684
|
-
}
|
|
1685
|
-
}
|
|
1686
|
-
}
|
|
1687
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
1688
|
-
finally {
|
|
1689
|
-
try {
|
|
1690
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
1691
|
-
}
|
|
1692
|
-
finally { if (e_1) throw e_1.error; }
|
|
1693
|
-
}
|
|
1694
|
-
}
|
|
1695
|
-
}
|
|
1696
|
-
RecordFormSubSection.prototype.show = function () { this.visible = true; };
|
|
1697
|
-
RecordFormSubSection.prototype.hide = function () { this.visible = false; };
|
|
1698
|
-
Object.defineProperty(RecordFormSubSection.prototype, "customRender", {
|
|
1699
|
-
get: function () { return this._customRender; },
|
|
1700
|
-
set: function (customRenderName) { this._customRender = customRenderName; },
|
|
1701
|
-
enumerable: false,
|
|
1702
|
-
configurable: true
|
|
1703
|
-
});
|
|
1704
|
-
RecordFormSubSection.prototype.getField = function (name) {
|
|
1705
|
-
return this.subSectionFields.find(function (fld) { return fld.name === name; });
|
|
1706
|
-
};
|
|
1707
|
-
RecordFormSubSection.prototype.getFields = function () {
|
|
1708
|
-
return this.subSectionFields;
|
|
1709
|
-
};
|
|
1710
|
-
RecordFormSubSection.prototype.getFieldNames = function () {
|
|
1711
|
-
return this.subSectionFields.map(function (field) { return field.fieldCode; });
|
|
1712
|
-
};
|
|
1713
|
-
RecordFormSubSection.prototype.viewOnState = function (state) {
|
|
1714
|
-
return this.visibleStates.includes(state);
|
|
1715
|
-
};
|
|
1716
|
-
RecordFormSubSection.prototype.supportMode = function (state) { return this.viewOnState(state); };
|
|
1717
|
-
return RecordFormSubSection;
|
|
1718
|
-
}());
|
|
1719
|
-
|
|
1720
|
-
var RecordFormSection = /** @class */ (function () {
|
|
1721
|
-
function RecordFormSection(sectionReceived, formObject) {
|
|
1722
|
-
var e_1, _c;
|
|
1723
|
-
var _this = this;
|
|
1724
|
-
var _a;
|
|
1725
|
-
this._activation = new rxjs.Subject();
|
|
1726
|
-
this._inactivation = new rxjs.Subject();
|
|
1727
|
-
this.active = false;
|
|
1728
|
-
if (!sectionReceived) {
|
|
1729
|
-
return;
|
|
1730
|
-
}
|
|
1731
|
-
this.visible = true;
|
|
1732
|
-
this.sectionId = (sectionReceived.sectionId) ? sectionReceived.sectionId.toString() : '';
|
|
1733
|
-
this.sectionCode = (sectionReceived.sectionCode) ? sectionReceived.sectionCode : '';
|
|
1734
|
-
this.sectionTitle = (sectionReceived.sectionTitle) ? sectionReceived.sectionTitle : '';
|
|
1735
|
-
this.visibleStates = sectionReceived.visibleStates || [];
|
|
1736
|
-
this.subSections = [];
|
|
1737
|
-
this.subSectionsObj = {};
|
|
1738
|
-
if (sectionReceived.subsections) {
|
|
1739
|
-
var subsections = sectionReceived.subsections.map(function (objDef) {
|
|
1740
|
-
var visibleStates = objDef.visibleStates;
|
|
1741
|
-
if (!visibleStates) {
|
|
1742
|
-
visibleStates = (objDef.subsectionModes || '').split(',')
|
|
1743
|
-
.map(function (state) { return state.trim(); })
|
|
1744
|
-
.filter(function (state) { return state.length > 0; });
|
|
1745
|
-
}
|
|
1746
|
-
if (!visibleStates || visibleStates.length === 0) {
|
|
1747
|
-
visibleStates = _this.visibleStates;
|
|
1748
|
-
}
|
|
1749
|
-
if (objDef.elements && Array.isArray(objDef.elements)) {
|
|
1750
|
-
objDef.elements = objDef.elements.map(function (elm) { return ({ code: elm.elementCode, type: elm.elementTypeName }); });
|
|
1751
|
-
}
|
|
1752
|
-
return Object.assign(Object.assign({}, objDef), { visibleStates: visibleStates });
|
|
1753
|
-
});
|
|
1754
|
-
try {
|
|
1755
|
-
for (var subsections_1 = __values(subsections), subsections_1_1 = subsections_1.next(); !subsections_1_1.done; subsections_1_1 = subsections_1.next()) {
|
|
1756
|
-
var subsectionReceived = subsections_1_1.value;
|
|
1757
|
-
var subSectionToAdd = new RecordFormSubSection(subsectionReceived, formObject);
|
|
1758
|
-
var subsectionCode = subSectionToAdd.subsectionCode;
|
|
1759
|
-
if (subsectionCode) {
|
|
1760
|
-
this.subSections.push(subSectionToAdd);
|
|
1761
|
-
this.subSectionsObj[subsectionCode] = subSectionToAdd;
|
|
1762
|
-
}
|
|
1763
|
-
}
|
|
1764
|
-
}
|
|
1765
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
1766
|
-
finally {
|
|
1767
|
-
try {
|
|
1768
|
-
if (subsections_1_1 && !subsections_1_1.done && (_c = subsections_1.return)) _c.call(subsections_1);
|
|
1769
|
-
}
|
|
1770
|
-
finally { if (e_1) throw e_1.error; }
|
|
1771
|
-
}
|
|
1772
|
-
}
|
|
1773
|
-
this.customAttributes = (_a = sectionReceived === null || sectionReceived === void 0 ? void 0 : sectionReceived.customAttributes) !== null && _a !== void 0 ? _a : null;
|
|
1774
|
-
}
|
|
1775
|
-
RecordFormSection.prototype.getCustomAttribute = function (name) { var _a, _b; return (_b = (_a = this.customAttributes) === null || _a === void 0 ? void 0 : _a[name]) !== null && _b !== void 0 ? _b : null; };
|
|
1776
|
-
RecordFormSection.prototype.setCustomAttribute = function (name, value) { return name && (this.customAttributes[name] = value); };
|
|
1777
|
-
RecordFormSection.prototype.matchAttribute = function (name, value) { var _a; return ((_a = this.customAttributes) === null || _a === void 0 ? void 0 : _a[name]) === value; };
|
|
1778
|
-
Object.defineProperty(RecordFormSection.prototype, "code", {
|
|
1779
|
-
get: function () { return this.sectionCode; },
|
|
1780
|
-
enumerable: false,
|
|
1781
|
-
configurable: true
|
|
1782
|
-
});
|
|
1783
|
-
Object.defineProperty(RecordFormSection.prototype, "activation", {
|
|
1784
|
-
get: function () { return this._activation; },
|
|
1785
|
-
enumerable: false,
|
|
1786
|
-
configurable: true
|
|
1787
|
-
});
|
|
1788
|
-
Object.defineProperty(RecordFormSection.prototype, "inactivation", {
|
|
1789
|
-
get: function () { return this._inactivation; },
|
|
1790
|
-
enumerable: false,
|
|
1791
|
-
configurable: true
|
|
1792
|
-
});
|
|
1793
|
-
RecordFormSection.prototype.activate = function () {
|
|
1794
|
-
if (!this.active) {
|
|
1795
|
-
this.active = true;
|
|
1796
|
-
this._activation.next(this.sectionCode);
|
|
1797
|
-
}
|
|
1798
|
-
};
|
|
1799
|
-
RecordFormSection.prototype.inactivate = function () {
|
|
1800
|
-
if (this.active) {
|
|
1801
|
-
this.active = false;
|
|
1802
|
-
this._inactivation.next(this.sectionCode);
|
|
1803
|
-
}
|
|
1804
|
-
};
|
|
1805
|
-
RecordFormSection.prototype.show = function () { this.visible = true; };
|
|
1806
|
-
RecordFormSection.prototype.hide = function () { this.visible = false; };
|
|
1807
|
-
Object.defineProperty(RecordFormSection.prototype, "title", {
|
|
1808
|
-
get: function () { return this.sectionTitle; },
|
|
1809
|
-
set: function (title) { this.sectionTitle = title; },
|
|
1810
|
-
enumerable: false,
|
|
1811
|
-
configurable: true
|
|
1812
|
-
});
|
|
1813
|
-
RecordFormSection.prototype.getVisibleSubsections = function (state) {
|
|
1814
|
-
return this.subSections.filter(function (subSection) {
|
|
1815
|
-
return subSection.visible && subSection.viewOnState(state);
|
|
1816
|
-
});
|
|
1817
|
-
};
|
|
1818
|
-
RecordFormSection.prototype.getSubsection = function (subSectionCode) {
|
|
1819
|
-
return (this.subSectionsObj && this.subSectionsObj[subSectionCode])
|
|
1820
|
-
? this.subSectionsObj[subSectionCode] : null;
|
|
1821
|
-
};
|
|
1822
|
-
RecordFormSection.prototype.getFields = function () {
|
|
1823
|
-
var e_2, _c;
|
|
1824
|
-
var fieldsArray = [];
|
|
1825
|
-
if (this.subSections && this.subSections.length > 0) {
|
|
1826
|
-
try {
|
|
1827
|
-
for (var _d = __values(this.subSections), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
1828
|
-
var subSection = _e.value;
|
|
1829
|
-
fieldsArray = fieldsArray.concat(subSection.getFields());
|
|
1830
|
-
}
|
|
1831
|
-
}
|
|
1832
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
1833
|
-
finally {
|
|
1834
|
-
try {
|
|
1835
|
-
if (_e && !_e.done && (_c = _d.return)) _c.call(_d);
|
|
1836
|
-
}
|
|
1837
|
-
finally { if (e_2) throw e_2.error; }
|
|
1838
|
-
}
|
|
1839
|
-
}
|
|
1840
|
-
return fieldsArray;
|
|
1841
|
-
};
|
|
1842
|
-
RecordFormSection.prototype.getFieldNames = function () {
|
|
1843
|
-
var e_3, _c;
|
|
1844
|
-
var fieldsArray = [];
|
|
1845
|
-
if (this.subSections && this.subSections.length > 0) {
|
|
1846
|
-
try {
|
|
1847
|
-
for (var _d = __values(this.subSections), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
1848
|
-
var subSection = _e.value;
|
|
1849
|
-
fieldsArray = fieldsArray.concat(subSection.getFieldNames());
|
|
1850
|
-
}
|
|
1851
|
-
}
|
|
1852
|
-
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
1853
|
-
finally {
|
|
1854
|
-
try {
|
|
1855
|
-
if (_e && !_e.done && (_c = _d.return)) _c.call(_d);
|
|
1856
|
-
}
|
|
1857
|
-
finally { if (e_3) throw e_3.error; }
|
|
1858
|
-
}
|
|
1859
|
-
}
|
|
1860
|
-
return fieldsArray;
|
|
1861
|
-
};
|
|
1862
|
-
RecordFormSection.prototype.getField = function (name) {
|
|
1863
|
-
var e_4, _c;
|
|
1864
|
-
var field = null;
|
|
1865
|
-
if (this.subSections && this.subSections.length > 0) {
|
|
1866
|
-
try {
|
|
1867
|
-
for (var _d = __values(this.subSections), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
1868
|
-
var subSection = _e.value;
|
|
1869
|
-
field = subSection.getField(name);
|
|
1870
|
-
if (field) {
|
|
1871
|
-
return field;
|
|
1872
|
-
}
|
|
1873
|
-
}
|
|
1874
|
-
}
|
|
1875
|
-
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
1876
|
-
finally {
|
|
1877
|
-
try {
|
|
1878
|
-
if (_e && !_e.done && (_c = _d.return)) _c.call(_d);
|
|
1879
|
-
}
|
|
1880
|
-
finally { if (e_4) throw e_4.error; }
|
|
1881
|
-
}
|
|
1882
|
-
}
|
|
1883
|
-
return null;
|
|
1884
|
-
};
|
|
1885
|
-
RecordFormSection.prototype.supportState = function (state) { return this.viewOnState(state); };
|
|
1886
|
-
RecordFormSection.prototype.viewOnState = function (state) { return this.visibleStates.includes(state); };
|
|
1887
|
-
RecordFormSection.prototype.supportMode = function (state) { return this.viewOnState(state); };
|
|
1888
|
-
return RecordFormSection;
|
|
1889
|
-
}());
|
|
1890
|
-
|
|
1891
1645
|
var HEADER = 'HEADER';
|
|
1892
1646
|
var FormAction = /** @class */ (function (_super) {
|
|
1893
1647
|
__extends(FormAction, _super);
|
|
@@ -2034,6 +1788,11 @@
|
|
|
2034
1788
|
enumerable: false,
|
|
2035
1789
|
configurable: true
|
|
2036
1790
|
});
|
|
1791
|
+
Object.defineProperty(FieldDescriptor.prototype, "info", {
|
|
1792
|
+
get: function () { return this.fieldInfo; },
|
|
1793
|
+
enumerable: false,
|
|
1794
|
+
configurable: true
|
|
1795
|
+
});
|
|
2037
1796
|
Object.defineProperty(FieldDescriptor.prototype, "validating", {
|
|
2038
1797
|
get: function () { return this._onValidation; },
|
|
2039
1798
|
set: function (isValidating) { this.setAttr(fldAttr.onValidation, isValidating); },
|
|
@@ -2051,6 +1810,8 @@
|
|
|
2051
1810
|
enumerable: false,
|
|
2052
1811
|
configurable: true
|
|
2053
1812
|
});
|
|
1813
|
+
FieldDescriptor.prototype.getRequired = function () { return this.required; };
|
|
1814
|
+
FieldDescriptor.prototype.setRequired = function (required) { this.required = required; };
|
|
2054
1815
|
Object.defineProperty(FieldDescriptor.prototype, "required", {
|
|
2055
1816
|
get: function () { return this.fieldRequired; },
|
|
2056
1817
|
set: function (required) { this.setAttr(fldAttr.required, required !== null && required !== void 0 ? required : false); },
|
|
@@ -2110,7 +1871,7 @@
|
|
|
2110
1871
|
FieldDescriptor.prototype.changed = function () { this.setChanged(true); };
|
|
2111
1872
|
FieldDescriptor.prototype.getRawValue = function () { return this._fieldValue; };
|
|
2112
1873
|
FieldDescriptor.prototype.setLabel = function (label) { this.setAttr(fldAttr.title, label); };
|
|
2113
|
-
FieldDescriptor.prototype.clean = function () { this.setValue(this.defaultValue || ''); };
|
|
1874
|
+
FieldDescriptor.prototype.clean = function () { this.setValue(this.defaultValue || ''); this.resetError(); };
|
|
2114
1875
|
Object.defineProperty(FieldDescriptor.prototype, "backend", {
|
|
2115
1876
|
get: function () { return this.validateOnServer; },
|
|
2116
1877
|
enumerable: false,
|
|
@@ -2139,7 +1900,12 @@
|
|
|
2139
1900
|
FieldDescriptor.prototype.setErrorCode = function (code) { this.setError(code, this.errorMessage); };
|
|
2140
1901
|
FieldDescriptor.prototype.getErrorMessage = function () { return this.getError().message; };
|
|
2141
1902
|
FieldDescriptor.prototype.setErrorMessage = function (msg) { this.setError(this.errorCode, msg); };
|
|
2142
|
-
FieldDescriptor.prototype
|
|
1903
|
+
Object.defineProperty(FieldDescriptor.prototype, "empty", {
|
|
1904
|
+
get: function () { return this.isEmpty(); },
|
|
1905
|
+
enumerable: false,
|
|
1906
|
+
configurable: true
|
|
1907
|
+
});
|
|
1908
|
+
FieldDescriptor.prototype.isEmpty = function () {
|
|
2143
1909
|
var fieldCurrentValue = this.getValue();
|
|
2144
1910
|
if (fieldCurrentValue === undefined || fieldCurrentValue === null) {
|
|
2145
1911
|
return true;
|
|
@@ -2318,6 +2084,256 @@
|
|
|
2318
2084
|
return FieldDescriptor;
|
|
2319
2085
|
}(FormElement));
|
|
2320
2086
|
|
|
2087
|
+
var RecordFormSubSection = /** @class */ (function () {
|
|
2088
|
+
function RecordFormSubSection(subsectionReceived, formObject) {
|
|
2089
|
+
var e_1, _a;
|
|
2090
|
+
if (!subsectionReceived) {
|
|
2091
|
+
return;
|
|
2092
|
+
}
|
|
2093
|
+
this._customRender = null;
|
|
2094
|
+
this.visible = true;
|
|
2095
|
+
this.subSectionElements = [];
|
|
2096
|
+
this.subSectionFields = [];
|
|
2097
|
+
this.subSectionTables = [];
|
|
2098
|
+
this.subSectionActions = [];
|
|
2099
|
+
this.elementsArray = {};
|
|
2100
|
+
this.subsectionId = (subsectionReceived.subsectionId) ? subsectionReceived.subsectionId.toString() : '';
|
|
2101
|
+
this.subsectionCode = (subsectionReceived.subsectionCode) ? subsectionReceived.subsectionCode : '';
|
|
2102
|
+
this.subsectionTitle = (subsectionReceived.subsectionTitle) ? subsectionReceived.subsectionTitle : '';
|
|
2103
|
+
this.visibleStates = subsectionReceived.visibleStates || [];
|
|
2104
|
+
if (subsectionReceived.elements) {
|
|
2105
|
+
try {
|
|
2106
|
+
for (var _b = __values(subsectionReceived.elements), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
2107
|
+
var receivedElement = _c.value;
|
|
2108
|
+
var elementObject = null;
|
|
2109
|
+
var arrayToAdd = null;
|
|
2110
|
+
var type = receivedElement.type, code = receivedElement.code;
|
|
2111
|
+
switch (type) {
|
|
2112
|
+
case elementTypes.field:
|
|
2113
|
+
elementObject = formObject.getFieldObject(code);
|
|
2114
|
+
arrayToAdd = this.subSectionFields;
|
|
2115
|
+
break;
|
|
2116
|
+
case elementTypes.table:
|
|
2117
|
+
elementObject = formObject.getTableObject(code);
|
|
2118
|
+
arrayToAdd = this.subSectionTables;
|
|
2119
|
+
break;
|
|
2120
|
+
case elementTypes.action:
|
|
2121
|
+
elementObject = formObject.getActionObject(code);
|
|
2122
|
+
arrayToAdd = this.subSectionActions;
|
|
2123
|
+
break;
|
|
2124
|
+
}
|
|
2125
|
+
if (elementObject) {
|
|
2126
|
+
elementObject.elementType = type;
|
|
2127
|
+
arrayToAdd.push(elementObject);
|
|
2128
|
+
this.subSectionElements.push(elementObject);
|
|
2129
|
+
this.elementsArray[code] = elementObject;
|
|
2130
|
+
}
|
|
2131
|
+
}
|
|
2132
|
+
}
|
|
2133
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
2134
|
+
finally {
|
|
2135
|
+
try {
|
|
2136
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
2137
|
+
}
|
|
2138
|
+
finally { if (e_1) throw e_1.error; }
|
|
2139
|
+
}
|
|
2140
|
+
}
|
|
2141
|
+
}
|
|
2142
|
+
RecordFormSubSection.prototype.show = function () { this.visible = true; };
|
|
2143
|
+
RecordFormSubSection.prototype.hide = function () { this.visible = false; };
|
|
2144
|
+
Object.defineProperty(RecordFormSubSection.prototype, "customRender", {
|
|
2145
|
+
get: function () { return this._customRender; },
|
|
2146
|
+
set: function (customRenderName) { this._customRender = customRenderName; },
|
|
2147
|
+
enumerable: false,
|
|
2148
|
+
configurable: true
|
|
2149
|
+
});
|
|
2150
|
+
RecordFormSubSection.prototype.getField = function (name) {
|
|
2151
|
+
return this.subSectionFields.find(function (fld) { return fld.name === name; });
|
|
2152
|
+
};
|
|
2153
|
+
RecordFormSubSection.prototype.getFields = function () {
|
|
2154
|
+
return this.subSectionFields;
|
|
2155
|
+
};
|
|
2156
|
+
RecordFormSubSection.prototype.getFieldNames = function () {
|
|
2157
|
+
return this.subSectionFields.map(function (field) { return field.fieldCode; });
|
|
2158
|
+
};
|
|
2159
|
+
RecordFormSubSection.prototype.viewOnState = function (state) {
|
|
2160
|
+
return this.visibleStates.includes(state);
|
|
2161
|
+
};
|
|
2162
|
+
RecordFormSubSection.prototype.supportMode = function (state) { return this.viewOnState(state); };
|
|
2163
|
+
return RecordFormSubSection;
|
|
2164
|
+
}());
|
|
2165
|
+
|
|
2166
|
+
var RecordFormSection = /** @class */ (function () {
|
|
2167
|
+
function RecordFormSection(sectionReceived, formObject) {
|
|
2168
|
+
var e_1, _c;
|
|
2169
|
+
var _this = this;
|
|
2170
|
+
var _a;
|
|
2171
|
+
this._activation = new rxjs.Subject();
|
|
2172
|
+
this._inactivation = new rxjs.Subject();
|
|
2173
|
+
this.active = false;
|
|
2174
|
+
if (!sectionReceived) {
|
|
2175
|
+
return;
|
|
2176
|
+
}
|
|
2177
|
+
this.visible = true;
|
|
2178
|
+
this.sectionId = (sectionReceived.sectionId) ? sectionReceived.sectionId.toString() : '';
|
|
2179
|
+
this.sectionCode = (sectionReceived.sectionCode) ? sectionReceived.sectionCode : '';
|
|
2180
|
+
this.sectionTitle = (sectionReceived.sectionTitle) ? sectionReceived.sectionTitle : '';
|
|
2181
|
+
this.visibleStates = sectionReceived.visibleStates || [];
|
|
2182
|
+
this.subSections = [];
|
|
2183
|
+
this.subSectionsObj = {};
|
|
2184
|
+
if (sectionReceived.subsections) {
|
|
2185
|
+
var subsections = sectionReceived.subsections.map(function (objDef) {
|
|
2186
|
+
var visibleStates = objDef.visibleStates;
|
|
2187
|
+
if (!visibleStates) {
|
|
2188
|
+
visibleStates = (objDef.subsectionModes || '').split(',')
|
|
2189
|
+
.map(function (state) { return state.trim(); })
|
|
2190
|
+
.filter(function (state) { return state.length > 0; });
|
|
2191
|
+
}
|
|
2192
|
+
if (!visibleStates || visibleStates.length === 0) {
|
|
2193
|
+
visibleStates = _this.visibleStates;
|
|
2194
|
+
}
|
|
2195
|
+
if (objDef.elements && Array.isArray(objDef.elements)) {
|
|
2196
|
+
objDef.elements = objDef.elements.map(function (elm) { return ({ code: elm.elementCode, type: elm.elementTypeName }); });
|
|
2197
|
+
}
|
|
2198
|
+
return Object.assign(Object.assign({}, objDef), { visibleStates: visibleStates });
|
|
2199
|
+
});
|
|
2200
|
+
try {
|
|
2201
|
+
for (var subsections_1 = __values(subsections), subsections_1_1 = subsections_1.next(); !subsections_1_1.done; subsections_1_1 = subsections_1.next()) {
|
|
2202
|
+
var subsectionReceived = subsections_1_1.value;
|
|
2203
|
+
var subSectionToAdd = new RecordFormSubSection(subsectionReceived, formObject);
|
|
2204
|
+
var subsectionCode = subSectionToAdd.subsectionCode;
|
|
2205
|
+
if (subsectionCode) {
|
|
2206
|
+
this.subSections.push(subSectionToAdd);
|
|
2207
|
+
this.subSectionsObj[subsectionCode] = subSectionToAdd;
|
|
2208
|
+
}
|
|
2209
|
+
}
|
|
2210
|
+
}
|
|
2211
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
2212
|
+
finally {
|
|
2213
|
+
try {
|
|
2214
|
+
if (subsections_1_1 && !subsections_1_1.done && (_c = subsections_1.return)) _c.call(subsections_1);
|
|
2215
|
+
}
|
|
2216
|
+
finally { if (e_1) throw e_1.error; }
|
|
2217
|
+
}
|
|
2218
|
+
}
|
|
2219
|
+
this.customAttributes = (_a = sectionReceived === null || sectionReceived === void 0 ? void 0 : sectionReceived.customAttributes) !== null && _a !== void 0 ? _a : null;
|
|
2220
|
+
}
|
|
2221
|
+
RecordFormSection.prototype.getCustomAttribute = function (name) { var _a, _b; return (_b = (_a = this.customAttributes) === null || _a === void 0 ? void 0 : _a[name]) !== null && _b !== void 0 ? _b : null; };
|
|
2222
|
+
RecordFormSection.prototype.setCustomAttribute = function (name, value) { return name && (this.customAttributes[name] = value); };
|
|
2223
|
+
RecordFormSection.prototype.matchAttribute = function (name, value) { var _a; return ((_a = this.customAttributes) === null || _a === void 0 ? void 0 : _a[name]) === value; };
|
|
2224
|
+
Object.defineProperty(RecordFormSection.prototype, "code", {
|
|
2225
|
+
get: function () { return this.sectionCode; },
|
|
2226
|
+
enumerable: false,
|
|
2227
|
+
configurable: true
|
|
2228
|
+
});
|
|
2229
|
+
Object.defineProperty(RecordFormSection.prototype, "activation", {
|
|
2230
|
+
get: function () { return this._activation; },
|
|
2231
|
+
enumerable: false,
|
|
2232
|
+
configurable: true
|
|
2233
|
+
});
|
|
2234
|
+
Object.defineProperty(RecordFormSection.prototype, "inactivation", {
|
|
2235
|
+
get: function () { return this._inactivation; },
|
|
2236
|
+
enumerable: false,
|
|
2237
|
+
configurable: true
|
|
2238
|
+
});
|
|
2239
|
+
RecordFormSection.prototype.activate = function () {
|
|
2240
|
+
if (!this.active) {
|
|
2241
|
+
this.active = true;
|
|
2242
|
+
this._activation.next(this.sectionCode);
|
|
2243
|
+
}
|
|
2244
|
+
};
|
|
2245
|
+
RecordFormSection.prototype.inactivate = function () {
|
|
2246
|
+
if (this.active) {
|
|
2247
|
+
this.active = false;
|
|
2248
|
+
this._inactivation.next(this.sectionCode);
|
|
2249
|
+
}
|
|
2250
|
+
};
|
|
2251
|
+
RecordFormSection.prototype.show = function () { this.visible = true; };
|
|
2252
|
+
RecordFormSection.prototype.hide = function () { this.visible = false; };
|
|
2253
|
+
Object.defineProperty(RecordFormSection.prototype, "title", {
|
|
2254
|
+
get: function () { return this.sectionTitle; },
|
|
2255
|
+
set: function (title) { this.sectionTitle = title; },
|
|
2256
|
+
enumerable: false,
|
|
2257
|
+
configurable: true
|
|
2258
|
+
});
|
|
2259
|
+
RecordFormSection.prototype.getVisibleSubsections = function (state) {
|
|
2260
|
+
return this.subSections.filter(function (subSection) {
|
|
2261
|
+
return subSection.visible && subSection.viewOnState(state);
|
|
2262
|
+
});
|
|
2263
|
+
};
|
|
2264
|
+
RecordFormSection.prototype.getSubsection = function (subSectionCode) {
|
|
2265
|
+
return (this.subSectionsObj && this.subSectionsObj[subSectionCode])
|
|
2266
|
+
? this.subSectionsObj[subSectionCode] : null;
|
|
2267
|
+
};
|
|
2268
|
+
RecordFormSection.prototype.getFields = function () {
|
|
2269
|
+
var e_2, _c;
|
|
2270
|
+
var fieldsArray = [];
|
|
2271
|
+
if (this.subSections && this.subSections.length > 0) {
|
|
2272
|
+
try {
|
|
2273
|
+
for (var _d = __values(this.subSections), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
2274
|
+
var subSection = _e.value;
|
|
2275
|
+
fieldsArray = fieldsArray.concat(subSection.getFields());
|
|
2276
|
+
}
|
|
2277
|
+
}
|
|
2278
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
2279
|
+
finally {
|
|
2280
|
+
try {
|
|
2281
|
+
if (_e && !_e.done && (_c = _d.return)) _c.call(_d);
|
|
2282
|
+
}
|
|
2283
|
+
finally { if (e_2) throw e_2.error; }
|
|
2284
|
+
}
|
|
2285
|
+
}
|
|
2286
|
+
return fieldsArray;
|
|
2287
|
+
};
|
|
2288
|
+
RecordFormSection.prototype.getFieldNames = function () {
|
|
2289
|
+
var e_3, _c;
|
|
2290
|
+
var fieldsArray = [];
|
|
2291
|
+
if (this.subSections && this.subSections.length > 0) {
|
|
2292
|
+
try {
|
|
2293
|
+
for (var _d = __values(this.subSections), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
2294
|
+
var subSection = _e.value;
|
|
2295
|
+
fieldsArray = fieldsArray.concat(subSection.getFieldNames());
|
|
2296
|
+
}
|
|
2297
|
+
}
|
|
2298
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
2299
|
+
finally {
|
|
2300
|
+
try {
|
|
2301
|
+
if (_e && !_e.done && (_c = _d.return)) _c.call(_d);
|
|
2302
|
+
}
|
|
2303
|
+
finally { if (e_3) throw e_3.error; }
|
|
2304
|
+
}
|
|
2305
|
+
}
|
|
2306
|
+
return fieldsArray;
|
|
2307
|
+
};
|
|
2308
|
+
RecordFormSection.prototype.getField = function (name) {
|
|
2309
|
+
var e_4, _c;
|
|
2310
|
+
var field = null;
|
|
2311
|
+
if (this.subSections && this.subSections.length > 0) {
|
|
2312
|
+
try {
|
|
2313
|
+
for (var _d = __values(this.subSections), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
2314
|
+
var subSection = _e.value;
|
|
2315
|
+
field = subSection.getField(name);
|
|
2316
|
+
if (field) {
|
|
2317
|
+
return field;
|
|
2318
|
+
}
|
|
2319
|
+
}
|
|
2320
|
+
}
|
|
2321
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
2322
|
+
finally {
|
|
2323
|
+
try {
|
|
2324
|
+
if (_e && !_e.done && (_c = _d.return)) _c.call(_d);
|
|
2325
|
+
}
|
|
2326
|
+
finally { if (e_4) throw e_4.error; }
|
|
2327
|
+
}
|
|
2328
|
+
}
|
|
2329
|
+
return null;
|
|
2330
|
+
};
|
|
2331
|
+
RecordFormSection.prototype.supportState = function (state) { return this.viewOnState(state); };
|
|
2332
|
+
RecordFormSection.prototype.viewOnState = function (state) { return this.visibleStates.includes(state); };
|
|
2333
|
+
RecordFormSection.prototype.supportMode = function (state) { return this.viewOnState(state); };
|
|
2334
|
+
return RecordFormSection;
|
|
2335
|
+
}());
|
|
2336
|
+
|
|
2321
2337
|
var ACTIVE = 'active';
|
|
2322
2338
|
var SHOW = 'show';
|
|
2323
2339
|
var HIDE = 'hide';
|
|
@@ -2326,7 +2342,7 @@
|
|
|
2326
2342
|
var CLEAN = 'clean';
|
|
2327
2343
|
var FormStructureAndData = /** @class */ (function () {
|
|
2328
2344
|
function FormStructureAndData(definitionReceived, formConfig) {
|
|
2329
|
-
var e_1,
|
|
2345
|
+
var e_1, _e, e_2, _f, e_3, _g, e_4, _h;
|
|
2330
2346
|
var _this = this;
|
|
2331
2347
|
this._fields = {};
|
|
2332
2348
|
this._actions = {};
|
|
@@ -2382,7 +2398,7 @@
|
|
|
2382
2398
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
2383
2399
|
finally {
|
|
2384
2400
|
try {
|
|
2385
|
-
if (formActions_1_1 && !formActions_1_1.done && (
|
|
2401
|
+
if (formActions_1_1 && !formActions_1_1.done && (_e = formActions_1.return)) _e.call(formActions_1);
|
|
2386
2402
|
}
|
|
2387
2403
|
finally { if (e_1) throw e_1.error; }
|
|
2388
2404
|
}
|
|
@@ -2413,7 +2429,7 @@
|
|
|
2413
2429
|
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
2414
2430
|
finally {
|
|
2415
2431
|
try {
|
|
2416
|
-
if (formFields_1_1 && !formFields_1_1.done && (
|
|
2432
|
+
if (formFields_1_1 && !formFields_1_1.done && (_f = formFields_1.return)) _f.call(formFields_1);
|
|
2417
2433
|
}
|
|
2418
2434
|
finally { if (e_2) throw e_2.error; }
|
|
2419
2435
|
}
|
|
@@ -2447,7 +2463,7 @@
|
|
|
2447
2463
|
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
2448
2464
|
finally {
|
|
2449
2465
|
try {
|
|
2450
|
-
if (tables_1_1 && !tables_1_1.done && (
|
|
2466
|
+
if (tables_1_1 && !tables_1_1.done && (_g = tables_1.return)) _g.call(tables_1);
|
|
2451
2467
|
}
|
|
2452
2468
|
finally { if (e_3) throw e_3.error; }
|
|
2453
2469
|
}
|
|
@@ -2476,7 +2492,7 @@
|
|
|
2476
2492
|
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
2477
2493
|
finally {
|
|
2478
2494
|
try {
|
|
2479
|
-
if (formSections_1_1 && !formSections_1_1.done && (
|
|
2495
|
+
if (formSections_1_1 && !formSections_1_1.done && (_h = formSections_1.return)) _h.call(formSections_1);
|
|
2480
2496
|
}
|
|
2481
2497
|
finally { if (e_4) throw e_4.error; }
|
|
2482
2498
|
}
|
|
@@ -2551,256 +2567,149 @@
|
|
|
2551
2567
|
enumerable: false,
|
|
2552
2568
|
configurable: true
|
|
2553
2569
|
});
|
|
2554
|
-
// Fields
|
|
2555
|
-
FormStructureAndData.prototype.getFields = function () { return this._fieldArray; };
|
|
2556
|
-
FormStructureAndData.prototype.getFieldNames = function () { return this._fieldArray.map(function (field) { return field.fieldCode; }); };
|
|
2557
|
-
FormStructureAndData.prototype.getField = function (elementId) { var _a; return (elementId && ((_a = this._fields) === null || _a === void 0 ? void 0 : _a[elementId])) ? this._fields[elementId] : null; };
|
|
2558
2570
|
Object.defineProperty(FormStructureAndData.prototype, "fields", {
|
|
2571
|
+
// Fields
|
|
2559
2572
|
get: function () { return this._fields; },
|
|
2560
2573
|
enumerable: false,
|
|
2561
2574
|
configurable: true
|
|
2562
2575
|
});
|
|
2563
|
-
FormStructureAndData.prototype
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
};
|
|
2571
|
-
FormStructureAndData.prototype.
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
};
|
|
2575
|
-
FormStructureAndData.prototype.
|
|
2576
|
-
var _a, _b, _c;
|
|
2577
|
-
if (!fieldCodesArray || !Array.isArray(fieldCodesArray) || fieldCodesArray.length === 0) {
|
|
2578
|
-
return null;
|
|
2579
|
-
}
|
|
2580
|
-
var resultObject = {};
|
|
2581
|
-
for (var index = 0; index < fieldCodesArray.length; index++) {
|
|
2582
|
-
var fieldCode = fieldCodesArray[index];
|
|
2583
|
-
if (fieldCode) {
|
|
2584
|
-
resultObject[fieldCode] = (_c = (_b = (_a = this._fields) === null || _a === void 0 ? void 0 : _a[fieldCode]) === null || _b === void 0 ? void 0 : _b.getValue()) !== null && _c !== void 0 ? _c : null;
|
|
2585
|
-
}
|
|
2586
|
-
}
|
|
2587
|
-
return resultObject;
|
|
2588
|
-
};
|
|
2589
|
-
FormStructureAndData.prototype.getFieldOptions = function (fieldCode) {
|
|
2590
|
-
var fieldObject = this.getField(fieldCode);
|
|
2591
|
-
return (fieldObject) ? fieldObject.getFieldOptions() : null;
|
|
2592
|
-
};
|
|
2593
|
-
FormStructureAndData.prototype.setFieldValue = function (fieldCode, fieldValue) {
|
|
2594
|
-
var fieldObject = this.getField(fieldCode);
|
|
2595
|
-
return (fieldObject) ? fieldObject.setValue(fieldValue) : null;
|
|
2596
|
-
};
|
|
2576
|
+
Object.defineProperty(FormStructureAndData.prototype, "fieldNames", {
|
|
2577
|
+
get: function () { return this.getFieldNames(); },
|
|
2578
|
+
enumerable: false,
|
|
2579
|
+
configurable: true
|
|
2580
|
+
});
|
|
2581
|
+
FormStructureAndData.prototype.getFields = function () { return this._fieldArray; };
|
|
2582
|
+
FormStructureAndData.prototype.getFieldNames = function () { return this._fieldArray.map(function (field) { return field.fieldCode; }); };
|
|
2583
|
+
FormStructureAndData.prototype.getField = function (code) { var _a; return (code && ((_a = this._fields) === null || _a === void 0 ? void 0 : _a[code])) ? this._fields[code] : null; };
|
|
2584
|
+
FormStructureAndData.prototype.enableField = function (code) { var _a; (_a = this.getField(code)) === null || _a === void 0 ? void 0 : _a.enable(); };
|
|
2585
|
+
FormStructureAndData.prototype.disableField = function (code) { var _a; (_a = this.getField(code)) === null || _a === void 0 ? void 0 : _a.disable(); };
|
|
2586
|
+
FormStructureAndData.prototype.getFieldValue = function (code) { var _a; (_a = this.getField(code)) === null || _a === void 0 ? void 0 : _a.getValue(); };
|
|
2587
|
+
FormStructureAndData.prototype.getFieldOptions = function (code) { var _a; (_a = this.getField(code)) === null || _a === void 0 ? void 0 : _a.getFieldOptions(); };
|
|
2588
|
+
FormStructureAndData.prototype.setFieldValue = function (code, value) { var _a; (_a = this.getField(code)) === null || _a === void 0 ? void 0 : _a.setValue(value); };
|
|
2597
2589
|
FormStructureAndData.prototype.setFieldError = function (code, message, type) {
|
|
2598
2590
|
if (type === void 0) { type = 'error'; }
|
|
2599
|
-
var
|
|
2600
|
-
|
|
2601
|
-
};
|
|
2602
|
-
FormStructureAndData.prototype.setFieldIntrinsicErrorMessage = function (code, message) {
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
var fieldObject = this.getField(fieldCode);
|
|
2617
|
-
if (fieldObject && optionsArray && optionsArray.length > 0) {
|
|
2618
|
-
var fieldOptions = [];
|
|
2619
|
-
try {
|
|
2620
|
-
for (var optionsArray_1 = __values(optionsArray), optionsArray_1_1 = optionsArray_1.next(); !optionsArray_1_1.done; optionsArray_1_1 = optionsArray_1.next()) {
|
|
2621
|
-
var optionItem = optionsArray_1_1.value;
|
|
2622
|
-
var fieldOption = {
|
|
2623
|
-
fieldOptionId: optionItem[idAttribute],
|
|
2624
|
-
fieldOptionValue: optionItem[nameAttribute]
|
|
2625
|
-
};
|
|
2626
|
-
fieldOptions.push(fieldOption);
|
|
2627
|
-
}
|
|
2628
|
-
}
|
|
2629
|
-
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
2630
|
-
finally {
|
|
2631
|
-
try {
|
|
2632
|
-
if (optionsArray_1_1 && !optionsArray_1_1.done && (_d = optionsArray_1.return)) _d.call(optionsArray_1);
|
|
2633
|
-
}
|
|
2634
|
-
finally { if (e_5) throw e_5.error; }
|
|
2635
|
-
}
|
|
2636
|
-
fieldObject.setFieldOptions(fieldOptions);
|
|
2637
|
-
}
|
|
2638
|
-
};
|
|
2639
|
-
FormStructureAndData.prototype.getFieldSet = function (filterFunc, fieldArray, sectionCode, subSectionCode) {
|
|
2591
|
+
var _a;
|
|
2592
|
+
(_a = this.getField(code)) === null || _a === void 0 ? void 0 : _a.setError(code, message, type);
|
|
2593
|
+
};
|
|
2594
|
+
FormStructureAndData.prototype.setFieldIntrinsicErrorMessage = function (code, message) { var _a; (_a = this.getField(code)) === null || _a === void 0 ? void 0 : _a.setIntrinsicErrorMessage(message); };
|
|
2595
|
+
FormStructureAndData.prototype.setFieldRequired = function (code, required) { var _a; (_a = this.getField(code)) === null || _a === void 0 ? void 0 : _a.setRequired(required); };
|
|
2596
|
+
FormStructureAndData.prototype.setFieldErrorMessage = function (code, message) { var _a; (_a = this.getField(code)) === null || _a === void 0 ? void 0 : _a.setErrorMessage(message); };
|
|
2597
|
+
FormStructureAndData.prototype.setFieldOptions = function (code, optionsArray, idAttribute, nameAttribute) {
|
|
2598
|
+
var field = this.getField(code);
|
|
2599
|
+
if (field && (optionsArray === null || optionsArray === void 0 ? void 0 : optionsArray.length) > 0) {
|
|
2600
|
+
var fieldOptions = optionsArray.map(function (item) { return ({
|
|
2601
|
+
fieldOptionId: item[idAttribute],
|
|
2602
|
+
fieldOptionValue: item[nameAttribute]
|
|
2603
|
+
}); });
|
|
2604
|
+
field.setFieldOptions(fieldOptions);
|
|
2605
|
+
}
|
|
2606
|
+
};
|
|
2607
|
+
FormStructureAndData.prototype.getFieldSet = function (filter, inputCodes, secCode, subCode) {
|
|
2640
2608
|
var _this = this;
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
if (
|
|
2644
|
-
|
|
2645
|
-
if (fieldArray && Array.isArray(fieldArray) && fieldArray.length > 0) {
|
|
2646
|
-
fieldUniverse = fieldArray;
|
|
2609
|
+
var _a, _b, _c, _d;
|
|
2610
|
+
var codes = null;
|
|
2611
|
+
if (typeof inputCodes === 'string' && inputCodes) {
|
|
2612
|
+
codes = [inputCodes];
|
|
2647
2613
|
}
|
|
2648
|
-
else if (
|
|
2649
|
-
|
|
2650
|
-
fieldUniverse = sectionObject === null || sectionObject === void 0 ? void 0 : sectionObject.getFieldNames();
|
|
2614
|
+
else if (Array.isArray(inputCodes) && inputCodes.length > 0) {
|
|
2615
|
+
codes = inputCodes;
|
|
2651
2616
|
}
|
|
2652
|
-
else if (
|
|
2653
|
-
|
|
2654
|
-
fieldUniverse = subSectionObject === null || subSectionObject === void 0 ? void 0 : subSectionObject.getFieldNames();
|
|
2617
|
+
else if (secCode && !subCode) {
|
|
2618
|
+
codes = (_b = (_a = this.getSection(secCode)) === null || _a === void 0 ? void 0 : _a.getFieldNames()) !== null && _b !== void 0 ? _b : [];
|
|
2655
2619
|
}
|
|
2656
|
-
else {
|
|
2657
|
-
|
|
2620
|
+
else if (secCode && subCode) {
|
|
2621
|
+
codes = (_d = (_c = this.getSubSection(secCode, subCode)) === null || _c === void 0 ? void 0 : _c.getFieldNames()) !== null && _d !== void 0 ? _d : [];
|
|
2658
2622
|
}
|
|
2659
|
-
|
|
2660
|
-
|
|
2623
|
+
else {
|
|
2624
|
+
codes = this.getFieldNames();
|
|
2661
2625
|
}
|
|
2662
|
-
return
|
|
2663
|
-
var fieldObject = _this.getField(fld);
|
|
2664
|
-
return (fieldObject && filterFunc(fieldObject));
|
|
2665
|
-
});
|
|
2626
|
+
return (filter) ? codes.filter(function (fld) { return filter(_this.getField(fld)); }) : codes;
|
|
2666
2627
|
};
|
|
2667
|
-
FormStructureAndData.prototype.
|
|
2668
|
-
var
|
|
2669
|
-
if (
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
var
|
|
2673
|
-
var
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
console.log("Error procesando funcion en campo " + fieldObject + ": " + e);
|
|
2686
|
-
}
|
|
2628
|
+
FormStructureAndData.prototype.applyOnFields = function (processFunc, inputCodes, secCode, subCode) {
|
|
2629
|
+
var e_5, _e;
|
|
2630
|
+
if (!processFunc) {
|
|
2631
|
+
return 0;
|
|
2632
|
+
}
|
|
2633
|
+
var codes = this.getFieldSet(null, inputCodes, secCode, subCode);
|
|
2634
|
+
var processedFields = 0;
|
|
2635
|
+
try {
|
|
2636
|
+
for (var codes_1 = __values(codes), codes_1_1 = codes_1.next(); !codes_1_1.done; codes_1_1 = codes_1.next()) {
|
|
2637
|
+
var code = codes_1_1.value;
|
|
2638
|
+
var field = this.getField(code);
|
|
2639
|
+
if (field) {
|
|
2640
|
+
try {
|
|
2641
|
+
processFunc(field);
|
|
2642
|
+
processedFields += 1;
|
|
2643
|
+
}
|
|
2644
|
+
catch (e) {
|
|
2645
|
+
console.log("Error procesando funcion en campo " + field + ": " + e);
|
|
2687
2646
|
}
|
|
2688
2647
|
}
|
|
2689
2648
|
}
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
finally { if (e_6) throw e_6.error; }
|
|
2649
|
+
}
|
|
2650
|
+
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
2651
|
+
finally {
|
|
2652
|
+
try {
|
|
2653
|
+
if (codes_1_1 && !codes_1_1.done && (_e = codes_1.return)) _e.call(codes_1);
|
|
2696
2654
|
}
|
|
2655
|
+
finally { if (e_5) throw e_5.error; }
|
|
2697
2656
|
}
|
|
2698
|
-
return
|
|
2699
|
-
};
|
|
2700
|
-
FormStructureAndData.prototype.
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
return this.
|
|
2705
|
-
};
|
|
2706
|
-
FormStructureAndData.prototype.hideFields = function (
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
return this.
|
|
2711
|
-
};
|
|
2712
|
-
FormStructureAndData.prototype.
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
return this.
|
|
2717
|
-
};
|
|
2718
|
-
FormStructureAndData.prototype.
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
return this.
|
|
2723
|
-
};
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
if (
|
|
2729
|
-
return this.
|
|
2730
|
-
};
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
if (sectionCode === void 0) { sectionCode = null; }
|
|
2753
|
-
if (subSectionCode === void 0) { subSectionCode = null; }
|
|
2754
|
-
return this.applyProcessToFieldSet(function (fieldObject) {
|
|
2755
|
-
fieldObject.clean('');
|
|
2756
|
-
fieldObject.setErrorMessage('');
|
|
2757
|
-
}, fieldArray, sectionCode, subSectionCode);
|
|
2758
|
-
};
|
|
2759
|
-
FormStructureAndData.prototype.getRequiredFields = function (fieldArray, sectionCode, subSectionCode) {
|
|
2760
|
-
if (sectionCode === void 0) { sectionCode = null; }
|
|
2761
|
-
if (subSectionCode === void 0) { subSectionCode = null; }
|
|
2762
|
-
return this.getFieldSet(function (fld) { return fld.fieldRequired; }, fieldArray, sectionCode, subSectionCode);
|
|
2763
|
-
};
|
|
2764
|
-
FormStructureAndData.prototype.getRequiredEmptyFields = function (fieldArray, sectionCode, subSectionCode) {
|
|
2765
|
-
if (fieldArray === void 0) { fieldArray = null; }
|
|
2766
|
-
if (sectionCode === void 0) { sectionCode = null; }
|
|
2767
|
-
if (subSectionCode === void 0) { subSectionCode = null; }
|
|
2768
|
-
return this.getFieldSet(function (fld) { return fld.fieldRequired && fld.isEmpty(); }, fieldArray, sectionCode, subSectionCode);
|
|
2769
|
-
};
|
|
2770
|
-
FormStructureAndData.prototype.getChangedFields = function (fieldArray, sectionCode, subSectionCode) {
|
|
2771
|
-
if (sectionCode === void 0) { sectionCode = null; }
|
|
2772
|
-
if (subSectionCode === void 0) { subSectionCode = null; }
|
|
2773
|
-
return this.getFieldSet(function (fld) { return !fld.outputOnly && fld.hasChanged(); }, fieldArray, sectionCode, subSectionCode);
|
|
2774
|
-
};
|
|
2775
|
-
FormStructureAndData.prototype.getFieldsWithValidationIssues = function (fieldArray, sectionCode, subSectionCode) {
|
|
2776
|
-
if (sectionCode === void 0) { sectionCode = null; }
|
|
2777
|
-
if (subSectionCode === void 0) { subSectionCode = null; }
|
|
2778
|
-
return this.getFieldSet(function (fld) { return fld.errorCode !== NO_ERROR; }, fieldArray, sectionCode, subSectionCode);
|
|
2779
|
-
};
|
|
2780
|
-
FormStructureAndData.prototype.tagFieldsWithError = function (errorMessage, fieldArray, sectionCode, subSectionCode) {
|
|
2781
|
-
if (fieldArray === void 0) { fieldArray = null; }
|
|
2782
|
-
if (sectionCode === void 0) { sectionCode = null; }
|
|
2783
|
-
if (subSectionCode === void 0) { subSectionCode = null; }
|
|
2784
|
-
return this.applyProcessToFieldSet(function (fieldObject) {
|
|
2785
|
-
fieldObject.setErrorMessage(errorMessage);
|
|
2786
|
-
}, fieldArray, sectionCode, subSectionCode);
|
|
2787
|
-
};
|
|
2788
|
-
FormStructureAndData.prototype.cleanErrorFields = function (fieldArray, sectionCode, subSectionCode) {
|
|
2789
|
-
if (fieldArray === void 0) { fieldArray = null; }
|
|
2790
|
-
if (sectionCode === void 0) { sectionCode = null; }
|
|
2791
|
-
if (subSectionCode === void 0) { subSectionCode = null; }
|
|
2792
|
-
this.tagFieldsWithError('', fieldArray, sectionCode, subSectionCode);
|
|
2793
|
-
};
|
|
2794
|
-
FormStructureAndData.prototype.tagEmptyRequiredFields = function (errorMessage, fieldArray, sectionCode, subSectionCode) {
|
|
2795
|
-
if (fieldArray === void 0) { fieldArray = null; }
|
|
2796
|
-
if (sectionCode === void 0) { sectionCode = null; }
|
|
2797
|
-
if (subSectionCode === void 0) { subSectionCode = null; }
|
|
2798
|
-
var pendingFields = this.getRequiredEmptyFields(fieldArray, sectionCode, subSectionCode);
|
|
2799
|
-
if (pendingFields && pendingFields.length > 0) {
|
|
2800
|
-
this.tagFieldsWithError(errorMessage, pendingFields);
|
|
2801
|
-
return true;
|
|
2657
|
+
return processedFields;
|
|
2658
|
+
};
|
|
2659
|
+
FormStructureAndData.prototype.enableFields = function (codes, secCode, subCode) {
|
|
2660
|
+
return this.applyOnFields(function (fld) { return fld.enable(); }, codes, secCode, subCode);
|
|
2661
|
+
};
|
|
2662
|
+
FormStructureAndData.prototype.showFields = function (codes, secCode, subCode) {
|
|
2663
|
+
return this.applyOnFields(function (fld) { return fld.show(); }, codes, secCode, subCode);
|
|
2664
|
+
};
|
|
2665
|
+
FormStructureAndData.prototype.hideFields = function (codes, secCode, subCode) {
|
|
2666
|
+
return this.applyOnFields(function (fld) { return fld.hide(); }, codes, secCode, subCode);
|
|
2667
|
+
};
|
|
2668
|
+
FormStructureAndData.prototype.showLabelFields = function (codes, secCode, subCode) {
|
|
2669
|
+
return this.applyOnFields(function (fld) { return fld.showLablel(); }, codes, secCode, subCode);
|
|
2670
|
+
};
|
|
2671
|
+
FormStructureAndData.prototype.hideLabelFields = function (codes, secCode, subCode) {
|
|
2672
|
+
return this.applyOnFields(function (fld) { return fld.hideLabel(); }, codes, secCode, subCode);
|
|
2673
|
+
};
|
|
2674
|
+
FormStructureAndData.prototype.disableFields = function (codes, secCode, subCode) {
|
|
2675
|
+
return this.applyOnFields(function (fld) { return fld.disable(); }, codes, secCode, subCode);
|
|
2676
|
+
};
|
|
2677
|
+
FormStructureAndData.prototype.cleanFields = function (codes, secCode, subCode) {
|
|
2678
|
+
return this.applyOnFields(function (fld) { return fld.clean(); }, codes, secCode, subCode);
|
|
2679
|
+
};
|
|
2680
|
+
FormStructureAndData.prototype.tagFieldsWithError = function (message, codes, secCode, subCode) {
|
|
2681
|
+
return this.applyOnFields(function (fld) { return fld.setErrorMessage(message); }, codes, secCode, subCode);
|
|
2682
|
+
};
|
|
2683
|
+
FormStructureAndData.prototype.cleanErrorFields = function (codes, secCode, subCode) {
|
|
2684
|
+
this.tagFieldsWithError('', codes, secCode, subCode);
|
|
2685
|
+
};
|
|
2686
|
+
FormStructureAndData.prototype.tagEmptyRequiredFields = function (message, codes, secCode, subCode) {
|
|
2687
|
+
if (codes === void 0) { codes = null; }
|
|
2688
|
+
return this.tagFieldsWithError(message, this.getRequiredEmptyFields(codes, secCode, subCode)) > 0;
|
|
2689
|
+
};
|
|
2690
|
+
FormStructureAndData.prototype.getRequiredFields = function (codes, secCode, subCode) {
|
|
2691
|
+
return this.getFieldSet(function (fld) { return fld.required; }, codes, secCode, subCode);
|
|
2692
|
+
};
|
|
2693
|
+
FormStructureAndData.prototype.getRequiredEmptyFields = function (codes, secCode, subCode) {
|
|
2694
|
+
return this.getFieldSet(function (fld) { return fld.required && fld.empty; }, codes, secCode, subCode);
|
|
2695
|
+
};
|
|
2696
|
+
FormStructureAndData.prototype.getChangedFields = function (codes, secCode, subCode) {
|
|
2697
|
+
return this.getFieldSet(function (fld) { return !fld.outputOnly && fld.hasChanged(); }, codes, secCode, subCode);
|
|
2698
|
+
};
|
|
2699
|
+
FormStructureAndData.prototype.getFieldsWithValidationIssues = function (codes, secCode, subCode) {
|
|
2700
|
+
return this.getFieldSet(function (fld) { return fld.errorCode !== NO_ERROR; }, codes, secCode, subCode);
|
|
2701
|
+
};
|
|
2702
|
+
FormStructureAndData.prototype.getFieldsValues = function (inputCodes, secCode, subCode) {
|
|
2703
|
+
var _a, _b, _c;
|
|
2704
|
+
var codes = this.getFieldSet(null, inputCodes, secCode, subCode);
|
|
2705
|
+
var resultObject = {};
|
|
2706
|
+
for (var index = 0; index < codes.length; index++) {
|
|
2707
|
+
var code = codes[index];
|
|
2708
|
+
if (code) {
|
|
2709
|
+
resultObject[code] = (_c = (_b = (_a = this._fields) === null || _a === void 0 ? void 0 : _a[code]) === null || _b === void 0 ? void 0 : _b.getValue()) !== null && _c !== void 0 ? _c : null;
|
|
2710
|
+
}
|
|
2802
2711
|
}
|
|
2803
|
-
return
|
|
2712
|
+
return resultObject;
|
|
2804
2713
|
};
|
|
2805
2714
|
Object.defineProperty(FormStructureAndData.prototype, "actions", {
|
|
2806
2715
|
// Acciones
|
|
@@ -2827,10 +2736,15 @@
|
|
|
2827
2736
|
(_a = action === null || action === void 0 ? void 0 : action[functionName]) === null || _a === void 0 ? void 0 : _a.call(action);
|
|
2828
2737
|
});
|
|
2829
2738
|
};
|
|
2830
|
-
|
|
2831
|
-
|
|
2739
|
+
Object.defineProperty(FormStructureAndData.prototype, "tables", {
|
|
2740
|
+
// Tablas
|
|
2741
|
+
get: function () { return this.tables; },
|
|
2742
|
+
enumerable: false,
|
|
2743
|
+
configurable: true
|
|
2744
|
+
});
|
|
2832
2745
|
FormStructureAndData.prototype.getTables = function () { return this._tableArray; };
|
|
2833
2746
|
FormStructureAndData.prototype.getTable = function (code) { var _a; return (code && ((_a = this._tables) === null || _a === void 0 ? void 0 : _a[code])) ? this._tables[code] : null; };
|
|
2747
|
+
FormStructureAndData.prototype.getTableRecord = function (code, id) { var _a; return (_a = this.getTable(code)) === null || _a === void 0 ? void 0 : _a.getTableRecord(id); };
|
|
2834
2748
|
FormStructureAndData.prototype.enableTables = function (codes) { return this.execOnTables(codes, ENABLE); };
|
|
2835
2749
|
FormStructureAndData.prototype.disableTables = function (codes) { return this.execOnTables(codes, DISABLE); };
|
|
2836
2750
|
FormStructureAndData.prototype.showTables = function (codes) { return this.execOnTables(codes, SHOW); };
|
|
@@ -2848,16 +2762,13 @@
|
|
|
2848
2762
|
(_a = table === null || table === void 0 ? void 0 : table[functionName]) === null || _a === void 0 ? void 0 : _a.call(table);
|
|
2849
2763
|
});
|
|
2850
2764
|
};
|
|
2851
|
-
FormStructureAndData.prototype.getTableRecord = function (tableCode, recordId) {
|
|
2852
|
-
var tableObject = this.getTable(tableCode);
|
|
2853
|
-
return (tableObject) ? tableObject.getTableRecord(recordId) : null;
|
|
2854
|
-
};
|
|
2855
2765
|
Object.defineProperty(FormStructureAndData.prototype, "sections", {
|
|
2856
2766
|
// Secciones
|
|
2857
2767
|
get: function () { return this._sectionArray; },
|
|
2858
2768
|
enumerable: false,
|
|
2859
2769
|
configurable: true
|
|
2860
2770
|
});
|
|
2771
|
+
FormStructureAndData.prototype.getSections = function () { return this.sections; };
|
|
2861
2772
|
FormStructureAndData.prototype.getSectionsByAttribute = function (name, value) { return this._sectionArray.filter(function (item) { return item.matchAttribute(name, value); }); };
|
|
2862
2773
|
Object.defineProperty(FormStructureAndData.prototype, "sectionTitles", {
|
|
2863
2774
|
get: function () { return this._sectionArray.map(function (formSection) { return formSection.sectionTitle; }); },
|
|
@@ -2870,8 +2781,8 @@
|
|
|
2870
2781
|
configurable: true
|
|
2871
2782
|
});
|
|
2872
2783
|
FormStructureAndData.prototype.getSection = function (code) { var _a; return (code && ((_a = this._sections) === null || _a === void 0 ? void 0 : _a[code])) ? this._sections[code] : null; };
|
|
2873
|
-
FormStructureAndData.prototype.showSections = function (
|
|
2874
|
-
FormStructureAndData.prototype.hideSections = function (
|
|
2784
|
+
FormStructureAndData.prototype.showSections = function (codes) { this.execOnSections(codes, SHOW); };
|
|
2785
|
+
FormStructureAndData.prototype.hideSections = function (codes) { this.execOnSections(codes, HIDE); };
|
|
2875
2786
|
FormStructureAndData.prototype.activeSection = function () { return this._exclusiveSectionsByAttr[ACTIVE]; };
|
|
2876
2787
|
FormStructureAndData.prototype.getSubSection = function (code, subCode) { var _a, _b; return (_b = (_a = this.getSection(code)) === null || _a === void 0 ? void 0 : _a.getSubsection(subCode)) !== null && _b !== void 0 ? _b : null; };
|
|
2877
2788
|
FormStructureAndData.prototype.showSubSections = function (code, subCodes) { return this.execOnSubSections(code, subCodes, SHOW); };
|
|
@@ -2898,7 +2809,7 @@
|
|
|
2898
2809
|
});
|
|
2899
2810
|
};
|
|
2900
2811
|
FormStructureAndData.prototype.execOnSubSections = function (code, subNames, functionName) {
|
|
2901
|
-
var
|
|
2812
|
+
var e_6, _e;
|
|
2902
2813
|
var _a;
|
|
2903
2814
|
var subCodes = (Array.isArray(subNames)) ? subNames : (subNames ? [subNames] : []);
|
|
2904
2815
|
var section = this.getSection(code);
|
|
@@ -2912,109 +2823,76 @@
|
|
|
2912
2823
|
(_a = subSection === null || subSection === void 0 ? void 0 : subSection[functionName]) === null || _a === void 0 ? void 0 : _a.call(subSection);
|
|
2913
2824
|
}
|
|
2914
2825
|
}
|
|
2915
|
-
catch (
|
|
2826
|
+
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
2916
2827
|
finally {
|
|
2917
2828
|
try {
|
|
2918
|
-
if (subCodes_1_1 && !subCodes_1_1.done && (
|
|
2829
|
+
if (subCodes_1_1 && !subCodes_1_1.done && (_e = subCodes_1.return)) _e.call(subCodes_1);
|
|
2919
2830
|
}
|
|
2920
|
-
finally { if (
|
|
2831
|
+
finally { if (e_6) throw e_6.error; }
|
|
2921
2832
|
}
|
|
2922
2833
|
};
|
|
2923
2834
|
/**
|
|
2924
2835
|
* Métodos propios de gestión del formulario
|
|
2925
2836
|
*/
|
|
2926
2837
|
FormStructureAndData.prototype.cleanData = function () {
|
|
2927
|
-
var
|
|
2928
|
-
|
|
2838
|
+
var e_7, _e, e_8, _f;
|
|
2839
|
+
try {
|
|
2840
|
+
for (var _g = __values(this._fieldArray), _h = _g.next(); !_h.done; _h = _g.next()) {
|
|
2841
|
+
var field = _h.value;
|
|
2842
|
+
field.setValue(field.defaultValue);
|
|
2843
|
+
}
|
|
2844
|
+
}
|
|
2845
|
+
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
2846
|
+
finally {
|
|
2929
2847
|
try {
|
|
2930
|
-
|
|
2931
|
-
var recordField = _g.value;
|
|
2932
|
-
recordField.setValue(recordField.defaultValue);
|
|
2933
|
-
}
|
|
2848
|
+
if (_h && !_h.done && (_e = _g.return)) _e.call(_g);
|
|
2934
2849
|
}
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2850
|
+
finally { if (e_7) throw e_7.error; }
|
|
2851
|
+
}
|
|
2852
|
+
try {
|
|
2853
|
+
for (var _j = __values(this._tableArray), _k = _j.next(); !_k.done; _k = _j.next()) {
|
|
2854
|
+
var table = _k.value;
|
|
2855
|
+
table.clean();
|
|
2941
2856
|
}
|
|
2942
2857
|
}
|
|
2943
|
-
|
|
2858
|
+
catch (e_8_1) { e_8 = { error: e_8_1 }; }
|
|
2859
|
+
finally {
|
|
2944
2860
|
try {
|
|
2945
|
-
|
|
2946
|
-
var formTable = _j.value;
|
|
2947
|
-
formTable.clean();
|
|
2948
|
-
}
|
|
2949
|
-
}
|
|
2950
|
-
catch (e_9_1) { e_9 = { error: e_9_1 }; }
|
|
2951
|
-
finally {
|
|
2952
|
-
try {
|
|
2953
|
-
if (_j && !_j.done && (_e = _h.return)) _e.call(_h);
|
|
2954
|
-
}
|
|
2955
|
-
finally { if (e_9) throw e_9.error; }
|
|
2861
|
+
if (_k && !_k.done && (_f = _j.return)) _f.call(_j);
|
|
2956
2862
|
}
|
|
2863
|
+
finally { if (e_8) throw e_8.error; }
|
|
2957
2864
|
}
|
|
2958
2865
|
};
|
|
2959
|
-
/** payload para servicios Tuain */
|
|
2960
2866
|
FormStructureAndData.prototype.getPayload = function () {
|
|
2961
|
-
var e_10, _d, e_11, _e;
|
|
2962
2867
|
var formData = {
|
|
2963
2868
|
fields: [],
|
|
2964
2869
|
tables: [],
|
|
2965
2870
|
};
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
}
|
|
2992
|
-
var tables = this.getTables();
|
|
2993
|
-
if (tables && tables.length > 0) {
|
|
2994
|
-
try {
|
|
2995
|
-
for (var tables_2 = __values(tables), tables_2_1 = tables_2.next(); !tables_2_1.done; tables_2_1 = tables_2.next()) {
|
|
2996
|
-
var tableDescriptor = tables_2_1.value;
|
|
2997
|
-
var formTable = {
|
|
2998
|
-
tableCode: tableDescriptor.tableCode,
|
|
2999
|
-
visible: tableDescriptor.visible,
|
|
3000
|
-
currentPage: tableDescriptor.currentPage,
|
|
3001
|
-
requestedPage: tableDescriptor.requestedPage,
|
|
3002
|
-
recordsPerPage: tableDescriptor.recordsPerPage,
|
|
3003
|
-
currentFilter: tableDescriptor.currentFilter,
|
|
3004
|
-
sortingColumn: tableDescriptor.sorting.columnName,
|
|
3005
|
-
sortingDirection: tableDescriptor.sorting.direction,
|
|
3006
|
-
};
|
|
3007
|
-
formData.tables.push(formTable);
|
|
3008
|
-
}
|
|
3009
|
-
}
|
|
3010
|
-
catch (e_11_1) { e_11 = { error: e_11_1 }; }
|
|
3011
|
-
finally {
|
|
3012
|
-
try {
|
|
3013
|
-
if (tables_2_1 && !tables_2_1.done && (_e = tables_2.return)) _e.call(tables_2);
|
|
3014
|
-
}
|
|
3015
|
-
finally { if (e_11) throw e_11.error; }
|
|
3016
|
-
}
|
|
3017
|
-
}
|
|
2871
|
+
formData.fields = this.getFields().filter(function (fld) { return !fld.outputOnly; })
|
|
2872
|
+
.map(function (fld) {
|
|
2873
|
+
var fieldPayload = {
|
|
2874
|
+
fieldCode: fld.fieldCode,
|
|
2875
|
+
fieldValue: fld.getValue(),
|
|
2876
|
+
editable: !fld.disabled,
|
|
2877
|
+
visible: fld.visible,
|
|
2878
|
+
required: fld.required,
|
|
2879
|
+
fieldOptions: '',
|
|
2880
|
+
};
|
|
2881
|
+
return fieldPayload;
|
|
2882
|
+
});
|
|
2883
|
+
formData.tables = this.getTables().map(function (tbl) {
|
|
2884
|
+
var tablePayload = {
|
|
2885
|
+
tableCode: tbl.tableCode,
|
|
2886
|
+
visible: tbl.visible,
|
|
2887
|
+
currentPage: tbl.currentPage,
|
|
2888
|
+
requestedPage: tbl.requestedPage,
|
|
2889
|
+
recordsPerPage: tbl.recordsPerPage,
|
|
2890
|
+
currentFilter: tbl.currentFilter,
|
|
2891
|
+
sortingColumn: tbl.sorting.columnName,
|
|
2892
|
+
sortingDirection: tbl.sorting.direction,
|
|
2893
|
+
};
|
|
2894
|
+
return tablePayload;
|
|
2895
|
+
});
|
|
3018
2896
|
return formData;
|
|
3019
2897
|
};
|
|
3020
2898
|
return FormStructureAndData;
|
|
@@ -3140,114 +3018,335 @@
|
|
|
3140
3018
|
this.formManagerService = formManagerService;
|
|
3141
3019
|
this._eventManager = _eventManager;
|
|
3142
3020
|
this.fileMgmtServices = fileMgmtServices;
|
|
3021
|
+
this._formStructure = null;
|
|
3022
|
+
this._controlToken = null;
|
|
3023
|
+
this._definitionObtained = false;
|
|
3024
|
+
// Eventos de acciones y campos
|
|
3025
|
+
this._formSectionsActivate = {};
|
|
3026
|
+
this._formSectionsInactivate = {};
|
|
3027
|
+
this._formActionsStart = {};
|
|
3028
|
+
this._formActionsFinish = {};
|
|
3029
|
+
this._fieldInputValidation = {};
|
|
3030
|
+
this._fieldValidationsStart = {};
|
|
3031
|
+
this._fieldValidationsFinish = {};
|
|
3032
|
+
// Callback de acciones de tablas
|
|
3033
|
+
this._tableSelectionsStart = {};
|
|
3034
|
+
this._tableSelectionsFinish = {};
|
|
3035
|
+
this._tableActionsStart = {};
|
|
3036
|
+
this._tableActionsFinish = {};
|
|
3037
|
+
this._tableGetDataStart = {};
|
|
3038
|
+
this._tableGetDataFinish = {};
|
|
3039
|
+
this.inputDataFields = {};
|
|
3040
|
+
this.extraData = {};
|
|
3041
|
+
this._errorType = '';
|
|
3143
3042
|
this.errorCode = '';
|
|
3144
3043
|
this.errorMessage = '';
|
|
3145
3044
|
this.errorDetail = '';
|
|
3146
|
-
this.
|
|
3147
|
-
this.controlToken = null;
|
|
3148
|
-
this.inputDataFields = {};
|
|
3149
|
-
this.extraData = {};
|
|
3150
|
-
this.definitionObtained = false;
|
|
3151
|
-
this.formVisible = false;
|
|
3045
|
+
this.visible = false;
|
|
3152
3046
|
this.busy = false;
|
|
3153
|
-
this.formSectionsActivate = {};
|
|
3154
|
-
this.formSectionsInactivate = {};
|
|
3155
|
-
this.formActionsStart = {};
|
|
3156
|
-
this.formActionsFinish = {};
|
|
3157
|
-
this.fieldInputValidation = {};
|
|
3158
|
-
this.fieldValidationsStart = {};
|
|
3159
|
-
this.fieldValidationsFinish = {};
|
|
3160
|
-
// Callback de acciones de tablas
|
|
3161
|
-
this.tableSelectionsStart = {};
|
|
3162
|
-
this.tableSelectionsFinish = {};
|
|
3163
|
-
this.tableActionsStart = {};
|
|
3164
|
-
this.tableActionsFinish = {};
|
|
3165
|
-
this.tableGetDataStart = {};
|
|
3166
|
-
this.tableGetDataFinish = {};
|
|
3167
3047
|
this._eventEmiter = this._eventManager;
|
|
3168
3048
|
this.cleanStart();
|
|
3169
3049
|
this.customPreProcessing();
|
|
3170
3050
|
}
|
|
3171
|
-
BasicFormComponent.prototype.
|
|
3051
|
+
BasicFormComponent.prototype.getTitle = function () {
|
|
3172
3052
|
var _a;
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3053
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getTitle();
|
|
3054
|
+
};
|
|
3055
|
+
BasicFormComponent.prototype.setTitle = function (title) {
|
|
3056
|
+
var _a;
|
|
3057
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.setTitle(title);
|
|
3058
|
+
};
|
|
3059
|
+
BasicFormComponent.prototype.cleanData = function () {
|
|
3060
|
+
var _a;
|
|
3061
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.cleanData();
|
|
3062
|
+
};
|
|
3063
|
+
BasicFormComponent.prototype.getCurrentState = function () {
|
|
3064
|
+
var _a;
|
|
3065
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getCurrentState();
|
|
3066
|
+
};
|
|
3067
|
+
BasicFormComponent.prototype.supportState = function (state) {
|
|
3068
|
+
var _a;
|
|
3069
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.supportState(state);
|
|
3070
|
+
};
|
|
3071
|
+
BasicFormComponent.prototype.changeState = function (state) {
|
|
3072
|
+
var _a;
|
|
3073
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.changeState(state);
|
|
3074
|
+
};
|
|
3075
|
+
BasicFormComponent.prototype.getStates = function () {
|
|
3076
|
+
var _a;
|
|
3077
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.states;
|
|
3078
|
+
};
|
|
3079
|
+
BasicFormComponent.prototype.getImmutableElement = function (name) {
|
|
3080
|
+
var _a;
|
|
3081
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getImmutableElement(name);
|
|
3082
|
+
};
|
|
3083
|
+
BasicFormComponent.prototype.getExtraInfo = function (name) {
|
|
3084
|
+
var _a;
|
|
3085
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getExtraInfo(name);
|
|
3086
|
+
};
|
|
3087
|
+
BasicFormComponent.prototype.getFields = function () {
|
|
3088
|
+
var _a;
|
|
3089
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getFields();
|
|
3090
|
+
};
|
|
3091
|
+
BasicFormComponent.prototype.getFieldNames = function () {
|
|
3092
|
+
var _a;
|
|
3093
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getFieldNames();
|
|
3094
|
+
};
|
|
3095
|
+
BasicFormComponent.prototype.getField = function (code) {
|
|
3096
|
+
var _a;
|
|
3097
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getField(code);
|
|
3098
|
+
};
|
|
3099
|
+
BasicFormComponent.prototype.enableField = function (code) {
|
|
3100
|
+
var _a;
|
|
3101
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.enableField(code);
|
|
3102
|
+
};
|
|
3103
|
+
BasicFormComponent.prototype.disableField = function (code) {
|
|
3104
|
+
var _a;
|
|
3105
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.disableField(code);
|
|
3106
|
+
};
|
|
3107
|
+
BasicFormComponent.prototype.getFieldValue = function (code) {
|
|
3108
|
+
var _a;
|
|
3109
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getFieldValue(code);
|
|
3110
|
+
};
|
|
3111
|
+
BasicFormComponent.prototype.getFieldsValues = function (codes) {
|
|
3112
|
+
var _a;
|
|
3113
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getFieldsValues(codes);
|
|
3114
|
+
};
|
|
3115
|
+
BasicFormComponent.prototype.getFieldOptions = function (code) {
|
|
3116
|
+
var _a;
|
|
3117
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getFieldOptions(code);
|
|
3118
|
+
};
|
|
3119
|
+
BasicFormComponent.prototype.setFieldValue = function (code, value) {
|
|
3120
|
+
var _a;
|
|
3121
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.setFieldValue(code, value);
|
|
3122
|
+
};
|
|
3123
|
+
BasicFormComponent.prototype.setFieldRequired = function (code, required) {
|
|
3124
|
+
var _a;
|
|
3125
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.setFieldRequired(code, required);
|
|
3126
|
+
};
|
|
3127
|
+
BasicFormComponent.prototype.setFieldErrorMessage = function (code, errorMessage) {
|
|
3128
|
+
var _a;
|
|
3129
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.setFieldErrorMessage(code, errorMessage);
|
|
3130
|
+
};
|
|
3131
|
+
BasicFormComponent.prototype.setFieldError = function (code, message, type) {
|
|
3132
|
+
var _a;
|
|
3133
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.setFieldError(code, message, type);
|
|
3134
|
+
};
|
|
3135
|
+
BasicFormComponent.prototype.setFieldIntrinsicErrorMessage = function (code, message) {
|
|
3136
|
+
var _a;
|
|
3137
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.setFieldIntrinsicErrorMessage(code, message);
|
|
3138
|
+
};
|
|
3139
|
+
BasicFormComponent.prototype.setFieldOptions = function (code, optionsArray, idAttribute, nameAttribute) {
|
|
3140
|
+
var _a;
|
|
3141
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.setFieldOptions(code, optionsArray, idAttribute, nameAttribute);
|
|
3142
|
+
};
|
|
3143
|
+
BasicFormComponent.prototype.getFieldSet = function (filterFunc, codes, secCode, subCode) {
|
|
3144
|
+
var _a;
|
|
3145
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getFieldSet(filterFunc, codes, secCode, subCode);
|
|
3146
|
+
};
|
|
3147
|
+
BasicFormComponent.prototype.applyOnFields = function (processFunc, codes, secCode, subCode) {
|
|
3148
|
+
var _a;
|
|
3149
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.applyOnFields(processFunc, codes, secCode, subCode);
|
|
3150
|
+
};
|
|
3151
|
+
BasicFormComponent.prototype.applyProcessToAllFields = function (processFunc) {
|
|
3152
|
+
var _a;
|
|
3153
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.applyOnFields(processFunc);
|
|
3154
|
+
};
|
|
3155
|
+
BasicFormComponent.prototype.cleanFields = function (codes, secCode, subCode) {
|
|
3156
|
+
var _a;
|
|
3157
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.cleanFields(codes, secCode, subCode);
|
|
3158
|
+
};
|
|
3159
|
+
BasicFormComponent.prototype.getRequiredFields = function (codes, secCode, subCode) {
|
|
3160
|
+
var _a;
|
|
3161
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getRequiredFields(codes, secCode, subCode);
|
|
3162
|
+
};
|
|
3163
|
+
BasicFormComponent.prototype.getRequiredEmptyFields = function (codes, secCode, subCode) {
|
|
3164
|
+
var _a;
|
|
3165
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getRequiredEmptyFields(codes, secCode, subCode);
|
|
3166
|
+
};
|
|
3167
|
+
BasicFormComponent.prototype.getChangedFields = function (codes, secCode, subCode) {
|
|
3168
|
+
var _a;
|
|
3169
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getChangedFields(codes, secCode, subCode);
|
|
3170
|
+
};
|
|
3171
|
+
BasicFormComponent.prototype.getFieldsWithValidationIssues = function (codes, secCode, subCode) {
|
|
3172
|
+
var _a;
|
|
3173
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getFieldsWithValidationIssues(codes, secCode, subCode);
|
|
3174
|
+
};
|
|
3175
|
+
BasicFormComponent.prototype.tagFieldsWithError = function (errorMessage, codes, secCode, subCode) {
|
|
3176
|
+
var _a;
|
|
3177
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.tagFieldsWithError(errorMessage, codes, secCode, subCode);
|
|
3178
|
+
};
|
|
3179
|
+
BasicFormComponent.prototype.cleanErrorFields = function (codes, secCode, subCode) {
|
|
3180
|
+
var _a;
|
|
3181
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.cleanErrorFields(codes, secCode, subCode);
|
|
3182
|
+
};
|
|
3183
|
+
BasicFormComponent.prototype.showLabelFields = function (codes, secCode, subCode) {
|
|
3184
|
+
var _a;
|
|
3185
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.showLabelFields(codes, secCode, subCode);
|
|
3186
|
+
};
|
|
3187
|
+
BasicFormComponent.prototype.hideLabelFields = function (codes, secCode, subCode) {
|
|
3188
|
+
var _a;
|
|
3189
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.hideLabelFields(codes, secCode, subCode);
|
|
3190
|
+
};
|
|
3191
|
+
BasicFormComponent.prototype.enableFields = function (codes, secCode, subCode) {
|
|
3192
|
+
var _a;
|
|
3193
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.enableFields(codes, secCode, subCode);
|
|
3194
|
+
};
|
|
3195
|
+
BasicFormComponent.prototype.disableFields = function (codes, secCode, subCode) {
|
|
3196
|
+
var _a;
|
|
3197
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.disableFields(codes, secCode, subCode);
|
|
3198
|
+
};
|
|
3199
|
+
/**
|
|
3200
|
+
* @deprecated Use enableFields
|
|
3201
|
+
*/
|
|
3202
|
+
BasicFormComponent.prototype.enableEditFields = function (codes, secCode, subCode) {
|
|
3203
|
+
return this.enableFields(codes, secCode, subCode);
|
|
3204
|
+
};
|
|
3205
|
+
/**
|
|
3206
|
+
* @deprecated Use disableFields
|
|
3207
|
+
*/
|
|
3208
|
+
BasicFormComponent.prototype.disableEditFields = function (codes, secCode, subCode) {
|
|
3209
|
+
return this.disableFields(codes, secCode, subCode);
|
|
3210
|
+
};
|
|
3211
|
+
BasicFormComponent.prototype.showFields = function (codes, secCode, subCode) {
|
|
3212
|
+
var _a;
|
|
3213
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.showFields(codes, secCode, subCode);
|
|
3214
|
+
};
|
|
3215
|
+
BasicFormComponent.prototype.hideFields = function (codes, secCode, subCode) {
|
|
3216
|
+
var _a;
|
|
3217
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.hideFields(codes, secCode, subCode);
|
|
3218
|
+
};
|
|
3219
|
+
BasicFormComponent.prototype.getActionsByAttribute = function (name, value) {
|
|
3220
|
+
var _a;
|
|
3221
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getActionsByAttribute(name, value);
|
|
3222
|
+
};
|
|
3223
|
+
BasicFormComponent.prototype.getHeaderActions = function () {
|
|
3224
|
+
var _a;
|
|
3225
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getActionsByAttribute('location', HEADER$1);
|
|
3226
|
+
};
|
|
3227
|
+
BasicFormComponent.prototype.getAction = function (actionCode) {
|
|
3228
|
+
var _a;
|
|
3229
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getAction(actionCode);
|
|
3230
|
+
};
|
|
3231
|
+
BasicFormComponent.prototype.showActions = function (actionArray) {
|
|
3232
|
+
var _a;
|
|
3233
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.showActions(actionArray);
|
|
3234
|
+
};
|
|
3235
|
+
BasicFormComponent.prototype.hideActions = function (actionArray) {
|
|
3236
|
+
var _a;
|
|
3237
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.hideActions(actionArray);
|
|
3238
|
+
};
|
|
3239
|
+
BasicFormComponent.prototype.enableActions = function (actionArray) {
|
|
3240
|
+
var _a;
|
|
3241
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.enableActions(actionArray);
|
|
3242
|
+
};
|
|
3243
|
+
BasicFormComponent.prototype.disableActions = function (actionArray) {
|
|
3244
|
+
var _a;
|
|
3245
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.disableActions(actionArray);
|
|
3246
|
+
};
|
|
3247
|
+
BasicFormComponent.prototype.showAction = function (code) {
|
|
3248
|
+
var _a;
|
|
3249
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.showActions(code);
|
|
3250
|
+
};
|
|
3251
|
+
BasicFormComponent.prototype.hideAction = function (code) {
|
|
3252
|
+
var _a;
|
|
3253
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.hideActions(code);
|
|
3254
|
+
};
|
|
3255
|
+
BasicFormComponent.prototype.enableAction = function (code) {
|
|
3256
|
+
var _a;
|
|
3257
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.enableActions(code);
|
|
3258
|
+
};
|
|
3259
|
+
BasicFormComponent.prototype.disableAction = function (code) {
|
|
3260
|
+
var _a;
|
|
3261
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.disableActions(code);
|
|
3262
|
+
};
|
|
3263
|
+
BasicFormComponent.prototype.getSections = function () {
|
|
3264
|
+
var _a;
|
|
3265
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getSections();
|
|
3266
|
+
};
|
|
3267
|
+
BasicFormComponent.prototype.activateSection = function (code) {
|
|
3268
|
+
var _a;
|
|
3269
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.activateSection(code);
|
|
3270
|
+
};
|
|
3271
|
+
BasicFormComponent.prototype.getSectionsTitles = function () {
|
|
3272
|
+
var _a;
|
|
3273
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getSections().map(function (sec) { return sec.title; });
|
|
3274
|
+
};
|
|
3275
|
+
BasicFormComponent.prototype.getSection = function (code) {
|
|
3276
|
+
var _a;
|
|
3277
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getSection(code);
|
|
3278
|
+
};
|
|
3279
|
+
BasicFormComponent.prototype.showSection = function (code) {
|
|
3280
|
+
var _a;
|
|
3281
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.showSections(code);
|
|
3282
|
+
};
|
|
3283
|
+
BasicFormComponent.prototype.hideSection = function (code) {
|
|
3284
|
+
var _a;
|
|
3285
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.hideSections(code);
|
|
3286
|
+
};
|
|
3287
|
+
BasicFormComponent.prototype.showSections = function (codes) {
|
|
3288
|
+
var _a;
|
|
3289
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.showSections(codes);
|
|
3290
|
+
};
|
|
3291
|
+
BasicFormComponent.prototype.hideSections = function (codes) {
|
|
3292
|
+
var _a;
|
|
3293
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.hideSections(codes);
|
|
3294
|
+
};
|
|
3295
|
+
BasicFormComponent.prototype.getSubSection = function (code, subCode) {
|
|
3296
|
+
var _a;
|
|
3297
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getSubSection(code, subCode);
|
|
3298
|
+
};
|
|
3299
|
+
BasicFormComponent.prototype.showSubSection = function (code, subCode) {
|
|
3300
|
+
var _a;
|
|
3301
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.showSubSections(code, subCode);
|
|
3302
|
+
};
|
|
3303
|
+
BasicFormComponent.prototype.hideSubSection = function (code, subCode) {
|
|
3304
|
+
var _a;
|
|
3305
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.hideSubSections(code, subCode);
|
|
3306
|
+
};
|
|
3307
|
+
BasicFormComponent.prototype.showSubSections = function (code, subCodes) {
|
|
3308
|
+
var _a;
|
|
3309
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.showSubSections(code, subCodes);
|
|
3310
|
+
};
|
|
3311
|
+
BasicFormComponent.prototype.hideSubSections = function (code, subCodes) {
|
|
3312
|
+
var _a;
|
|
3313
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.hideSubSections(code, subCodes);
|
|
3314
|
+
};
|
|
3315
|
+
BasicFormComponent.prototype.getTables = function () {
|
|
3316
|
+
var _a;
|
|
3317
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getTables();
|
|
3318
|
+
};
|
|
3319
|
+
BasicFormComponent.prototype.showTables = function (codes) {
|
|
3320
|
+
var _a;
|
|
3321
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.showTables(codes);
|
|
3322
|
+
};
|
|
3323
|
+
BasicFormComponent.prototype.hideTables = function (codes) {
|
|
3324
|
+
var _a;
|
|
3325
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.hideTables(codes);
|
|
3326
|
+
};
|
|
3327
|
+
BasicFormComponent.prototype.cleanTables = function (codes) {
|
|
3328
|
+
var _a;
|
|
3329
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.cleanTables(codes);
|
|
3330
|
+
};
|
|
3331
|
+
BasicFormComponent.prototype.getTable = function (code) {
|
|
3332
|
+
var _a;
|
|
3333
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getTable(code);
|
|
3334
|
+
};
|
|
3335
|
+
BasicFormComponent.prototype.showTable = function (code) {
|
|
3336
|
+
var _a;
|
|
3337
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.showTables(code);
|
|
3338
|
+
};
|
|
3339
|
+
BasicFormComponent.prototype.hideTable = function (code) {
|
|
3340
|
+
var _a;
|
|
3341
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.hideTables(code);
|
|
3342
|
+
};
|
|
3343
|
+
BasicFormComponent.prototype.cleanTable = function (code) {
|
|
3344
|
+
var _a, _b;
|
|
3345
|
+
return (_b = (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getTable(code)) === null || _b === void 0 ? void 0 : _b.clean();
|
|
3346
|
+
};
|
|
3347
|
+
BasicFormComponent.prototype.getTableRecord = function (code, recordId) {
|
|
3348
|
+
var _a;
|
|
3349
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getTableRecord(code, recordId);
|
|
3251
3350
|
};
|
|
3252
3351
|
BasicFormComponent.prototype.setConfig = function (formConfig) {
|
|
3253
3352
|
this.formConfig = formConfig;
|
|
@@ -3257,29 +3356,34 @@
|
|
|
3257
3356
|
this.errorCode = '';
|
|
3258
3357
|
this.errorMessage = '';
|
|
3259
3358
|
this.errorDetail = '';
|
|
3260
|
-
this.
|
|
3359
|
+
this._formStructure = null;
|
|
3261
3360
|
this.fields = null;
|
|
3262
3361
|
this.actions = null;
|
|
3263
|
-
this.
|
|
3362
|
+
this._controlToken = null;
|
|
3264
3363
|
this.inputDataFields = {};
|
|
3265
|
-
this.
|
|
3364
|
+
this._definitionObtained = false;
|
|
3266
3365
|
// Se limpian los manejadores de eventos
|
|
3267
|
-
this.
|
|
3366
|
+
this.visible = false;
|
|
3268
3367
|
this.busy = false;
|
|
3269
|
-
this.
|
|
3270
|
-
this.
|
|
3271
|
-
this.
|
|
3272
|
-
this.
|
|
3273
|
-
this.
|
|
3274
|
-
this.
|
|
3275
|
-
this.
|
|
3276
|
-
this.
|
|
3277
|
-
this.
|
|
3278
|
-
this.
|
|
3279
|
-
this.
|
|
3280
|
-
this.
|
|
3281
|
-
this.
|
|
3282
|
-
};
|
|
3368
|
+
this._formSectionsActivate = {};
|
|
3369
|
+
this._formSectionsInactivate = {};
|
|
3370
|
+
this._formActionsStart = {};
|
|
3371
|
+
this._formActionsFinish = {};
|
|
3372
|
+
this._fieldInputValidation = {};
|
|
3373
|
+
this._fieldValidationsStart = {};
|
|
3374
|
+
this._fieldValidationsFinish = {};
|
|
3375
|
+
this._tableSelectionsStart = {};
|
|
3376
|
+
this._tableSelectionsFinish = {};
|
|
3377
|
+
this._tableActionsStart = {};
|
|
3378
|
+
this._tableActionsFinish = {};
|
|
3379
|
+
this._tableGetDataStart = {};
|
|
3380
|
+
this._tableGetDataFinish = {};
|
|
3381
|
+
};
|
|
3382
|
+
Object.defineProperty(BasicFormComponent.prototype, "formVisible", {
|
|
3383
|
+
get: function () { return this.visible; },
|
|
3384
|
+
enumerable: false,
|
|
3385
|
+
configurable: true
|
|
3386
|
+
});
|
|
3283
3387
|
Object.defineProperty(BasicFormComponent.prototype, "formManager", {
|
|
3284
3388
|
get: function () { return this; },
|
|
3285
3389
|
enumerable: false,
|
|
@@ -3297,18 +3401,18 @@
|
|
|
3297
3401
|
configurable: true
|
|
3298
3402
|
});
|
|
3299
3403
|
Object.defineProperty(BasicFormComponent.prototype, "form", {
|
|
3300
|
-
get: function () { return this.
|
|
3404
|
+
get: function () { return this._formStructure; },
|
|
3301
3405
|
enumerable: false,
|
|
3302
3406
|
configurable: true
|
|
3303
3407
|
});
|
|
3304
|
-
Object.defineProperty(BasicFormComponent.prototype, "
|
|
3305
|
-
get: function () { return this.
|
|
3408
|
+
Object.defineProperty(BasicFormComponent.prototype, "state", {
|
|
3409
|
+
get: function () { return this.getCurrentState(); },
|
|
3306
3410
|
enumerable: false,
|
|
3307
3411
|
configurable: true
|
|
3308
3412
|
});
|
|
3309
3413
|
Object.defineProperty(BasicFormComponent.prototype, "currentState", {
|
|
3310
|
-
get: function () { return this.
|
|
3311
|
-
set: function (state) { this.
|
|
3414
|
+
get: function () { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.state; },
|
|
3415
|
+
set: function (state) { this._formStructure.changeState(state); },
|
|
3312
3416
|
enumerable: false,
|
|
3313
3417
|
configurable: true
|
|
3314
3418
|
});
|
|
@@ -3318,17 +3422,17 @@
|
|
|
3318
3422
|
configurable: true
|
|
3319
3423
|
});
|
|
3320
3424
|
Object.defineProperty(BasicFormComponent.prototype, "immutableData", {
|
|
3321
|
-
get: function () { return this.
|
|
3425
|
+
get: function () { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.immutableData; },
|
|
3322
3426
|
enumerable: false,
|
|
3323
3427
|
configurable: true
|
|
3324
3428
|
});
|
|
3325
3429
|
Object.defineProperty(BasicFormComponent.prototype, "extraInfo", {
|
|
3326
|
-
get: function () { return this.
|
|
3430
|
+
get: function () { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.extraInfo; },
|
|
3327
3431
|
enumerable: false,
|
|
3328
3432
|
configurable: true
|
|
3329
3433
|
});
|
|
3330
|
-
Object.defineProperty(BasicFormComponent.prototype, "
|
|
3331
|
-
get: function () { return this.
|
|
3434
|
+
Object.defineProperty(BasicFormComponent.prototype, "visibleSections", {
|
|
3435
|
+
get: function () { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.visibleSections; },
|
|
3332
3436
|
enumerable: false,
|
|
3333
3437
|
configurable: true
|
|
3334
3438
|
});
|
|
@@ -3388,7 +3492,7 @@
|
|
|
3388
3492
|
* @deprecated Use subject
|
|
3389
3493
|
*/
|
|
3390
3494
|
BasicFormComponent.prototype.getformSubject = function () { return this.getSubject(); };
|
|
3391
|
-
BasicFormComponent.prototype.numSections = function () { return this.
|
|
3495
|
+
BasicFormComponent.prototype.numSections = function () { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.sections.length; };
|
|
3392
3496
|
BasicFormComponent.prototype.subscribeAppEvent = function (eventName, callback) {
|
|
3393
3497
|
this._eventEmiter.subscribe(eventName, callback);
|
|
3394
3498
|
};
|
|
@@ -3399,7 +3503,7 @@
|
|
|
3399
3503
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
3400
3504
|
var origin = null;
|
|
3401
3505
|
if (!cleanStack) {
|
|
3402
|
-
origin = Object.assign(Object.assign({}, backData), { name: this.name, url: this._formRoute, token: this.
|
|
3506
|
+
origin = Object.assign(Object.assign({}, backData), { name: this.name, url: this._formRoute, token: this._controlToken });
|
|
3403
3507
|
origin.subject = (_a = origin === null || origin === void 0 ? void 0 : origin.subject) !== null && _a !== void 0 ? _a : this.formSubject;
|
|
3404
3508
|
origin.state = (_b = origin === null || origin === void 0 ? void 0 : origin.state) !== null && _b !== void 0 ? _b : this.currentState;
|
|
3405
3509
|
origin.fields = (_c = origin === null || origin === void 0 ? void 0 : origin.fields) !== null && _c !== void 0 ? _c : {};
|
|
@@ -3412,10 +3516,10 @@
|
|
|
3412
3516
|
target.extra = (_h = target === null || target === void 0 ? void 0 : target.extra) !== null && _h !== void 0 ? _h : {};
|
|
3413
3517
|
this.formManagerService.openForm(origin, target);
|
|
3414
3518
|
};
|
|
3415
|
-
BasicFormComponent.prototype.canGoBack = function () { return this.
|
|
3519
|
+
BasicFormComponent.prototype.canGoBack = function () { return this._originToken !== null; };
|
|
3416
3520
|
BasicFormComponent.prototype.goBack = function () { return this.formManagerService.backTo(); };
|
|
3417
3521
|
BasicFormComponent.prototype.goBackForm = function () { return this.goBack(); };
|
|
3418
|
-
BasicFormComponent.prototype.getOriginDetail = function () { return this.formManagerService.getFormInfo(this.
|
|
3522
|
+
BasicFormComponent.prototype.getOriginDetail = function () { return this.formManagerService.getFormInfo(this._originToken); };
|
|
3419
3523
|
BasicFormComponent.prototype.setError = function (errorType, errorMessage, errorDetail) {
|
|
3420
3524
|
this._errorType = errorType || '';
|
|
3421
3525
|
this.errorMessage = errorMessage || '';
|
|
@@ -3432,20 +3536,20 @@
|
|
|
3432
3536
|
};
|
|
3433
3537
|
BasicFormComponent.prototype.preocessInputParams = function (params) {
|
|
3434
3538
|
var _a, _b, _c;
|
|
3435
|
-
this.
|
|
3436
|
-
var _j = this.formManagerService.getFormInfo(this.
|
|
3437
|
-
if (!this.
|
|
3438
|
-
return;
|
|
3539
|
+
this._controlToken = (_a = params === null || params === void 0 ? void 0 : params[TOKEN]) !== null && _a !== void 0 ? _a : null;
|
|
3540
|
+
var _j = this.formManagerService.getFormInfo(this._controlToken), token = _j.token, subject = _j.subject, state = _j.state, fields = _j.fields, extra = _j.extra, originToken = _j.originToken;
|
|
3541
|
+
if (!this._controlToken || this._controlToken !== token) {
|
|
3542
|
+
return null;
|
|
3439
3543
|
}
|
|
3440
3544
|
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;
|
|
3441
3545
|
this.inputDataFields = fields;
|
|
3442
3546
|
this.extraData = extra;
|
|
3443
|
-
this.
|
|
3547
|
+
this._originToken = originToken;
|
|
3444
3548
|
return state;
|
|
3445
3549
|
};
|
|
3446
3550
|
BasicFormComponent.prototype.subscribeSectionActivation = function () {
|
|
3447
3551
|
var _this = this;
|
|
3448
|
-
var formSections = this.
|
|
3552
|
+
var formSections = this._formStructure.sections;
|
|
3449
3553
|
if (Array.isArray(formSections)) {
|
|
3450
3554
|
formSections.forEach(function (section) {
|
|
3451
3555
|
section.activation.subscribe(function (code) { return _this.launchSectionActivation(code); });
|
|
@@ -3455,7 +3559,7 @@
|
|
|
3455
3559
|
};
|
|
3456
3560
|
BasicFormComponent.prototype.subscribeFieldsSubjects = function () {
|
|
3457
3561
|
var _this = this;
|
|
3458
|
-
var formFields = this.
|
|
3562
|
+
var formFields = this._formStructure.getFields();
|
|
3459
3563
|
if (Array.isArray(formFields)) {
|
|
3460
3564
|
formFields.forEach(function (field) {
|
|
3461
3565
|
field.editionFinish.subscribe(function (event) {
|
|
@@ -3472,7 +3576,7 @@
|
|
|
3472
3576
|
};
|
|
3473
3577
|
BasicFormComponent.prototype.subscribeActionSubjects = function () {
|
|
3474
3578
|
var _this = this;
|
|
3475
|
-
var formActions = this.
|
|
3579
|
+
var formActions = this._formStructure.getActions();
|
|
3476
3580
|
if (Array.isArray(formActions)) {
|
|
3477
3581
|
formActions.forEach(function (action) {
|
|
3478
3582
|
action.actionActivated.subscribe(function (code) { return _this.startAction(code); });
|
|
@@ -3481,7 +3585,7 @@
|
|
|
3481
3585
|
};
|
|
3482
3586
|
BasicFormComponent.prototype.subscribeTableSubjects = function () {
|
|
3483
3587
|
var _this = this;
|
|
3484
|
-
var formTables = this.
|
|
3588
|
+
var formTables = this._formStructure.getTables();
|
|
3485
3589
|
if (Array.isArray(formTables)) {
|
|
3486
3590
|
formTables.forEach(function (table) {
|
|
3487
3591
|
table.inlineActionTrigger.subscribe(function (event) { return _this.startTableAction(event); });
|
|
@@ -3502,25 +3606,25 @@
|
|
|
3502
3606
|
if (!this.name) {
|
|
3503
3607
|
return [2 /*return*/];
|
|
3504
3608
|
}
|
|
3505
|
-
if (!!this.
|
|
3609
|
+
if (!!this._definitionObtained) return [3 /*break*/, 2];
|
|
3506
3610
|
this.busy = true;
|
|
3507
3611
|
return [4 /*yield*/, this.formManagerService.getFormDefinition(this.name)];
|
|
3508
3612
|
case 1:
|
|
3509
3613
|
formDefinition = _j.sent();
|
|
3510
3614
|
this.busy = false;
|
|
3511
|
-
this.
|
|
3512
|
-
this.fields = this.
|
|
3513
|
-
this.actions = this.
|
|
3514
|
-
this.
|
|
3615
|
+
this._formStructure = new FormStructureAndData(formDefinition, this.formConfig);
|
|
3616
|
+
this.fields = this._formStructure.fields;
|
|
3617
|
+
this.actions = this._formStructure.actions;
|
|
3618
|
+
this._definitionObtained = true;
|
|
3515
3619
|
return [3 /*break*/, 3];
|
|
3516
3620
|
case 2:
|
|
3517
3621
|
this.cleanData();
|
|
3518
3622
|
_j.label = 3;
|
|
3519
3623
|
case 3:
|
|
3520
3624
|
if (!this.supportState(initialState)) {
|
|
3521
|
-
initialState = this.
|
|
3625
|
+
initialState = this._formStructure.defaultState;
|
|
3522
3626
|
}
|
|
3523
|
-
this.
|
|
3627
|
+
this._formStructure.changeState(initialState || this._formStructure.defaultState);
|
|
3524
3628
|
inputFieldNames = Object.keys(this.inputDataFields);
|
|
3525
3629
|
for (index = 0; index < inputFieldNames.length; index++) {
|
|
3526
3630
|
fieldCode = inputFieldNames[index];
|
|
@@ -3531,7 +3635,7 @@
|
|
|
3531
3635
|
case 4:
|
|
3532
3636
|
recordResponse = _j.sent();
|
|
3533
3637
|
this.checkErrorRecordReceived(recordResponse);
|
|
3534
|
-
this.
|
|
3638
|
+
this.visible = true;
|
|
3535
3639
|
this.subscribeSectionActivation();
|
|
3536
3640
|
this.subscribeFieldsSubjects();
|
|
3537
3641
|
this.subscribeActionSubjects();
|
|
@@ -3550,6 +3654,7 @@
|
|
|
3550
3654
|
this.errorCode = recordResponse.errorCode;
|
|
3551
3655
|
this.errorMessage = recordResponse.errorMessage;
|
|
3552
3656
|
this.errorDetail = recordResponse.errorDetail;
|
|
3657
|
+
return true;
|
|
3553
3658
|
};
|
|
3554
3659
|
BasicFormComponent.prototype.errorOccured = function () {
|
|
3555
3660
|
return (this.errorCode !== NO_ERROR);
|
|
@@ -3567,12 +3672,12 @@
|
|
|
3567
3672
|
actionDetail = {
|
|
3568
3673
|
formCode: this.name,
|
|
3569
3674
|
formSubject: this.formSubject,
|
|
3570
|
-
currentMode: this.
|
|
3675
|
+
currentMode: this._formStructure.state,
|
|
3571
3676
|
actionCode: actionCode,
|
|
3572
3677
|
actionSubject: actionSubject,
|
|
3573
3678
|
version: PAYLOAD_VERSION,
|
|
3574
|
-
formData: this.
|
|
3575
|
-
immutableData: this.
|
|
3679
|
+
formData: this._formStructure.getPayload(),
|
|
3680
|
+
immutableData: this._formStructure.immutableData,
|
|
3576
3681
|
};
|
|
3577
3682
|
this.errorCode = NO_ERROR;
|
|
3578
3683
|
this.errorMessage = '';
|
|
@@ -3662,62 +3767,62 @@
|
|
|
3662
3767
|
if (returnedFile && returnedFile.file) {
|
|
3663
3768
|
this.fileMgmtServices.saveFile(returnedFile.file, returnedFile.name, returnedFile.type);
|
|
3664
3769
|
}
|
|
3665
|
-
this.
|
|
3666
|
-
this.
|
|
3770
|
+
this._formStructure.immutableData = immutableData;
|
|
3771
|
+
this._formStructure.extraInfo = extraInfo;
|
|
3667
3772
|
};
|
|
3668
3773
|
/**
|
|
3669
3774
|
* Manejo de event handlers para acciones sobre el formulario
|
|
3670
3775
|
*/
|
|
3671
|
-
BasicFormComponent.prototype.addSectionActivation = function (
|
|
3776
|
+
BasicFormComponent.prototype.addSectionActivation = function (codes, callbackMethod) {
|
|
3672
3777
|
var _this = this;
|
|
3673
|
-
var sectionSet = (Array.isArray(
|
|
3778
|
+
var sectionSet = (Array.isArray(codes)) ? codes : (codes ? [codes] : []);
|
|
3674
3779
|
sectionSet.forEach(function (sectionName) {
|
|
3675
|
-
if (!_this.
|
|
3676
|
-
_this.
|
|
3780
|
+
if (!_this._formSectionsActivate[sectionName]) {
|
|
3781
|
+
_this._formSectionsActivate[sectionName] = [];
|
|
3677
3782
|
}
|
|
3678
|
-
_this.
|
|
3783
|
+
_this._formSectionsActivate[sectionName].push(callbackMethod);
|
|
3679
3784
|
});
|
|
3680
3785
|
};
|
|
3681
|
-
BasicFormComponent.prototype.addSectionInactivation = function (
|
|
3786
|
+
BasicFormComponent.prototype.addSectionInactivation = function (codes, callbackMethod) {
|
|
3682
3787
|
var _this = this;
|
|
3683
|
-
var sectionSet = (Array.isArray(
|
|
3788
|
+
var sectionSet = (Array.isArray(codes)) ? codes : (codes ? [codes] : []);
|
|
3684
3789
|
sectionSet.forEach(function (sectionName) {
|
|
3685
|
-
if (!_this.
|
|
3686
|
-
_this.
|
|
3790
|
+
if (!_this._formSectionsInactivate[sectionName]) {
|
|
3791
|
+
_this._formSectionsInactivate[sectionName] = [];
|
|
3687
3792
|
}
|
|
3688
|
-
_this.
|
|
3793
|
+
_this._formSectionsInactivate[sectionName].push(callbackMethod);
|
|
3689
3794
|
});
|
|
3690
3795
|
};
|
|
3691
|
-
BasicFormComponent.prototype.addActionMethodStart = function (
|
|
3796
|
+
BasicFormComponent.prototype.addActionMethodStart = function (codes, callbackMethod) {
|
|
3692
3797
|
var _this = this;
|
|
3693
|
-
var actionSet = (Array.isArray(
|
|
3798
|
+
var actionSet = (Array.isArray(codes)) ? codes : (codes ? [codes] : []);
|
|
3694
3799
|
actionSet.forEach(function (actionName) {
|
|
3695
|
-
if (!_this.
|
|
3696
|
-
_this.
|
|
3800
|
+
if (!_this._formActionsStart[actionName]) {
|
|
3801
|
+
_this._formActionsStart[actionName] = [];
|
|
3697
3802
|
}
|
|
3698
|
-
_this.
|
|
3803
|
+
_this._formActionsStart[actionName].push(callbackMethod);
|
|
3699
3804
|
});
|
|
3700
3805
|
};
|
|
3701
|
-
BasicFormComponent.prototype.addActionMethodFinish = function (
|
|
3806
|
+
BasicFormComponent.prototype.addActionMethodFinish = function (codes, callbackMethod) {
|
|
3702
3807
|
var _this = this;
|
|
3703
|
-
var actionSet = (Array.isArray(
|
|
3808
|
+
var actionSet = (Array.isArray(codes)) ? codes : (codes ? [codes] : []);
|
|
3704
3809
|
actionSet.forEach(function (actionName) {
|
|
3705
|
-
if (!_this.
|
|
3706
|
-
_this.
|
|
3810
|
+
if (!_this._formActionsFinish[actionName]) {
|
|
3811
|
+
_this._formActionsFinish[actionName] = [];
|
|
3707
3812
|
}
|
|
3708
|
-
_this.
|
|
3813
|
+
_this._formActionsFinish[actionName].push(callbackMethod);
|
|
3709
3814
|
});
|
|
3710
3815
|
};
|
|
3711
|
-
BasicFormComponent.prototype.launchSectionActivation = function (
|
|
3816
|
+
BasicFormComponent.prototype.launchSectionActivation = function (code) {
|
|
3712
3817
|
return __awaiter(this, void 0, void 0, function () {
|
|
3713
3818
|
var sectionObject, clientSectionMethods, clientSectionMethods_1, clientSectionMethods_1_1, clientSectionMethod;
|
|
3714
3819
|
var e_4, _j;
|
|
3715
3820
|
return __generator(this, function (_k) {
|
|
3716
|
-
sectionObject = this.
|
|
3821
|
+
sectionObject = this._formStructure.getSection(code);
|
|
3717
3822
|
if (!sectionObject) {
|
|
3718
3823
|
return [2 /*return*/];
|
|
3719
3824
|
}
|
|
3720
|
-
clientSectionMethods = this.
|
|
3825
|
+
clientSectionMethods = this._formSectionsActivate[code];
|
|
3721
3826
|
if (clientSectionMethods) {
|
|
3722
3827
|
try {
|
|
3723
3828
|
for (clientSectionMethods_1 = __values(clientSectionMethods), clientSectionMethods_1_1 = clientSectionMethods_1.next(); !clientSectionMethods_1_1.done; clientSectionMethods_1_1 = clientSectionMethods_1.next()) {
|
|
@@ -3737,16 +3842,16 @@
|
|
|
3737
3842
|
});
|
|
3738
3843
|
});
|
|
3739
3844
|
};
|
|
3740
|
-
BasicFormComponent.prototype.launchSectionInactivation = function (
|
|
3845
|
+
BasicFormComponent.prototype.launchSectionInactivation = function (code) {
|
|
3741
3846
|
return __awaiter(this, void 0, void 0, function () {
|
|
3742
3847
|
var sectionObject, clientSectionMethods, clientSectionMethods_2, clientSectionMethods_2_1, clientSectionMethod;
|
|
3743
3848
|
var e_5, _j;
|
|
3744
3849
|
return __generator(this, function (_k) {
|
|
3745
|
-
sectionObject = this.
|
|
3850
|
+
sectionObject = this._formStructure.getSection(code);
|
|
3746
3851
|
if (!sectionObject) {
|
|
3747
3852
|
return [2 /*return*/];
|
|
3748
3853
|
}
|
|
3749
|
-
clientSectionMethods = this.
|
|
3854
|
+
clientSectionMethods = this._formSectionsInactivate[code];
|
|
3750
3855
|
if (clientSectionMethods) {
|
|
3751
3856
|
try {
|
|
3752
3857
|
for (clientSectionMethods_2 = __values(clientSectionMethods), clientSectionMethods_2_1 = clientSectionMethods_2.next(); !clientSectionMethods_2_1.done; clientSectionMethods_2_1 = clientSectionMethods_2.next()) {
|
|
@@ -3766,20 +3871,20 @@
|
|
|
3766
3871
|
});
|
|
3767
3872
|
});
|
|
3768
3873
|
};
|
|
3769
|
-
BasicFormComponent.prototype.startAction = function (
|
|
3874
|
+
BasicFormComponent.prototype.startAction = function (code) {
|
|
3770
3875
|
return __awaiter(this, void 0, void 0, function () {
|
|
3771
3876
|
var actionObject, clientActionMethods, clientActionPromises, clientActionMethods_1, clientActionMethods_1_1, clientActionMethod, continueActionPromise, clientActionResults, continueAction;
|
|
3772
3877
|
var e_6, _j;
|
|
3773
3878
|
return __generator(this, function (_k) {
|
|
3774
3879
|
switch (_k.label) {
|
|
3775
3880
|
case 0:
|
|
3776
|
-
actionObject = this.getAction(
|
|
3881
|
+
actionObject = this.getAction(code);
|
|
3777
3882
|
if (!actionObject) {
|
|
3778
3883
|
return [2 /*return*/];
|
|
3779
3884
|
}
|
|
3780
3885
|
this.resetError();
|
|
3781
3886
|
actionObject.start();
|
|
3782
|
-
clientActionMethods = this.
|
|
3887
|
+
clientActionMethods = this._formActionsStart[code];
|
|
3783
3888
|
if (!clientActionMethods) return [3 /*break*/, 2];
|
|
3784
3889
|
clientActionPromises = [];
|
|
3785
3890
|
try {
|
|
@@ -3845,20 +3950,20 @@
|
|
|
3845
3950
|
});
|
|
3846
3951
|
});
|
|
3847
3952
|
};
|
|
3848
|
-
BasicFormComponent.prototype.finishAction = function (
|
|
3953
|
+
BasicFormComponent.prototype.finishAction = function (action, actionResult) {
|
|
3849
3954
|
return __awaiter(this, void 0, void 0, function () {
|
|
3850
3955
|
var finishActionMethods, clientActionPromises, finishActionMethods_1, finishActionMethods_1_1, clientActionMethod;
|
|
3851
3956
|
var e_7, _j;
|
|
3852
3957
|
return __generator(this, function (_k) {
|
|
3853
3958
|
switch (_k.label) {
|
|
3854
3959
|
case 0:
|
|
3855
|
-
finishActionMethods = this.
|
|
3960
|
+
finishActionMethods = this._formActionsFinish[action.actionCode];
|
|
3856
3961
|
if (!finishActionMethods) return [3 /*break*/, 2];
|
|
3857
3962
|
clientActionPromises = [];
|
|
3858
3963
|
try {
|
|
3859
3964
|
for (finishActionMethods_1 = __values(finishActionMethods), finishActionMethods_1_1 = finishActionMethods_1.next(); !finishActionMethods_1_1.done; finishActionMethods_1_1 = finishActionMethods_1.next()) {
|
|
3860
3965
|
clientActionMethod = finishActionMethods_1_1.value;
|
|
3861
|
-
clientActionPromises.push(clientActionMethod(
|
|
3966
|
+
clientActionPromises.push(clientActionMethod(action, actionResult));
|
|
3862
3967
|
}
|
|
3863
3968
|
}
|
|
3864
3969
|
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
@@ -3877,40 +3982,40 @@
|
|
|
3877
3982
|
});
|
|
3878
3983
|
});
|
|
3879
3984
|
};
|
|
3880
|
-
BasicFormComponent.prototype.completeGlobalAction = function (
|
|
3881
|
-
return this.startServerAction(
|
|
3985
|
+
BasicFormComponent.prototype.completeGlobalAction = function (action) {
|
|
3986
|
+
return this.startServerAction(action);
|
|
3882
3987
|
};
|
|
3883
3988
|
/**
|
|
3884
3989
|
* Manejadores de eventos para validaciones sobre campos
|
|
3885
3990
|
*/
|
|
3886
|
-
BasicFormComponent.prototype.addFieldInputValidation = function (
|
|
3991
|
+
BasicFormComponent.prototype.addFieldInputValidation = function (codes, callbackMethod) {
|
|
3887
3992
|
var _this = this;
|
|
3888
|
-
var fieldSet = (Array.isArray(
|
|
3993
|
+
var fieldSet = (Array.isArray(codes)) ? codes : (codes ? [codes] : []);
|
|
3889
3994
|
fieldSet.forEach(function (fieldCode) {
|
|
3890
|
-
if (!_this.
|
|
3891
|
-
_this.
|
|
3995
|
+
if (!_this._fieldInputValidation[fieldCode]) {
|
|
3996
|
+
_this._fieldInputValidation[fieldCode] = [];
|
|
3892
3997
|
}
|
|
3893
|
-
_this.
|
|
3998
|
+
_this._fieldInputValidation[fieldCode].push(callbackMethod);
|
|
3894
3999
|
});
|
|
3895
4000
|
};
|
|
3896
|
-
BasicFormComponent.prototype.addFieldValidationStart = function (
|
|
4001
|
+
BasicFormComponent.prototype.addFieldValidationStart = function (codes, callbackMethod) {
|
|
3897
4002
|
var _this = this;
|
|
3898
|
-
var fieldSet = (Array.isArray(
|
|
4003
|
+
var fieldSet = (Array.isArray(codes)) ? codes : (codes ? [codes] : []);
|
|
3899
4004
|
fieldSet.forEach(function (fieldCode) {
|
|
3900
|
-
if (!_this.
|
|
3901
|
-
_this.
|
|
4005
|
+
if (!_this._fieldValidationsStart[fieldCode]) {
|
|
4006
|
+
_this._fieldValidationsStart[fieldCode] = [];
|
|
3902
4007
|
}
|
|
3903
|
-
_this.
|
|
4008
|
+
_this._fieldValidationsStart[fieldCode].push(callbackMethod);
|
|
3904
4009
|
});
|
|
3905
4010
|
};
|
|
3906
|
-
BasicFormComponent.prototype.addFieldValidationFinish = function (
|
|
4011
|
+
BasicFormComponent.prototype.addFieldValidationFinish = function (codes, callbackMethod) {
|
|
3907
4012
|
var _this = this;
|
|
3908
|
-
var fieldSet = (Array.isArray(
|
|
4013
|
+
var fieldSet = (Array.isArray(codes)) ? codes : (codes ? [codes] : []);
|
|
3909
4014
|
fieldSet.forEach(function (fieldCode) {
|
|
3910
|
-
if (!_this.
|
|
3911
|
-
_this.
|
|
4015
|
+
if (!_this._fieldValidationsFinish[fieldCode]) {
|
|
4016
|
+
_this._fieldValidationsFinish[fieldCode] = [];
|
|
3912
4017
|
}
|
|
3913
|
-
_this.
|
|
4018
|
+
_this._fieldValidationsFinish[fieldCode].push(callbackMethod);
|
|
3914
4019
|
});
|
|
3915
4020
|
};
|
|
3916
4021
|
BasicFormComponent.prototype.startFieldInputValidation = function (fieldCode, intrinsicValidation) {
|
|
@@ -3926,7 +4031,7 @@
|
|
|
3926
4031
|
return [2 /*return*/, false];
|
|
3927
4032
|
}
|
|
3928
4033
|
fieldToValidate.resetError();
|
|
3929
|
-
validationCallbacks = this.
|
|
4034
|
+
validationCallbacks = this._fieldInputValidation[fieldCode];
|
|
3930
4035
|
if (!validationCallbacks) return [3 /*break*/, 2];
|
|
3931
4036
|
clientValidationPromises = [];
|
|
3932
4037
|
try {
|
|
@@ -3965,7 +4070,7 @@
|
|
|
3965
4070
|
return [2 /*return*/];
|
|
3966
4071
|
}
|
|
3967
4072
|
fieldToValidate.resetError();
|
|
3968
|
-
validationCallbacks = this.
|
|
4073
|
+
validationCallbacks = this._fieldValidationsStart[fieldCode];
|
|
3969
4074
|
if (!validationCallbacks) return [3 /*break*/, 2];
|
|
3970
4075
|
clientValidationPromises = [];
|
|
3971
4076
|
try {
|
|
@@ -4040,7 +4145,7 @@
|
|
|
4040
4145
|
return __generator(this, function (_k) {
|
|
4041
4146
|
switch (_k.label) {
|
|
4042
4147
|
case 0:
|
|
4043
|
-
validationCallbacks = this.
|
|
4148
|
+
validationCallbacks = this._fieldValidationsFinish[fieldObject.fieldCode];
|
|
4044
4149
|
if (!validationCallbacks) return [3 /*break*/, 2];
|
|
4045
4150
|
clientActionPromises = [];
|
|
4046
4151
|
try {
|
|
@@ -4075,8 +4180,8 @@
|
|
|
4075
4180
|
/**
|
|
4076
4181
|
* Manejadores de eventos para acciones sobre Tablas
|
|
4077
4182
|
*/
|
|
4078
|
-
BasicFormComponent.prototype.addTableActionStart = function (
|
|
4079
|
-
var tableObject = this.getTable(
|
|
4183
|
+
BasicFormComponent.prototype.addTableActionStart = function (code, actionCode, callbackMethod) {
|
|
4184
|
+
var tableObject = this.getTable(code);
|
|
4080
4185
|
if (!tableObject) {
|
|
4081
4186
|
return;
|
|
4082
4187
|
}
|
|
@@ -4085,20 +4190,20 @@
|
|
|
4085
4190
|
return;
|
|
4086
4191
|
}
|
|
4087
4192
|
var tableEventHandlers = null;
|
|
4088
|
-
if (this.
|
|
4089
|
-
tableEventHandlers = this.
|
|
4193
|
+
if (this._tableActionsStart[code]) {
|
|
4194
|
+
tableEventHandlers = this._tableActionsStart[code];
|
|
4090
4195
|
}
|
|
4091
4196
|
else {
|
|
4092
4197
|
tableEventHandlers = {};
|
|
4093
|
-
this.
|
|
4198
|
+
this._tableActionsStart[code] = tableEventHandlers;
|
|
4094
4199
|
}
|
|
4095
4200
|
if (!tableEventHandlers[actionCode]) {
|
|
4096
4201
|
tableEventHandlers[actionCode] = [];
|
|
4097
4202
|
}
|
|
4098
4203
|
tableEventHandlers[actionCode].push(callbackMethod);
|
|
4099
4204
|
};
|
|
4100
|
-
BasicFormComponent.prototype.addTableActionFinish = function (
|
|
4101
|
-
var tableObject = this.getTable(
|
|
4205
|
+
BasicFormComponent.prototype.addTableActionFinish = function (code, actionCode, callbackMethod) {
|
|
4206
|
+
var tableObject = this.getTable(code);
|
|
4102
4207
|
if (!tableObject) {
|
|
4103
4208
|
return;
|
|
4104
4209
|
}
|
|
@@ -4107,75 +4212,75 @@
|
|
|
4107
4212
|
return;
|
|
4108
4213
|
}
|
|
4109
4214
|
var tableEventHandlers = null;
|
|
4110
|
-
if (this.
|
|
4111
|
-
tableEventHandlers = this.
|
|
4215
|
+
if (this._tableActionsFinish[code]) {
|
|
4216
|
+
tableEventHandlers = this._tableActionsFinish[code];
|
|
4112
4217
|
}
|
|
4113
4218
|
else {
|
|
4114
4219
|
tableEventHandlers = {};
|
|
4115
|
-
this.
|
|
4220
|
+
this._tableActionsFinish[code] = tableEventHandlers;
|
|
4116
4221
|
}
|
|
4117
4222
|
if (!tableEventHandlers[actionCode]) {
|
|
4118
4223
|
tableEventHandlers[actionCode] = [];
|
|
4119
4224
|
}
|
|
4120
4225
|
tableEventHandlers[actionCode].push(callbackMethod);
|
|
4121
4226
|
};
|
|
4122
|
-
BasicFormComponent.prototype.addTableSelectionStart = function (
|
|
4123
|
-
var tableObject = this.getTable(
|
|
4227
|
+
BasicFormComponent.prototype.addTableSelectionStart = function (code, callbackMethod) {
|
|
4228
|
+
var tableObject = this.getTable(code);
|
|
4124
4229
|
if (!tableObject) {
|
|
4125
4230
|
return;
|
|
4126
4231
|
}
|
|
4127
4232
|
var tableEventHandlers = null;
|
|
4128
|
-
if (this.
|
|
4129
|
-
tableEventHandlers = this.
|
|
4233
|
+
if (this._tableSelectionsStart[code]) {
|
|
4234
|
+
tableEventHandlers = this._tableSelectionsStart[code];
|
|
4130
4235
|
}
|
|
4131
4236
|
else {
|
|
4132
4237
|
tableEventHandlers = [];
|
|
4133
|
-
this.
|
|
4238
|
+
this._tableSelectionsStart[code] = tableEventHandlers;
|
|
4134
4239
|
}
|
|
4135
4240
|
tableEventHandlers.push(callbackMethod);
|
|
4136
4241
|
};
|
|
4137
|
-
BasicFormComponent.prototype.addTableSelectionFinish = function (
|
|
4138
|
-
var tableObject = this.getTable(
|
|
4242
|
+
BasicFormComponent.prototype.addTableSelectionFinish = function (code, callbackMethod) {
|
|
4243
|
+
var tableObject = this.getTable(code);
|
|
4139
4244
|
if (!tableObject) {
|
|
4140
4245
|
return;
|
|
4141
4246
|
}
|
|
4142
4247
|
var tableEventHandlers = null;
|
|
4143
|
-
if (this.
|
|
4144
|
-
tableEventHandlers = this.
|
|
4248
|
+
if (this._tableSelectionsFinish[code]) {
|
|
4249
|
+
tableEventHandlers = this._tableSelectionsFinish[code];
|
|
4145
4250
|
}
|
|
4146
4251
|
else {
|
|
4147
4252
|
tableEventHandlers = [];
|
|
4148
|
-
this.
|
|
4253
|
+
this._tableSelectionsFinish[code] = tableEventHandlers;
|
|
4149
4254
|
}
|
|
4150
4255
|
tableEventHandlers.push(callbackMethod);
|
|
4151
4256
|
};
|
|
4152
|
-
BasicFormComponent.prototype.addTableGetDataStart = function (
|
|
4153
|
-
var tableObject = this.getTable(
|
|
4257
|
+
BasicFormComponent.prototype.addTableGetDataStart = function (code, callbackMethod) {
|
|
4258
|
+
var tableObject = this.getTable(code);
|
|
4154
4259
|
if (!tableObject) {
|
|
4155
4260
|
return;
|
|
4156
4261
|
}
|
|
4157
4262
|
var tableEventHandlers = null;
|
|
4158
|
-
if (this.
|
|
4159
|
-
tableEventHandlers = this.
|
|
4263
|
+
if (this._tableGetDataStart[code]) {
|
|
4264
|
+
tableEventHandlers = this._tableGetDataStart[code];
|
|
4160
4265
|
}
|
|
4161
4266
|
else {
|
|
4162
4267
|
tableEventHandlers = [];
|
|
4163
|
-
this.
|
|
4268
|
+
this._tableGetDataStart[code] = tableEventHandlers;
|
|
4164
4269
|
}
|
|
4165
4270
|
tableEventHandlers.push(callbackMethod);
|
|
4166
4271
|
};
|
|
4167
|
-
BasicFormComponent.prototype.addTableGetDataFinish = function (
|
|
4168
|
-
var tableObject = this.getTable(
|
|
4272
|
+
BasicFormComponent.prototype.addTableGetDataFinish = function (code, callbackMethod) {
|
|
4273
|
+
var tableObject = this.getTable(code);
|
|
4169
4274
|
if (!tableObject) {
|
|
4170
4275
|
return;
|
|
4171
4276
|
}
|
|
4172
4277
|
var tableEventHandlers = null;
|
|
4173
|
-
if (this.
|
|
4174
|
-
tableEventHandlers = this.
|
|
4278
|
+
if (this._tableGetDataFinish[code]) {
|
|
4279
|
+
tableEventHandlers = this._tableGetDataFinish[code];
|
|
4175
4280
|
}
|
|
4176
4281
|
else {
|
|
4177
4282
|
tableEventHandlers = {};
|
|
4178
|
-
this.
|
|
4283
|
+
this._tableGetDataFinish[code] = tableEventHandlers;
|
|
4179
4284
|
}
|
|
4180
4285
|
tableEventHandlers[GET_DATA_ACTION] = callbackMethod;
|
|
4181
4286
|
};
|
|
@@ -4202,7 +4307,7 @@
|
|
|
4202
4307
|
tableCode: tableCode,
|
|
4203
4308
|
actionCode: actionCode,
|
|
4204
4309
|
};
|
|
4205
|
-
tableEventHandlers = this.
|
|
4310
|
+
tableEventHandlers = this._tableActionsStart[tableCode];
|
|
4206
4311
|
tableActionMethods = (tableEventHandlers) ? tableEventHandlers[actionCode] : null;
|
|
4207
4312
|
if (!tableActionMethods) return [3 /*break*/, 2];
|
|
4208
4313
|
clientActionPromises = [];
|
|
@@ -4285,7 +4390,7 @@
|
|
|
4285
4390
|
switch (_k.label) {
|
|
4286
4391
|
case 0:
|
|
4287
4392
|
tableCode = tableActionDetail.tableCode, actionCode = tableActionDetail.actionCode;
|
|
4288
|
-
tableEventHandlers = this.
|
|
4393
|
+
tableEventHandlers = this._tableActionsFinish[tableCode];
|
|
4289
4394
|
tableActionMethods = (tableEventHandlers) ? tableEventHandlers[actionCode] : null;
|
|
4290
4395
|
if (!tableActionMethods) return [3 /*break*/, 2];
|
|
4291
4396
|
clientActionPromises = [];
|
|
@@ -4337,7 +4442,7 @@
|
|
|
4337
4442
|
recordId: recordId,
|
|
4338
4443
|
recordData: recordData
|
|
4339
4444
|
};
|
|
4340
|
-
tableEventHandlers = this.
|
|
4445
|
+
tableEventHandlers = this._tableActionsStart[tableCode];
|
|
4341
4446
|
tableActionMethods = (tableEventHandlers) ? tableEventHandlers[actionCode] : null;
|
|
4342
4447
|
if (!tableActionMethods) return [3 /*break*/, 2];
|
|
4343
4448
|
clientActionPromises = [];
|
|
@@ -4422,7 +4527,7 @@
|
|
|
4422
4527
|
switch (_k.label) {
|
|
4423
4528
|
case 0:
|
|
4424
4529
|
tableCode = tableActionDetail.tableCode, actionCode = tableActionDetail.actionCode;
|
|
4425
|
-
tableEventHandlers = this.
|
|
4530
|
+
tableEventHandlers = this._tableActionsFinish[tableCode];
|
|
4426
4531
|
tableActionMethods = (tableEventHandlers) ? tableEventHandlers[actionCode] : null;
|
|
4427
4532
|
if (!tableActionMethods) return [3 /*break*/, 2];
|
|
4428
4533
|
clientActionPromises = [];
|
|
@@ -4468,7 +4573,7 @@
|
|
|
4468
4573
|
recordId: recordId,
|
|
4469
4574
|
recordData: recordData
|
|
4470
4575
|
};
|
|
4471
|
-
tableEventHandlers = this.
|
|
4576
|
+
tableEventHandlers = this._tableSelectionsStart[tableCode];
|
|
4472
4577
|
if (!tableEventHandlers) return [3 /*break*/, 2];
|
|
4473
4578
|
clientActionPromises = [];
|
|
4474
4579
|
try {
|
|
@@ -4548,7 +4653,7 @@
|
|
|
4548
4653
|
switch (_k.label) {
|
|
4549
4654
|
case 0:
|
|
4550
4655
|
tableCode = tableSelectionDetail.tableCode;
|
|
4551
|
-
tableEventHandlers = this.
|
|
4656
|
+
tableEventHandlers = this._tableSelectionsFinish[tableCode];
|
|
4552
4657
|
if (!tableEventHandlers) return [3 /*break*/, 2];
|
|
4553
4658
|
clientActionPromises = [];
|
|
4554
4659
|
try {
|
|
@@ -4598,7 +4703,7 @@
|
|
|
4598
4703
|
actionCode: actionCode,
|
|
4599
4704
|
selectedRecords: selectedRecords
|
|
4600
4705
|
};
|
|
4601
|
-
tableEventHandlers = this.
|
|
4706
|
+
tableEventHandlers = this._tableActionsStart[tableCode];
|
|
4602
4707
|
tableActionMethods = (tableEventHandlers) ? tableEventHandlers[actionCode] : null;
|
|
4603
4708
|
if (!tableActionMethods) return [3 /*break*/, 2];
|
|
4604
4709
|
clientActionPromises = [];
|
|
@@ -4679,7 +4784,7 @@
|
|
|
4679
4784
|
switch (_k.label) {
|
|
4680
4785
|
case 0:
|
|
4681
4786
|
tableCode = tableActionDetail.tableCode, actionCode = tableActionDetail.actionCode;
|
|
4682
|
-
tableEventHandlers = this.
|
|
4787
|
+
tableEventHandlers = this._tableActionsFinish[tableCode];
|
|
4683
4788
|
tableActionMethods = (tableEventHandlers) ? tableEventHandlers[actionCode] : null;
|
|
4684
4789
|
if (!tableActionMethods) return [3 /*break*/, 2];
|
|
4685
4790
|
clientActionPromises = [];
|
|
@@ -4719,7 +4824,7 @@
|
|
|
4719
4824
|
tableCode: tableCode
|
|
4720
4825
|
};
|
|
4721
4826
|
this.resetError();
|
|
4722
|
-
tableEventHandlers = this.
|
|
4827
|
+
tableEventHandlers = this._tableGetDataStart[tableCode];
|
|
4723
4828
|
if (!tableEventHandlers) return [3 /*break*/, 2];
|
|
4724
4829
|
clientActionPromises = [];
|
|
4725
4830
|
try {
|
|
@@ -4784,7 +4889,7 @@
|
|
|
4784
4889
|
switch (_k.label) {
|
|
4785
4890
|
case 0:
|
|
4786
4891
|
tableCode = tableActionDetail.tableCode, tableActionCode = tableActionDetail.tableActionCode;
|
|
4787
|
-
tableEventHandlers = this.
|
|
4892
|
+
tableEventHandlers = this._tableActionsFinish[tableCode];
|
|
4788
4893
|
tableActionMethods = (tableEventHandlers) ? tableEventHandlers[tableActionCode] : null;
|
|
4789
4894
|
if (!tableActionMethods) return [3 /*break*/, 2];
|
|
4790
4895
|
clientActionPromises = [];
|
|
@@ -4898,132 +5003,6 @@
|
|
|
4898
5003
|
}
|
|
4899
5004
|
return true;
|
|
4900
5005
|
};
|
|
4901
|
-
/**
|
|
4902
|
-
* Soporte registros en tablas que se editan en campos del formulario
|
|
4903
|
-
*/
|
|
4904
|
-
BasicFormComponent.prototype.defineEditionTable = function (tableEditionDef) {
|
|
4905
|
-
var e_24, _j;
|
|
4906
|
-
var _this = this;
|
|
4907
|
-
var columnFieldMapping = tableEditionDef.columnFieldMapping, recordCaptureFields = tableEditionDef.recordCaptureFields, startCollapsed = tableEditionDef.startCollapsed;
|
|
4908
|
-
tableEditionDef.startCollapsed = (typeof startCollapsed !== 'undefined')
|
|
4909
|
-
? startCollapsed : true;
|
|
4910
|
-
var fieldsMappingTable = {};
|
|
4911
|
-
var fieldsToClear = [];
|
|
4912
|
-
try {
|
|
4913
|
-
for (var columnFieldMapping_1 = __values(columnFieldMapping), columnFieldMapping_1_1 = columnFieldMapping_1.next(); !columnFieldMapping_1_1.done; columnFieldMapping_1_1 = columnFieldMapping_1.next()) {
|
|
4914
|
-
var columnMap = columnFieldMapping_1_1.value;
|
|
4915
|
-
var _k = __read(columnMap, 2), columnName = _k[0], formField = _k[1];
|
|
4916
|
-
fieldsMappingTable[columnName] = formField;
|
|
4917
|
-
fieldsToClear.push(formField);
|
|
4918
|
-
}
|
|
4919
|
-
}
|
|
4920
|
-
catch (e_24_1) { e_24 = { error: e_24_1 }; }
|
|
4921
|
-
finally {
|
|
4922
|
-
try {
|
|
4923
|
-
if (columnFieldMapping_1_1 && !columnFieldMapping_1_1.done && (_j = columnFieldMapping_1.return)) _j.call(columnFieldMapping_1);
|
|
4924
|
-
}
|
|
4925
|
-
finally { if (e_24) throw e_24.error; }
|
|
4926
|
-
}
|
|
4927
|
-
tableEditionDef.fieldsMappingTable = fieldsMappingTable;
|
|
4928
|
-
tableEditionDef.fieldsToClear = fieldsToClear;
|
|
4929
|
-
var tableName = tableEditionDef.tableName, newRecordActionName = tableEditionDef.newRecordActionName, saveRecordActionName = tableEditionDef.saveRecordActionName, cancelSaveRecordActionName = tableEditionDef.cancelSaveRecordActionName, tableEditRecordActionName = tableEditionDef.tableEditRecordActionName, enableRecordEdition = tableEditionDef.enableRecordEdition;
|
|
4930
|
-
this.addActionMethodStart(newRecordActionName, function () {
|
|
4931
|
-
_this.cleanFields(fieldsToClear, null);
|
|
4932
|
-
_this.showFields(recordCaptureFields);
|
|
4933
|
-
if (!enableRecordEdition) {
|
|
4934
|
-
_this.enableRecordEdition(tableEditionDef);
|
|
4935
|
-
}
|
|
4936
|
-
else {
|
|
4937
|
-
enableRecordEdition(tableEditionDef);
|
|
4938
|
-
}
|
|
4939
|
-
_this.hideAction(newRecordActionName);
|
|
4940
|
-
_this.showAction(cancelSaveRecordActionName);
|
|
4941
|
-
_this.showAction(saveRecordActionName);
|
|
4942
|
-
return true;
|
|
4943
|
-
});
|
|
4944
|
-
var recordEditionValidate = tableEditionDef.recordEditionValidate, disableRecordEdition = tableEditionDef.disableRecordEdition;
|
|
4945
|
-
this.addActionMethodStart(saveRecordActionName, function () {
|
|
4946
|
-
return (!recordEditionValidate) ? _this.recordEditionValidate(tableEditionDef)
|
|
4947
|
-
: recordEditionValidate(tableEditionDef);
|
|
4948
|
-
});
|
|
4949
|
-
this.addActionMethodFinish(saveRecordActionName, function () {
|
|
4950
|
-
if (!_this.errorOccured()) {
|
|
4951
|
-
return (!disableRecordEdition) ? _this.disableRecordEdition(tableEditionDef)
|
|
4952
|
-
: disableRecordEdition(tableEditionDef);
|
|
4953
|
-
}
|
|
4954
|
-
});
|
|
4955
|
-
this.addActionMethodStart(cancelSaveRecordActionName, function () {
|
|
4956
|
-
return (!disableRecordEdition) ? _this.disableRecordEdition(tableEditionDef)
|
|
4957
|
-
: disableRecordEdition(tableEditionDef);
|
|
4958
|
-
});
|
|
4959
|
-
this.addTableActionStart(tableName, tableEditRecordActionName, function (tblActObj) {
|
|
4960
|
-
return (!enableRecordEdition)
|
|
4961
|
-
? _this.enableRecordEdition(tableEditionDef, tblActObj)
|
|
4962
|
-
: enableRecordEdition(tableEditionDef, tblActObj);
|
|
4963
|
-
});
|
|
4964
|
-
if (tableEditionDef.startCollapsed) {
|
|
4965
|
-
return (!tableEditionDef.disableRecordEdition)
|
|
4966
|
-
? this.disableRecordEdition(tableEditionDef)
|
|
4967
|
-
: tableEditionDef.disableRecordEdition(tableEditionDef);
|
|
4968
|
-
}
|
|
4969
|
-
else {
|
|
4970
|
-
return (!tableEditionDef.enableRecordEdition)
|
|
4971
|
-
? this.enableRecordEdition(tableEditionDef)
|
|
4972
|
-
: tableEditionDef.enableRecordEdition(tableEditionDef, null);
|
|
4973
|
-
}
|
|
4974
|
-
};
|
|
4975
|
-
BasicFormComponent.prototype.enableRecordEdition = function (tableEditionDef, tableActionObject) {
|
|
4976
|
-
var e_25, _j;
|
|
4977
|
-
if (tableActionObject === void 0) { tableActionObject = null; }
|
|
4978
|
-
if (tableActionObject) {
|
|
4979
|
-
this.copyTableRecordToFields(tableActionObject, tableEditionDef.fieldsMappingTable);
|
|
4980
|
-
}
|
|
4981
|
-
this.showFields(tableEditionDef.recordCaptureFields);
|
|
4982
|
-
this.hideAction(tableEditionDef.newRecordActionName);
|
|
4983
|
-
this.showAction(tableEditionDef.cancelSaveRecordActionName);
|
|
4984
|
-
this.showAction(tableEditionDef.saveRecordActionName);
|
|
4985
|
-
if (tableEditionDef.fieldsToTriggerValidation
|
|
4986
|
-
&& tableEditionDef.fieldsToTriggerValidation.length > 0) {
|
|
4987
|
-
try {
|
|
4988
|
-
for (var _k = __values(tableEditionDef.fieldsToTriggerValidation), _l = _k.next(); !_l.done; _l = _k.next()) {
|
|
4989
|
-
var fieldName = _l.value;
|
|
4990
|
-
this.startFieldValidation(fieldName);
|
|
4991
|
-
}
|
|
4992
|
-
}
|
|
4993
|
-
catch (e_25_1) { e_25 = { error: e_25_1 }; }
|
|
4994
|
-
finally {
|
|
4995
|
-
try {
|
|
4996
|
-
if (_l && !_l.done && (_j = _k.return)) _j.call(_k);
|
|
4997
|
-
}
|
|
4998
|
-
finally { if (e_25) throw e_25.error; }
|
|
4999
|
-
}
|
|
5000
|
-
}
|
|
5001
|
-
return true;
|
|
5002
|
-
};
|
|
5003
|
-
BasicFormComponent.prototype.disableRecordEdition = function (tableDefinition) {
|
|
5004
|
-
this.cleanFields(tableDefinition.fieldsToClear, null);
|
|
5005
|
-
this.hideFields(tableDefinition.recordCaptureFields);
|
|
5006
|
-
this.showAction(tableDefinition.newRecordActionName);
|
|
5007
|
-
this.hideAction(tableDefinition.cancelSaveRecordActionName);
|
|
5008
|
-
this.hideAction(tableDefinition.saveRecordActionName);
|
|
5009
|
-
return true;
|
|
5010
|
-
};
|
|
5011
|
-
BasicFormComponent.prototype.recordEditionValidate = function (tableEditionDef) {
|
|
5012
|
-
var recordCaptureFields = tableEditionDef.recordCaptureFields;
|
|
5013
|
-
var validationOk = true;
|
|
5014
|
-
var requiredEmptyFields = this.getRequiredEmptyFields(recordCaptureFields, null);
|
|
5015
|
-
if (requiredEmptyFields.length > 0) {
|
|
5016
|
-
validationOk = false;
|
|
5017
|
-
this.setError(this.formConfig.formStandardErrors.typeWarning, this.formConfig.formStandardErrors.validationTitle, this.formConfig.formStandardErrors.requiredFields);
|
|
5018
|
-
this.tagFieldsWithError(requiredEmptyFields, null, this.formConfig.formStandardErrors.requiredField);
|
|
5019
|
-
}
|
|
5020
|
-
var validationIssueFields = this.getFieldsWithValidationIssues(recordCaptureFields, null);
|
|
5021
|
-
if (validationIssueFields.length > 0) {
|
|
5022
|
-
validationOk = false;
|
|
5023
|
-
this.setError(this.formConfig.formStandardErrors.typeWarning, this.formConfig.formStandardErrors.validationTitle, this.formConfig.formStandardErrors.validationFields);
|
|
5024
|
-
}
|
|
5025
|
-
return validationOk;
|
|
5026
|
-
};
|
|
5027
5006
|
return BasicFormComponent;
|
|
5028
5007
|
}());
|
|
5029
5008
|
BasicFormComponent.decorators = [
|