tuain-ng-forms-lib 13.0.11 → 13.0.13
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/esm2020/lib/classes/forms/form.mjs +12 -10
- package/esm2020/lib/classes/forms/table/table.mjs +5 -3
- package/esm2020/lib/components/forms/basic-form.mjs +171 -75
- package/fesm2015/tuain-ng-forms-lib.mjs +204 -96
- package/fesm2015/tuain-ng-forms-lib.mjs.map +1 -1
- package/fesm2020/tuain-ng-forms-lib.mjs +185 -85
- package/fesm2020/tuain-ng-forms-lib.mjs.map +1 -1
- package/lib/classes/forms/form.d.ts +1 -1
- package/lib/components/forms/basic-form.d.ts +61 -33
- package/package.json +1 -1
|
@@ -1448,8 +1448,10 @@ class RecordTable extends FormElement {
|
|
|
1448
1448
|
this.updateVisibleRecords();
|
|
1449
1449
|
}
|
|
1450
1450
|
recordCompare(recordA, recordB, columnCompare, direction) {
|
|
1451
|
-
const
|
|
1452
|
-
const
|
|
1451
|
+
const recordAValue = recordA.getFieldValue(columnCompare);
|
|
1452
|
+
const recordBValue = recordB.getFieldValue(columnCompare);
|
|
1453
|
+
const recordAColumn = isNaN(recordAValue) ? recordAValue.toLocaleLowerCase() : recordAValue;
|
|
1454
|
+
const recordBColumn = isNaN(recordBValue) ? recordBValue.toLocaleLowerCase() : recordBValue;
|
|
1453
1455
|
let result = 0;
|
|
1454
1456
|
if (recordAColumn < recordBColumn) {
|
|
1455
1457
|
result = -1;
|
|
@@ -1668,6 +1670,8 @@ const DISABLE = 'disable';
|
|
|
1668
1670
|
const CLEAN = 'clean';
|
|
1669
1671
|
class FormStructureAndData {
|
|
1670
1672
|
constructor(definitionReceived, formConfig) {
|
|
1673
|
+
this._name = '';
|
|
1674
|
+
this._title = '';
|
|
1671
1675
|
this._fields = {};
|
|
1672
1676
|
this._actions = {};
|
|
1673
1677
|
this._tables = {};
|
|
@@ -1856,13 +1860,13 @@ class FormStructureAndData {
|
|
|
1856
1860
|
}
|
|
1857
1861
|
}
|
|
1858
1862
|
getFieldSet(filter, inputCodes, secCode, subCode) {
|
|
1859
|
-
var _a, _b, _c, _d;
|
|
1860
|
-
let codes =
|
|
1863
|
+
var _a, _b, _c, _d, _e;
|
|
1864
|
+
let codes = [];
|
|
1861
1865
|
if (typeof inputCodes === 'string' && inputCodes) {
|
|
1862
1866
|
codes = [inputCodes];
|
|
1863
1867
|
}
|
|
1864
1868
|
else if (Array.isArray(inputCodes) && inputCodes.length > 0) {
|
|
1865
|
-
codes = inputCodes;
|
|
1869
|
+
codes = inputCodes !== null && inputCodes !== void 0 ? inputCodes : [];
|
|
1866
1870
|
}
|
|
1867
1871
|
else if (secCode && !subCode) {
|
|
1868
1872
|
codes = (_b = (_a = this.getSection(secCode)) === null || _a === void 0 ? void 0 : _a.getFieldNames()) !== null && _b !== void 0 ? _b : [];
|
|
@@ -1871,7 +1875,7 @@ class FormStructureAndData {
|
|
|
1871
1875
|
codes = (_d = (_c = this.getSubSection(secCode, subCode)) === null || _c === void 0 ? void 0 : _c.getFieldNames()) !== null && _d !== void 0 ? _d : [];
|
|
1872
1876
|
}
|
|
1873
1877
|
else {
|
|
1874
|
-
codes = this.getFieldNames();
|
|
1878
|
+
codes = (_e = this.getFieldNames()) !== null && _e !== void 0 ? _e : [];
|
|
1875
1879
|
}
|
|
1876
1880
|
return (filter) ? codes.filter(fld => filter(this.getField(fld))) : codes;
|
|
1877
1881
|
}
|
|
@@ -1879,7 +1883,7 @@ class FormStructureAndData {
|
|
|
1879
1883
|
if (!processFunc) {
|
|
1880
1884
|
return 0;
|
|
1881
1885
|
}
|
|
1882
|
-
const codes = this.getFieldSet(null, inputCodes, secCode, subCode);
|
|
1886
|
+
const codes = this.getFieldSet(null, inputCodes !== null && inputCodes !== void 0 ? inputCodes : null, secCode, subCode);
|
|
1883
1887
|
let processedFields = 0;
|
|
1884
1888
|
for (const code of codes) {
|
|
1885
1889
|
const field = this.getField(code);
|
|
@@ -1926,20 +1930,20 @@ class FormStructureAndData {
|
|
|
1926
1930
|
return this.tagFieldsWithError(message, this.getRequiredEmptyFields(codes, secCode, subCode)) > 0;
|
|
1927
1931
|
}
|
|
1928
1932
|
getRequiredFields(codes, secCode, subCode) {
|
|
1929
|
-
return this.getFieldSet(fld => fld.required, codes, secCode, subCode);
|
|
1933
|
+
return this.getFieldSet(fld => fld.required, codes !== null && codes !== void 0 ? codes : null, secCode, subCode);
|
|
1930
1934
|
}
|
|
1931
1935
|
getRequiredEmptyFields(codes, secCode, subCode) {
|
|
1932
|
-
return this.getFieldSet(fld => fld.required && fld.empty, codes, secCode, subCode);
|
|
1936
|
+
return this.getFieldSet(fld => fld.required && fld.empty, codes !== null && codes !== void 0 ? codes : null, secCode, subCode);
|
|
1933
1937
|
}
|
|
1934
1938
|
getChangedFields(codes, secCode, subCode) {
|
|
1935
|
-
return this.getFieldSet(fld => !fld.outputOnly && fld.hasChanged(), codes, secCode, subCode);
|
|
1939
|
+
return this.getFieldSet(fld => !fld.outputOnly && fld.hasChanged(), codes !== null && codes !== void 0 ? codes : null, secCode, subCode);
|
|
1936
1940
|
}
|
|
1937
1941
|
getFieldsWithValidationIssues(codes, secCode, subCode) {
|
|
1938
|
-
return this.getFieldSet(fld => fld.errorCode !== NO_ERROR, codes, secCode, subCode);
|
|
1942
|
+
return this.getFieldSet(fld => fld.errorCode !== NO_ERROR, codes !== null && codes !== void 0 ? codes : null, secCode, subCode);
|
|
1939
1943
|
}
|
|
1940
1944
|
getFieldsValues(inputCodes, secCode, subCode) {
|
|
1941
1945
|
var _a, _b, _c;
|
|
1942
|
-
const codes = this.getFieldSet(null, inputCodes, secCode, subCode);
|
|
1946
|
+
const codes = this.getFieldSet(null, inputCodes !== null && inputCodes !== void 0 ? inputCodes : null, secCode, subCode);
|
|
1943
1947
|
const resultObject = {};
|
|
1944
1948
|
for (let index = 0; index < codes.length; index++) {
|
|
1945
1949
|
const code = codes[index];
|
|
@@ -2200,6 +2204,8 @@ class BasicFormComponent {
|
|
|
2200
2204
|
this.fileMgmtServices = fileMgmtServices;
|
|
2201
2205
|
this._formStructure = null;
|
|
2202
2206
|
this._controlToken = null;
|
|
2207
|
+
this._originToken = null;
|
|
2208
|
+
this._formRoute = null;
|
|
2203
2209
|
this._definitionObtained = false;
|
|
2204
2210
|
// Eventos de acciones y campos
|
|
2205
2211
|
this._formSectionsActivate = {};
|
|
@@ -2216,8 +2222,14 @@ class BasicFormComponent {
|
|
|
2216
2222
|
this._tableActionsFinish = {};
|
|
2217
2223
|
this._tableGetDataStart = {};
|
|
2218
2224
|
this._tableGetDataFinish = {};
|
|
2225
|
+
this._actionServerError = [];
|
|
2226
|
+
this._fieldServerError = [];
|
|
2227
|
+
this._tableServerError = [];
|
|
2219
2228
|
this.inputDataFields = {};
|
|
2220
2229
|
this.extraData = {};
|
|
2230
|
+
this.enabledSections = [];
|
|
2231
|
+
this.name = null;
|
|
2232
|
+
this.formSubject = null;
|
|
2221
2233
|
this._errorType = '';
|
|
2222
2234
|
this.errorCode = '';
|
|
2223
2235
|
this.errorMessage = '';
|
|
@@ -2232,20 +2244,20 @@ class BasicFormComponent {
|
|
|
2232
2244
|
setTitle(title) { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.setTitle(title); }
|
|
2233
2245
|
cleanData() { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.cleanData(); }
|
|
2234
2246
|
getCurrentState() { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getCurrentState(); }
|
|
2235
|
-
supportState(state) { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.supportState(state); }
|
|
2236
|
-
changeState(state) { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.changeState(state); }
|
|
2247
|
+
supportState(state) { var _a, _b; return (_b = (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.supportState(state !== null && state !== void 0 ? state : '')) !== null && _b !== void 0 ? _b : false; }
|
|
2248
|
+
changeState(state) { var _a, _b; return (_b = (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.changeState(state)) !== null && _b !== void 0 ? _b : false; }
|
|
2237
2249
|
getStates() { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.states; }
|
|
2238
2250
|
getImmutableElement(name) { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getImmutableElement(name); }
|
|
2239
2251
|
getExtraInfo(name) { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getExtraInfo(name); }
|
|
2240
|
-
getFields() { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getFields(); }
|
|
2241
|
-
getFieldNames() { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getFieldNames(); }
|
|
2242
|
-
getField(code) { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getField(code); }
|
|
2252
|
+
getFields() { var _a, _b; return (_b = (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getFields()) !== null && _b !== void 0 ? _b : null; }
|
|
2253
|
+
getFieldNames() { var _a, _b; return (_b = (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getFieldNames()) !== null && _b !== void 0 ? _b : null; }
|
|
2254
|
+
getField(code) { var _a, _b; return (_b = (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getField(code)) !== null && _b !== void 0 ? _b : null; }
|
|
2243
2255
|
enableField(code) { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.enableField(code); }
|
|
2244
2256
|
disableField(code) { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.disableField(code); }
|
|
2245
|
-
getFieldValue(code) { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getFieldValue(code); }
|
|
2257
|
+
getFieldValue(code) { var _a, _b; return (_b = (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getFieldValue(code)) !== null && _b !== void 0 ? _b : null; }
|
|
2246
2258
|
getFieldOptionText(code) { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getFieldOptionText(code); }
|
|
2247
|
-
getFieldsValues(codes) { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getFieldsValues(codes); }
|
|
2248
|
-
getFieldOptions(code) { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getFieldOptions(code); }
|
|
2259
|
+
getFieldsValues(codes) { var _a, _b; return (_b = (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getFieldsValues(codes)) !== null && _b !== void 0 ? _b : null; }
|
|
2260
|
+
getFieldOptions(code) { var _a, _b; return (_b = (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getFieldOptions(code)) !== null && _b !== void 0 ? _b : null; }
|
|
2249
2261
|
setFieldValue(code, value) { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.setFieldValue(code, value); }
|
|
2250
2262
|
setFieldRequired(code, required) { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.setFieldRequired(code, required); }
|
|
2251
2263
|
setFieldErrorMessage(code, errorMessage) { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.setFieldErrorMessage(code, errorMessage); }
|
|
@@ -2260,7 +2272,7 @@ class BasicFormComponent {
|
|
|
2260
2272
|
}
|
|
2261
2273
|
getFieldSet(filterFunc, codes, secCode, subCode) {
|
|
2262
2274
|
var _a;
|
|
2263
|
-
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getFieldSet(filterFunc, codes, secCode, subCode);
|
|
2275
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getFieldSet(filterFunc, codes !== null && codes !== void 0 ? codes : null, secCode !== null && secCode !== void 0 ? secCode : null, subCode !== null && subCode !== void 0 ? subCode : null);
|
|
2264
2276
|
}
|
|
2265
2277
|
applyOnFields(processFunc, codes, secCode, subCode) {
|
|
2266
2278
|
var _a;
|
|
@@ -2279,8 +2291,8 @@ class BasicFormComponent {
|
|
|
2279
2291
|
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getRequiredFields(codes, secCode, subCode);
|
|
2280
2292
|
}
|
|
2281
2293
|
getRequiredEmptyFields(codes, secCode, subCode) {
|
|
2282
|
-
var _a;
|
|
2283
|
-
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getRequiredEmptyFields(codes, secCode, subCode);
|
|
2294
|
+
var _a, _b;
|
|
2295
|
+
return (_b = (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getRequiredEmptyFields(codes, secCode, subCode)) !== null && _b !== void 0 ? _b : null;
|
|
2284
2296
|
}
|
|
2285
2297
|
getChangedFields(codes, secCode, subCode) {
|
|
2286
2298
|
var _a;
|
|
@@ -2343,8 +2355,8 @@ class BasicFormComponent {
|
|
|
2343
2355
|
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getActionsByAttribute('location', HEADER$1);
|
|
2344
2356
|
}
|
|
2345
2357
|
getAction(actionCode) {
|
|
2346
|
-
var _a;
|
|
2347
|
-
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getAction(actionCode);
|
|
2358
|
+
var _a, _b;
|
|
2359
|
+
return (_b = (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getAction(actionCode)) !== null && _b !== void 0 ? _b : null;
|
|
2348
2360
|
}
|
|
2349
2361
|
showActions(actionArray) {
|
|
2350
2362
|
var _a;
|
|
@@ -2379,20 +2391,20 @@ class BasicFormComponent {
|
|
|
2379
2391
|
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.disableActions(code);
|
|
2380
2392
|
}
|
|
2381
2393
|
getSections() {
|
|
2382
|
-
var _a;
|
|
2383
|
-
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getSections();
|
|
2394
|
+
var _a, _b;
|
|
2395
|
+
return (_b = (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getSections()) !== null && _b !== void 0 ? _b : null;
|
|
2384
2396
|
}
|
|
2385
2397
|
activateSection(code) {
|
|
2386
2398
|
var _a;
|
|
2387
2399
|
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.activateSection(code);
|
|
2388
2400
|
}
|
|
2389
2401
|
getSectionsTitles() {
|
|
2390
|
-
var _a;
|
|
2391
|
-
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getSections().map(sec => sec.title);
|
|
2402
|
+
var _a, _b;
|
|
2403
|
+
return (_b = (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getSections().map(sec => sec.title)) !== null && _b !== void 0 ? _b : null;
|
|
2392
2404
|
}
|
|
2393
2405
|
getSection(code) {
|
|
2394
|
-
var _a;
|
|
2395
|
-
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getSection(code);
|
|
2406
|
+
var _a, _b;
|
|
2407
|
+
return (_b = (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getSection(code)) !== null && _b !== void 0 ? _b : null;
|
|
2396
2408
|
}
|
|
2397
2409
|
showSection(code) {
|
|
2398
2410
|
var _a;
|
|
@@ -2411,8 +2423,8 @@ class BasicFormComponent {
|
|
|
2411
2423
|
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.hideSections(codes);
|
|
2412
2424
|
}
|
|
2413
2425
|
getSubSection(code, subCode) {
|
|
2414
|
-
var _a;
|
|
2415
|
-
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getSubSection(code, subCode);
|
|
2426
|
+
var _a, _b;
|
|
2427
|
+
return (_b = (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getSubSection(code, subCode)) !== null && _b !== void 0 ? _b : null;
|
|
2416
2428
|
}
|
|
2417
2429
|
showSubSection(code, subCode) {
|
|
2418
2430
|
var _a;
|
|
@@ -2431,12 +2443,12 @@ class BasicFormComponent {
|
|
|
2431
2443
|
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.hideSubSections(code, subCodes);
|
|
2432
2444
|
}
|
|
2433
2445
|
getSectionActions(code) {
|
|
2434
|
-
var _a;
|
|
2435
|
-
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getSectionActions(code);
|
|
2446
|
+
var _a, _b;
|
|
2447
|
+
return (_b = (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getSectionActions(code)) !== null && _b !== void 0 ? _b : null;
|
|
2436
2448
|
}
|
|
2437
2449
|
getSectionActionNames(code) {
|
|
2438
|
-
var _a;
|
|
2439
|
-
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getSectionActionNames(code);
|
|
2450
|
+
var _a, _b;
|
|
2451
|
+
return (_b = (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getSectionActionNames(code)) !== null && _b !== void 0 ? _b : null;
|
|
2440
2452
|
}
|
|
2441
2453
|
getTables() {
|
|
2442
2454
|
var _a;
|
|
@@ -2455,8 +2467,8 @@ class BasicFormComponent {
|
|
|
2455
2467
|
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.cleanTables(codes);
|
|
2456
2468
|
}
|
|
2457
2469
|
getTable(code) {
|
|
2458
|
-
var _a;
|
|
2459
|
-
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getTable(code);
|
|
2470
|
+
var _a, _b;
|
|
2471
|
+
return (_b = (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getTable(code)) !== null && _b !== void 0 ? _b : null;
|
|
2460
2472
|
}
|
|
2461
2473
|
showTable(code) {
|
|
2462
2474
|
var _a;
|
|
@@ -2505,22 +2517,28 @@ class BasicFormComponent {
|
|
|
2505
2517
|
this._tableActionsFinish = {};
|
|
2506
2518
|
this._tableGetDataStart = {};
|
|
2507
2519
|
this._tableGetDataFinish = {};
|
|
2520
|
+
this._actionServerError = [];
|
|
2521
|
+
this._fieldServerError = [];
|
|
2522
|
+
this._tableServerError = [];
|
|
2523
|
+
this.onActionServerError(() => this.displayActionServerError());
|
|
2524
|
+
this.onValidationServerError(() => this.displayValidationServerError());
|
|
2525
|
+
this.onTableServerError(() => this.displayTableServerError());
|
|
2508
2526
|
}
|
|
2509
2527
|
get formVisible() { return this.visible; }
|
|
2510
2528
|
get formManager() { return this; }
|
|
2511
|
-
get formCode() { return this.name; }
|
|
2529
|
+
get formCode() { var _a; return (_a = this.name) !== null && _a !== void 0 ? _a : ''; }
|
|
2512
2530
|
set formCode(name) { this.name = name; }
|
|
2513
2531
|
get inServerProcess() { return this.busy; }
|
|
2514
2532
|
get form() { return this._formStructure; }
|
|
2515
|
-
get state() { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.state; }
|
|
2516
|
-
get currentState() { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.state; }
|
|
2517
|
-
set currentState(state) { this._formStructure.changeState(state); }
|
|
2533
|
+
get state() { var _a, _b; return (_b = (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.state) !== null && _b !== void 0 ? _b : null; }
|
|
2534
|
+
get currentState() { var _a, _b; return (_b = (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.state) !== null && _b !== void 0 ? _b : ''; }
|
|
2535
|
+
set currentState(state) { var _a; (_a = this === null || this === void 0 ? void 0 : this._formStructure) === null || _a === void 0 ? void 0 : _a.changeState(state); }
|
|
2518
2536
|
get immutableData() { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.immutableData; }
|
|
2519
2537
|
get extraInfo() { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.extraInfo; }
|
|
2520
|
-
get visibleSections() { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.visibleSections; }
|
|
2521
|
-
get formRoute() { return this._formRoute; }
|
|
2538
|
+
get visibleSections() { var _a, _b; return (_b = (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.visibleSections) !== null && _b !== void 0 ? _b : null; }
|
|
2539
|
+
get formRoute() { var _a; return (_a = this._formRoute) !== null && _a !== void 0 ? _a : ''; }
|
|
2522
2540
|
set formRoute(route) { this._formRoute = route; }
|
|
2523
|
-
get subject() { return this.formSubject; }
|
|
2541
|
+
get subject() { var _a; return (_a = this.formSubject) !== null && _a !== void 0 ? _a : ''; }
|
|
2524
2542
|
// Métodos virtuales
|
|
2525
2543
|
customPreProcessing() { }
|
|
2526
2544
|
customFormStart() { }
|
|
@@ -2561,11 +2579,11 @@ class BasicFormComponent {
|
|
|
2561
2579
|
/**
|
|
2562
2580
|
* @deprecated Use subject
|
|
2563
2581
|
*/
|
|
2564
|
-
getSubject() { return this.formSubject; }
|
|
2582
|
+
getSubject() { var _a; return (_a = this.formSubject) !== null && _a !== void 0 ? _a : ''; }
|
|
2565
2583
|
/**
|
|
2566
2584
|
* @deprecated Use subject
|
|
2567
2585
|
*/
|
|
2568
|
-
getformSubject() { return this.
|
|
2586
|
+
getformSubject() { var _a; return (_a = this.formSubject) !== null && _a !== void 0 ? _a : ''; }
|
|
2569
2587
|
numSections() { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.sections.length; }
|
|
2570
2588
|
subscribeAppEvent(eventName, callback) {
|
|
2571
2589
|
this._eventEmiter.subscribe(eventName, callback);
|
|
@@ -2590,7 +2608,7 @@ class BasicFormComponent {
|
|
|
2590
2608
|
canGoBack() { return this._originToken !== null; }
|
|
2591
2609
|
goBack() { return this.formManagerService.backTo(); }
|
|
2592
2610
|
goBackForm() { return this.goBack(); }
|
|
2593
|
-
getOriginDetail() { return this.formManagerService.getFormInfo(this._originToken); }
|
|
2611
|
+
getOriginDetail() { var _a, _b; return (_a = this.formManagerService) === null || _a === void 0 ? void 0 : _a.getFormInfo((_b = this._originToken) !== null && _b !== void 0 ? _b : ''); }
|
|
2594
2612
|
setError(errorType, errorMessage, errorDetail) {
|
|
2595
2613
|
this._errorType = errorType || '';
|
|
2596
2614
|
this.errorMessage = errorMessage || '';
|
|
@@ -2621,7 +2639,8 @@ class BasicFormComponent {
|
|
|
2621
2639
|
return null;
|
|
2622
2640
|
}
|
|
2623
2641
|
subscribeSectionActivation() {
|
|
2624
|
-
|
|
2642
|
+
var _a;
|
|
2643
|
+
const formSections = (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.sections;
|
|
2625
2644
|
const sectionNames = Object.keys(formSections);
|
|
2626
2645
|
for (let index = 0; index < sectionNames.length; index++) {
|
|
2627
2646
|
const sectionName = sectionNames[index];
|
|
@@ -2631,7 +2650,8 @@ class BasicFormComponent {
|
|
|
2631
2650
|
}
|
|
2632
2651
|
}
|
|
2633
2652
|
subscribeFieldsSubjects() {
|
|
2634
|
-
|
|
2653
|
+
var _a;
|
|
2654
|
+
const formFields = (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getFields();
|
|
2635
2655
|
if (Array.isArray(formFields)) {
|
|
2636
2656
|
formFields.forEach(field => {
|
|
2637
2657
|
field.editionFinish.subscribe(event => {
|
|
@@ -2647,7 +2667,8 @@ class BasicFormComponent {
|
|
|
2647
2667
|
}
|
|
2648
2668
|
}
|
|
2649
2669
|
subscribeActionSubjects() {
|
|
2650
|
-
|
|
2670
|
+
var _a;
|
|
2671
|
+
const formActions = (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getActions();
|
|
2651
2672
|
if (Array.isArray(formActions)) {
|
|
2652
2673
|
formActions.forEach(action => {
|
|
2653
2674
|
action.actionActivated.subscribe(code => this.startAction(code));
|
|
@@ -2655,7 +2676,8 @@ class BasicFormComponent {
|
|
|
2655
2676
|
}
|
|
2656
2677
|
}
|
|
2657
2678
|
subscribeTableSubjects() {
|
|
2658
|
-
|
|
2679
|
+
var _a;
|
|
2680
|
+
const formTables = (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getTables();
|
|
2659
2681
|
if (Array.isArray(formTables)) {
|
|
2660
2682
|
formTables.forEach(table => {
|
|
2661
2683
|
table.inlineActionTrigger.subscribe(event => this.startTableAction(event));
|
|
@@ -2667,7 +2689,7 @@ class BasicFormComponent {
|
|
|
2667
2689
|
}
|
|
2668
2690
|
}
|
|
2669
2691
|
formInit(params) {
|
|
2670
|
-
var _a;
|
|
2692
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
2671
2693
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2672
2694
|
let initialState = this.preocessInputParams(params);
|
|
2673
2695
|
if (!this.name) {
|
|
@@ -2678,18 +2700,18 @@ class BasicFormComponent {
|
|
|
2678
2700
|
const formDefinition = yield this.formManagerService.getFormDefinition(this.name);
|
|
2679
2701
|
this.busy = false;
|
|
2680
2702
|
this._formStructure = new FormStructureAndData(formDefinition, this.formConfig);
|
|
2681
|
-
this.fields = this._formStructure.fields;
|
|
2682
|
-
this.actions = this._formStructure.actions;
|
|
2683
|
-
this.sections = this._formStructure.sections;
|
|
2703
|
+
this.fields = (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.fields;
|
|
2704
|
+
this.actions = (_b = this._formStructure) === null || _b === void 0 ? void 0 : _b.actions;
|
|
2705
|
+
this.sections = (_c = this._formStructure) === null || _c === void 0 ? void 0 : _c.sections;
|
|
2684
2706
|
this._definitionObtained = true;
|
|
2685
2707
|
}
|
|
2686
2708
|
else {
|
|
2687
2709
|
this.cleanData();
|
|
2688
2710
|
}
|
|
2689
2711
|
if (!this.supportState(initialState)) {
|
|
2690
|
-
initialState = this._formStructure.defaultState;
|
|
2712
|
+
initialState = (_e = (_d = this._formStructure) === null || _d === void 0 ? void 0 : _d.defaultState) !== null && _e !== void 0 ? _e : null;
|
|
2691
2713
|
}
|
|
2692
|
-
this._formStructure.changeState(initialState || this._formStructure.defaultState);
|
|
2714
|
+
(_f = this._formStructure) === null || _f === void 0 ? void 0 : _f.changeState(initialState || ((_g = this._formStructure) === null || _g === void 0 ? void 0 : _g.defaultState));
|
|
2693
2715
|
const inputFieldNames = Object.keys(this.inputDataFields);
|
|
2694
2716
|
for (let index = 0; index < inputFieldNames.length; index++) {
|
|
2695
2717
|
const fieldCode = inputFieldNames[index];
|
|
@@ -2699,7 +2721,7 @@ class BasicFormComponent {
|
|
|
2699
2721
|
const recordResponse = yield this.requestFormAction(formActions.getData);
|
|
2700
2722
|
this.checkErrorRecordReceived(recordResponse);
|
|
2701
2723
|
this.visible = true;
|
|
2702
|
-
this.enabledSections = (
|
|
2724
|
+
this.enabledSections = (_j = (_h = this._formStructure) === null || _h === void 0 ? void 0 : _h.visibleSections) !== null && _j !== void 0 ? _j : [];
|
|
2703
2725
|
this.subscribeSectionActivation();
|
|
2704
2726
|
this.subscribeFieldsSubjects();
|
|
2705
2727
|
this.subscribeActionSubjects();
|
|
@@ -2724,16 +2746,17 @@ class BasicFormComponent {
|
|
|
2724
2746
|
* Soporte manejo de eventos de formulario
|
|
2725
2747
|
*/
|
|
2726
2748
|
requestFormAction(actionCode, actionSubject = {}) {
|
|
2749
|
+
var _a, _b, _c;
|
|
2727
2750
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2728
2751
|
const actionDetail = {
|
|
2729
2752
|
formCode: this.name,
|
|
2730
2753
|
formSubject: this.formSubject,
|
|
2731
|
-
currentMode: this._formStructure.state,
|
|
2754
|
+
currentMode: (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.state,
|
|
2732
2755
|
actionCode,
|
|
2733
2756
|
actionSubject,
|
|
2734
2757
|
version: PAYLOAD_VERSION,
|
|
2735
|
-
formData: this._formStructure.getPayload(),
|
|
2736
|
-
immutableData: this._formStructure.immutableData,
|
|
2758
|
+
formData: (_b = this._formStructure) === null || _b === void 0 ? void 0 : _b.getPayload(),
|
|
2759
|
+
immutableData: (_c = this._formStructure) === null || _c === void 0 ? void 0 : _c.immutableData,
|
|
2737
2760
|
};
|
|
2738
2761
|
this.errorCode = NO_ERROR;
|
|
2739
2762
|
this.errorMessage = '';
|
|
@@ -2788,13 +2811,36 @@ class BasicFormComponent {
|
|
|
2788
2811
|
if (returnedFile && returnedFile.file) {
|
|
2789
2812
|
this.fileMgmtServices.saveFile(returnedFile.file, returnedFile.name, returnedFile.type);
|
|
2790
2813
|
}
|
|
2791
|
-
this._formStructure
|
|
2792
|
-
|
|
2814
|
+
if (this._formStructure) {
|
|
2815
|
+
this._formStructure.immutableData = immutableData;
|
|
2816
|
+
this._formStructure.extraInfo = extraInfo;
|
|
2817
|
+
}
|
|
2818
|
+
}
|
|
2819
|
+
/**
|
|
2820
|
+
* Manejo de event handlers para errores Server del formulario
|
|
2821
|
+
*/
|
|
2822
|
+
cleanActionServerError() {
|
|
2823
|
+
this._actionServerError = [];
|
|
2824
|
+
}
|
|
2825
|
+
cleanFieldServerError() {
|
|
2826
|
+
this._fieldServerError = [];
|
|
2827
|
+
}
|
|
2828
|
+
cleanTableServerError() {
|
|
2829
|
+
this._tableServerError = [];
|
|
2830
|
+
}
|
|
2831
|
+
onActionServerError(callback, properties = null) {
|
|
2832
|
+
this._actionServerError.push({ callback, properties });
|
|
2833
|
+
}
|
|
2834
|
+
onValidationServerError(callback, properties = null) {
|
|
2835
|
+
this._fieldServerError.push({ callback, properties });
|
|
2836
|
+
}
|
|
2837
|
+
onTableServerError(callback, properties = null) {
|
|
2838
|
+
this._tableServerError.push({ callback, properties });
|
|
2793
2839
|
}
|
|
2794
2840
|
/**
|
|
2795
2841
|
* Manejo de event handlers para acciones sobre el formulario
|
|
2796
2842
|
*/
|
|
2797
|
-
|
|
2843
|
+
onSectionActivation(codes, callback, properties = null) {
|
|
2798
2844
|
const sectionSet = (Array.isArray(codes)) ? codes : (codes ? [codes] : []);
|
|
2799
2845
|
sectionSet.forEach((sectionName) => {
|
|
2800
2846
|
if (!this._formSectionsActivate[sectionName]) {
|
|
@@ -2803,7 +2849,7 @@ class BasicFormComponent {
|
|
|
2803
2849
|
this._formSectionsActivate[sectionName].push({ callback, properties });
|
|
2804
2850
|
});
|
|
2805
2851
|
}
|
|
2806
|
-
|
|
2852
|
+
onSectionInactivation(codes, callback, properties = null) {
|
|
2807
2853
|
const sectionSet = (Array.isArray(codes)) ? codes : (codes ? [codes] : []);
|
|
2808
2854
|
sectionSet.forEach((sectionName) => {
|
|
2809
2855
|
if (!this._formSectionsInactivate[sectionName]) {
|
|
@@ -2812,7 +2858,7 @@ class BasicFormComponent {
|
|
|
2812
2858
|
this._formSectionsInactivate[sectionName].push({ callback, properties });
|
|
2813
2859
|
});
|
|
2814
2860
|
}
|
|
2815
|
-
|
|
2861
|
+
onActionStart(codes, callback, properties = null) {
|
|
2816
2862
|
const actionSet = (Array.isArray(codes)) ? codes : (codes ? [codes] : []);
|
|
2817
2863
|
actionSet.forEach((actionName) => {
|
|
2818
2864
|
if (!this._formActionsStart[actionName]) {
|
|
@@ -2821,7 +2867,7 @@ class BasicFormComponent {
|
|
|
2821
2867
|
this._formActionsStart[actionName].push({ callback, properties });
|
|
2822
2868
|
});
|
|
2823
2869
|
}
|
|
2824
|
-
|
|
2870
|
+
onActionFinish(codes, callback, properties = null) {
|
|
2825
2871
|
const actionSet = (Array.isArray(codes)) ? codes : (codes ? [codes] : []);
|
|
2826
2872
|
actionSet.forEach((actionName) => {
|
|
2827
2873
|
if (!this._formActionsFinish[actionName]) {
|
|
@@ -2831,8 +2877,9 @@ class BasicFormComponent {
|
|
|
2831
2877
|
});
|
|
2832
2878
|
}
|
|
2833
2879
|
launchSectionActivation(code) {
|
|
2880
|
+
var _a;
|
|
2834
2881
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2835
|
-
const sectionObject = this._formStructure.getSection(code);
|
|
2882
|
+
const sectionObject = (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getSection(code);
|
|
2836
2883
|
if (!sectionObject) {
|
|
2837
2884
|
return;
|
|
2838
2885
|
}
|
|
@@ -2846,8 +2893,9 @@ class BasicFormComponent {
|
|
|
2846
2893
|
});
|
|
2847
2894
|
}
|
|
2848
2895
|
launchSectionInactivation(code) {
|
|
2896
|
+
var _a;
|
|
2849
2897
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2850
|
-
const sectionObject = this._formStructure.getSection(code);
|
|
2898
|
+
const sectionObject = (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getSection(code);
|
|
2851
2899
|
if (!sectionObject) {
|
|
2852
2900
|
return;
|
|
2853
2901
|
}
|
|
@@ -2901,7 +2949,10 @@ class BasicFormComponent {
|
|
|
2901
2949
|
action.newState && this.changeState(action.newState);
|
|
2902
2950
|
}
|
|
2903
2951
|
else {
|
|
2904
|
-
this.
|
|
2952
|
+
for (let index = 0; index < this._actionServerError.length; index++) {
|
|
2953
|
+
const { callback, properties } = this._actionServerError[index];
|
|
2954
|
+
callback(action);
|
|
2955
|
+
}
|
|
2905
2956
|
}
|
|
2906
2957
|
action.stop();
|
|
2907
2958
|
});
|
|
@@ -2929,7 +2980,7 @@ class BasicFormComponent {
|
|
|
2929
2980
|
/**
|
|
2930
2981
|
* Manejadores de eventos para validaciones sobre campos
|
|
2931
2982
|
*/
|
|
2932
|
-
|
|
2983
|
+
onFieldInput(codes, callback, properties = null) {
|
|
2933
2984
|
const fieldSet = (Array.isArray(codes)) ? codes : (codes ? [codes] : []);
|
|
2934
2985
|
fieldSet.forEach((fieldCode) => {
|
|
2935
2986
|
if (!this._fieldInputValidation[fieldCode]) {
|
|
@@ -2938,7 +2989,7 @@ class BasicFormComponent {
|
|
|
2938
2989
|
this._fieldInputValidation[fieldCode].push({ callback, properties });
|
|
2939
2990
|
});
|
|
2940
2991
|
}
|
|
2941
|
-
|
|
2992
|
+
onFieldValidationStart(codes, callback, properties = null) {
|
|
2942
2993
|
const fieldSet = (Array.isArray(codes)) ? codes : (codes ? [codes] : []);
|
|
2943
2994
|
fieldSet.forEach((fieldCode) => {
|
|
2944
2995
|
if (!this._fieldValidationsStart[fieldCode]) {
|
|
@@ -2947,7 +2998,7 @@ class BasicFormComponent {
|
|
|
2947
2998
|
this._fieldValidationsStart[fieldCode].push({ callback, properties });
|
|
2948
2999
|
});
|
|
2949
3000
|
}
|
|
2950
|
-
|
|
3001
|
+
onFieldValidationFinish(codes, callback, properties = null) {
|
|
2951
3002
|
const fieldSet = (Array.isArray(codes)) ? codes : (codes ? [codes] : []);
|
|
2952
3003
|
fieldSet.forEach((fieldCode) => {
|
|
2953
3004
|
if (!this._fieldValidationsFinish[fieldCode]) {
|
|
@@ -3008,6 +3059,9 @@ class BasicFormComponent {
|
|
|
3008
3059
|
? this.getField(inputField) : inputField;
|
|
3009
3060
|
let serverError = false;
|
|
3010
3061
|
let validationResult = true;
|
|
3062
|
+
if (!fieldObj) {
|
|
3063
|
+
return;
|
|
3064
|
+
}
|
|
3011
3065
|
if (fieldObj.backend) {
|
|
3012
3066
|
fieldObj.validating = true;
|
|
3013
3067
|
validationResult = yield this
|
|
@@ -3016,9 +3070,12 @@ class BasicFormComponent {
|
|
|
3016
3070
|
}
|
|
3017
3071
|
yield this.finishFieldValidation(fieldObj, validationResult, serverError);
|
|
3018
3072
|
if (serverError) {
|
|
3019
|
-
fieldObj.setErrorCode(this.errorCode);
|
|
3020
|
-
fieldObj.setErrorMessage(this.errorMessage);
|
|
3021
|
-
this.
|
|
3073
|
+
fieldObj === null || fieldObj === void 0 ? void 0 : fieldObj.setErrorCode(this.errorCode);
|
|
3074
|
+
fieldObj === null || fieldObj === void 0 ? void 0 : fieldObj.setErrorMessage(this.errorMessage);
|
|
3075
|
+
for (let index = 0; index < this._fieldServerError.length; index++) {
|
|
3076
|
+
const { callback, properties } = this._fieldServerError[index];
|
|
3077
|
+
callback(fieldObj);
|
|
3078
|
+
}
|
|
3022
3079
|
}
|
|
3023
3080
|
fieldObj.validating = false;
|
|
3024
3081
|
});
|
|
@@ -3048,7 +3105,7 @@ class BasicFormComponent {
|
|
|
3048
3105
|
/**
|
|
3049
3106
|
* Manejadores de eventos para acciones sobre Tablas
|
|
3050
3107
|
*/
|
|
3051
|
-
|
|
3108
|
+
onTableActionStart(code, actionCode, callback, properties = null) {
|
|
3052
3109
|
const tableObject = this.getTable(code);
|
|
3053
3110
|
if (!tableObject) {
|
|
3054
3111
|
return;
|
|
@@ -3070,7 +3127,7 @@ class BasicFormComponent {
|
|
|
3070
3127
|
}
|
|
3071
3128
|
tableEventHandlers[actionCode].push({ callback, properties });
|
|
3072
3129
|
}
|
|
3073
|
-
|
|
3130
|
+
onTableActionFinish(code, actionCode, callback, properties = null) {
|
|
3074
3131
|
const tableObject = this.getTable(code);
|
|
3075
3132
|
if (!tableObject) {
|
|
3076
3133
|
return;
|
|
@@ -3092,7 +3149,7 @@ class BasicFormComponent {
|
|
|
3092
3149
|
}
|
|
3093
3150
|
tableEventHandlers[actionCode].push({ callback, properties });
|
|
3094
3151
|
}
|
|
3095
|
-
|
|
3152
|
+
onTableSelectionStart(code, callback, properties = null) {
|
|
3096
3153
|
const tableObject = this.getTable(code);
|
|
3097
3154
|
if (!tableObject) {
|
|
3098
3155
|
return;
|
|
@@ -3107,7 +3164,7 @@ class BasicFormComponent {
|
|
|
3107
3164
|
}
|
|
3108
3165
|
tableEventHandlers.push({ callback, properties });
|
|
3109
3166
|
}
|
|
3110
|
-
|
|
3167
|
+
onTableSelectionFinish(code, callback, properties = null) {
|
|
3111
3168
|
const tableObject = this.getTable(code);
|
|
3112
3169
|
if (!tableObject) {
|
|
3113
3170
|
return;
|
|
@@ -3122,7 +3179,7 @@ class BasicFormComponent {
|
|
|
3122
3179
|
}
|
|
3123
3180
|
tableEventHandlers.push({ callback, properties });
|
|
3124
3181
|
}
|
|
3125
|
-
|
|
3182
|
+
onTableGetDataStart(code, callback, properties = null) {
|
|
3126
3183
|
const tableObject = this.getTable(code);
|
|
3127
3184
|
if (!tableObject) {
|
|
3128
3185
|
return;
|
|
@@ -3137,7 +3194,7 @@ class BasicFormComponent {
|
|
|
3137
3194
|
}
|
|
3138
3195
|
tableEventHandlers.push({ callback, properties });
|
|
3139
3196
|
}
|
|
3140
|
-
|
|
3197
|
+
onTableGetDataFinish(code, callback, properties = null) {
|
|
3141
3198
|
const tableObject = this.getTable(code);
|
|
3142
3199
|
if (!tableObject) {
|
|
3143
3200
|
return;
|
|
@@ -3212,7 +3269,10 @@ class BasicFormComponent {
|
|
|
3212
3269
|
action.newState && this.changeState(action.newState);
|
|
3213
3270
|
}
|
|
3214
3271
|
else {
|
|
3215
|
-
this.
|
|
3272
|
+
for (let index = 0; index < this._tableServerError.length; index++) {
|
|
3273
|
+
const { callback, properties } = this._tableServerError[index];
|
|
3274
|
+
callback(tableObject);
|
|
3275
|
+
}
|
|
3216
3276
|
}
|
|
3217
3277
|
tableObject.freeWaiting();
|
|
3218
3278
|
});
|
|
@@ -3561,6 +3621,7 @@ class BasicFormComponent {
|
|
|
3561
3621
|
return (numErrors === 0);
|
|
3562
3622
|
}
|
|
3563
3623
|
validateSectionConsistency(sectionCode, reqFieldMessage) {
|
|
3624
|
+
var _a, _b;
|
|
3564
3625
|
this.resetError();
|
|
3565
3626
|
const completeFields = this.checkSectionRequiredFields(sectionCode, reqFieldMessage);
|
|
3566
3627
|
if (!completeFields) {
|
|
@@ -3568,8 +3629,8 @@ class BasicFormComponent {
|
|
|
3568
3629
|
return false;
|
|
3569
3630
|
}
|
|
3570
3631
|
let validationError = false;
|
|
3571
|
-
const requiredEmptyFields = this.getRequiredEmptyFields(null, sectionCode);
|
|
3572
|
-
if (requiredEmptyFields.length > 0) {
|
|
3632
|
+
const requiredEmptyFields = (_a = this.getRequiredEmptyFields(null, sectionCode)) !== null && _a !== void 0 ? _a : [];
|
|
3633
|
+
if ((requiredEmptyFields === null || requiredEmptyFields === void 0 ? void 0 : requiredEmptyFields.length) > 0) {
|
|
3573
3634
|
validationError = true;
|
|
3574
3635
|
this.setError(this.formConfig.formStandardErrors.typeWarning, this.formConfig.formStandardErrors.validationTitle, this.formConfig.formStandardErrors.requiredFields);
|
|
3575
3636
|
this.tagFieldsWithError(this.formConfig.formStandardErrors.requiredField, requiredEmptyFields);
|
|
@@ -3579,13 +3640,15 @@ class BasicFormComponent {
|
|
|
3579
3640
|
break;
|
|
3580
3641
|
}
|
|
3581
3642
|
}
|
|
3582
|
-
const validationIssueFields = this.getFieldsWithValidationIssues(null, sectionCode);
|
|
3643
|
+
const validationIssueFields = (_b = this.getFieldsWithValidationIssues(null, sectionCode)) !== null && _b !== void 0 ? _b : [];
|
|
3583
3644
|
if (!validationError && validationIssueFields.length > 0) {
|
|
3584
3645
|
validationError = true;
|
|
3585
3646
|
this.setError(this.formConfig.formStandardErrors.typeWarning, this.formConfig.formStandardErrors.validationTitle, this.formConfig.formStandardErrors.validationFields);
|
|
3586
3647
|
for (const fieldCode of validationIssueFields) {
|
|
3587
3648
|
const validationIssueField = this.getField(fieldCode);
|
|
3588
|
-
validationIssueField
|
|
3649
|
+
if (validationIssueField) {
|
|
3650
|
+
validationIssueField.focus();
|
|
3651
|
+
}
|
|
3589
3652
|
break;
|
|
3590
3653
|
}
|
|
3591
3654
|
}
|
|
@@ -3594,14 +3657,59 @@ class BasicFormComponent {
|
|
|
3594
3657
|
copyTableRecordToFields(tableObj, mappingTable = null) {
|
|
3595
3658
|
var _a, _b;
|
|
3596
3659
|
const tableObject = this.getTable(tableObj.tableCode);
|
|
3597
|
-
const tableRecord = tableObject.getTableRecord(tableObj.recordId);
|
|
3598
|
-
const columnNames = tableObject.columnNames;
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3660
|
+
const tableRecord = tableObject === null || tableObject === void 0 ? void 0 : tableObject.getTableRecord(tableObj.recordId);
|
|
3661
|
+
const columnNames = tableObject === null || tableObject === void 0 ? void 0 : tableObject.columnNames;
|
|
3662
|
+
if (tableRecord && columnNames) {
|
|
3663
|
+
for (const columnName of columnNames) {
|
|
3664
|
+
const columnValue = (_a = tableRecord.getFieldValue(columnName)) !== null && _a !== void 0 ? _a : '';
|
|
3665
|
+
const fieldCode = (_b = mappingTable === null || mappingTable === void 0 ? void 0 : mappingTable[columnName]) !== null && _b !== void 0 ? _b : columnName;
|
|
3666
|
+
this.setFieldValue(fieldCode, columnValue);
|
|
3667
|
+
}
|
|
3668
|
+
return true;
|
|
3603
3669
|
}
|
|
3604
|
-
return
|
|
3670
|
+
return false;
|
|
3671
|
+
}
|
|
3672
|
+
/**
|
|
3673
|
+
* Métodos Legacy de compatibilidad hacia atrás
|
|
3674
|
+
*/
|
|
3675
|
+
addSectionActivation(codes, callback, properties = null) {
|
|
3676
|
+
return this.onSectionActivation(codes, callback, properties);
|
|
3677
|
+
}
|
|
3678
|
+
addSectionInactivation(codes, callback, properties = null) {
|
|
3679
|
+
return this.onSectionInactivation(codes, callback, properties);
|
|
3680
|
+
}
|
|
3681
|
+
addActionMethodStart(codes, callback, properties = null) {
|
|
3682
|
+
return this.onActionStart(codes, callback, properties);
|
|
3683
|
+
}
|
|
3684
|
+
addActionMethodFinish(codes, callback, properties = null) {
|
|
3685
|
+
return this.onActionFinish(codes, callback, properties);
|
|
3686
|
+
}
|
|
3687
|
+
addFieldInputValidation(codes, callback, properties = null) {
|
|
3688
|
+
return this.onFieldInput(codes, callback, properties);
|
|
3689
|
+
}
|
|
3690
|
+
addFieldValidationStart(codes, callback, properties = null) {
|
|
3691
|
+
return this.onFieldValidationStart(codes, callback, properties);
|
|
3692
|
+
}
|
|
3693
|
+
addFieldValidationFinish(codes, callback, properties = null) {
|
|
3694
|
+
return this.onFieldValidationFinish(codes, callback, properties);
|
|
3695
|
+
}
|
|
3696
|
+
addTableActionStart(code, actionCode, callback, properties = null) {
|
|
3697
|
+
return this.onTableActionStart(code, actionCode, callback, properties);
|
|
3698
|
+
}
|
|
3699
|
+
addTableActionFinish(code, actionCode, callback, properties = null) {
|
|
3700
|
+
return this.onTableActionFinish(code, actionCode, callback, properties);
|
|
3701
|
+
}
|
|
3702
|
+
addTableSelectionStart(code, callback, properties = null) {
|
|
3703
|
+
return this.onTableSelectionStart(code, callback, properties);
|
|
3704
|
+
}
|
|
3705
|
+
addTableSelectionFinish(code, callback, properties = null) {
|
|
3706
|
+
return this.onTableSelectionFinish(code, callback, properties);
|
|
3707
|
+
}
|
|
3708
|
+
addTableGetDataStart(code, callback, properties = null) {
|
|
3709
|
+
return this.onTableGetDataStart(code, callback, properties);
|
|
3710
|
+
}
|
|
3711
|
+
addTableGetDataFinish(code, callback, properties = null) {
|
|
3712
|
+
return this.onTableGetDataFinish(code, callback, properties);
|
|
3605
3713
|
}
|
|
3606
3714
|
}
|
|
3607
3715
|
BasicFormComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.1", ngImport: i0, type: BasicFormComponent, deps: [{ token: LibFormManagerService }, { token: LibEventManagerService }, { token: LibFileManagementService }], target: i0.ɵɵFactoryTarget.Component });
|