@apia/execution 4.0.42 → 4.0.44
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/dist/index.d.ts +100 -88
- package/dist/index.js +323 -176
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -4,12 +4,13 @@ import xml2js from 'xml2js';
|
|
|
4
4
|
import he from 'he';
|
|
5
5
|
import { parseBooleans, parseNumbers } from 'xml2js/lib/processors';
|
|
6
6
|
import QueryString from 'qs';
|
|
7
|
-
import { arrayOrArray, EventEmitter as EventEmitter$1, isTrue, toBoolean, downloadUrl, addBoundary, formatMessage, parseAsSize, shallowEqual as shallowEqual$1, Mutex,
|
|
7
|
+
import { arrayOrArray, EventEmitter as EventEmitter$1, isTrue, toBoolean, downloadUrl, addBoundary, formatMessage, parseAsSize, shallowEqual as shallowEqual$1, Mutex, noNaN as noNaN$1, getDateFormat, decodeBase64ToUtf8 as decodeBase64ToUtf8$1, encodeStrToBase64Utf8, uniqueId, parseXMLRequestResponse, Url, postNavigation } from '@apia/util';
|
|
8
8
|
import { Cell, TableController, Row, FocusControllerPlugin } from '@apia/table2-controller';
|
|
9
9
|
import dayjs from 'dayjs';
|
|
10
10
|
import customParseFormat from 'dayjs/plugin/customParseFormat';
|
|
11
11
|
import { MobXTree } from '@apia/tree2-controller';
|
|
12
12
|
import { Scheduler } from '@apia/scheduler-controller';
|
|
13
|
+
export { Scheduler } from '@apia/scheduler-controller';
|
|
13
14
|
|
|
14
15
|
const deepEqual = (a, b) => {
|
|
15
16
|
if (Object.is(a, b))
|
|
@@ -403,44 +404,63 @@ function replaceLabelHtmlValues(o) {
|
|
|
403
404
|
}
|
|
404
405
|
return o;
|
|
405
406
|
}
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
407
|
+
function customBooleanProcessor(value, name) {
|
|
408
|
+
if (name === "value")
|
|
409
|
+
return value;
|
|
410
|
+
return parseBooleans(value);
|
|
411
|
+
}
|
|
412
|
+
function getDefaultXmlParserOptions(behaveConfig) {
|
|
413
|
+
return {
|
|
414
|
+
trim: true,
|
|
415
|
+
normalize: true,
|
|
414
416
|
explicitRoot: false,
|
|
415
417
|
mergeAttrs: true,
|
|
416
418
|
explicitArray: false,
|
|
417
419
|
charkey: "label",
|
|
418
420
|
attrValueProcessors: [
|
|
419
|
-
|
|
421
|
+
customBooleanProcessor,
|
|
420
422
|
processStringObj,
|
|
421
423
|
processAjaxEventResponse
|
|
422
424
|
],
|
|
423
425
|
tagNameProcessors: [processAjaxEventTagNames],
|
|
424
426
|
attrNameProcessors: [processAjaxEventAttrNames]
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
if (
|
|
434
|
-
|
|
427
|
+
};
|
|
428
|
+
}
|
|
429
|
+
function getDefaultXmlPostProcessor() {
|
|
430
|
+
return (xml, parser) => {
|
|
431
|
+
let objJS;
|
|
432
|
+
parser.parseString(
|
|
433
|
+
xml,
|
|
434
|
+
(err, result) => {
|
|
435
|
+
if (err) {
|
|
436
|
+
console.warn("Error Parsing XML data", err);
|
|
437
|
+
objJS = err;
|
|
438
|
+
} else {
|
|
439
|
+
if (result?.code === "-1" && result.exceptions) {
|
|
440
|
+
throw new InvalidSessionException();
|
|
441
|
+
}
|
|
442
|
+
objJS = result;
|
|
435
443
|
}
|
|
436
|
-
objJS = result;
|
|
437
444
|
}
|
|
445
|
+
);
|
|
446
|
+
if (objJS) {
|
|
447
|
+
return typeof objJS === "object" && objJS ? replaceLabelHtmlValues(objJS) : objJS;
|
|
438
448
|
}
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
449
|
+
return {};
|
|
450
|
+
};
|
|
451
|
+
}
|
|
452
|
+
function getDefaultXmlParser(behaveConfig) {
|
|
453
|
+
return (xml, _behaveConfig) => {
|
|
454
|
+
const parser = new xml2js.Parser(getDefaultXmlParserOptions());
|
|
455
|
+
return getDefaultXmlPostProcessor()(xml, parser);
|
|
456
|
+
};
|
|
457
|
+
}
|
|
458
|
+
const parseXml = (xml, behaveConfig) => {
|
|
459
|
+
if (typeof xml === "object" && !(xml instanceof XMLDocument)) {
|
|
460
|
+
return xml;
|
|
442
461
|
}
|
|
443
|
-
|
|
462
|
+
const parser = behaveConfig?.xmlParser ?? getDefaultXmlParser();
|
|
463
|
+
return parser(xml, behaveConfig);
|
|
444
464
|
};
|
|
445
465
|
|
|
446
466
|
function getWindow(execution) {
|
|
@@ -891,7 +911,7 @@ class BouncingEmitter extends StatefulEmitter {
|
|
|
891
911
|
}
|
|
892
912
|
|
|
893
913
|
function getLabel(execution, label, replacers) {
|
|
894
|
-
const original = getWindow(execution)
|
|
914
|
+
const original = getWindow(execution)?.labels?.[label];
|
|
895
915
|
if (!original) {
|
|
896
916
|
return {
|
|
897
917
|
text: `LblNotPrealoded: ${label}`,
|
|
@@ -1381,6 +1401,11 @@ class Field extends WithProperties {
|
|
|
1381
1401
|
try {
|
|
1382
1402
|
let result = await this.fireScriptEvent(eventName);
|
|
1383
1403
|
if (result) {
|
|
1404
|
+
try {
|
|
1405
|
+
await this.form.execution.waitForPendingSyncs();
|
|
1406
|
+
} catch (e) {
|
|
1407
|
+
console.warn("waitForPendingSyncs failed or timed out", e);
|
|
1408
|
+
}
|
|
1384
1409
|
result = await this.fireServerEvent(eventName, params);
|
|
1385
1410
|
}
|
|
1386
1411
|
return result;
|
|
@@ -1641,13 +1666,7 @@ class FieldWithAttribute extends Field {
|
|
|
1641
1666
|
async getInitialValue({
|
|
1642
1667
|
value
|
|
1643
1668
|
}) {
|
|
1644
|
-
|
|
1645
|
-
return this.state.value = "";
|
|
1646
|
-
} else if (typeof value === "boolean") {
|
|
1647
|
-
return this.state.value = String(value);
|
|
1648
|
-
} else {
|
|
1649
|
-
return this.state.value = value;
|
|
1650
|
-
}
|
|
1669
|
+
return value;
|
|
1651
1670
|
}
|
|
1652
1671
|
getValidationState() {
|
|
1653
1672
|
return this.state.validation;
|
|
@@ -1672,7 +1691,10 @@ class FieldWithAttribute extends Field {
|
|
|
1672
1691
|
if (options?.markAsDirty !== false) {
|
|
1673
1692
|
this.form.execution.state.hasChangedAnything = true;
|
|
1674
1693
|
}
|
|
1675
|
-
|
|
1694
|
+
if (options?.fireEvents !== false) {
|
|
1695
|
+
return this.fireEvent("onChange", { force: options?.force });
|
|
1696
|
+
}
|
|
1697
|
+
return true;
|
|
1676
1698
|
}
|
|
1677
1699
|
return Promise.resolve(false);
|
|
1678
1700
|
});
|
|
@@ -1711,40 +1733,50 @@ class FieldWithAttribute extends Field {
|
|
|
1711
1733
|
async synchronize(newValue) {
|
|
1712
1734
|
if (newValue === this.lastSynchronizationValue)
|
|
1713
1735
|
return true;
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1736
|
+
const syncPromise = (async () => {
|
|
1737
|
+
try {
|
|
1738
|
+
const postData = this.getSynchronizePostConfiguration(newValue);
|
|
1739
|
+
const response = await asyncRetry(
|
|
1740
|
+
async () => {
|
|
1741
|
+
try {
|
|
1742
|
+
const res = await post(
|
|
1743
|
+
this.form.execution,
|
|
1744
|
+
await this.getSynchronizeUrl(),
|
|
1745
|
+
postData
|
|
1746
|
+
);
|
|
1747
|
+
return res;
|
|
1748
|
+
} catch (e) {
|
|
1749
|
+
this.form.execution.notifications.add(
|
|
1750
|
+
new MessageNotification({ message: String(e) })
|
|
1751
|
+
);
|
|
1752
|
+
return null;
|
|
1753
|
+
}
|
|
1754
|
+
},
|
|
1755
|
+
(result2) => {
|
|
1756
|
+
const success = !!result2?.data?.success;
|
|
1757
|
+
return success;
|
|
1758
|
+
},
|
|
1759
|
+
{ retries: 10, timeout: 500 }
|
|
1760
|
+
);
|
|
1761
|
+
const result = response?.data?.success || false;
|
|
1762
|
+
if (result) {
|
|
1763
|
+
this.lastSynchronizationValue = newValue;
|
|
1764
|
+
this.state.validation.dirty = false;
|
|
1765
|
+
return true;
|
|
1766
|
+
}
|
|
1767
|
+
} catch (e) {
|
|
1768
|
+
console.error("synchronize error:", e);
|
|
1769
|
+
this.processSynchronizeError(e);
|
|
1738
1770
|
}
|
|
1739
|
-
|
|
1740
|
-
|
|
1771
|
+
return false;
|
|
1772
|
+
})();
|
|
1773
|
+
try {
|
|
1774
|
+
this.form.execution.addPendingPromise(syncPromise);
|
|
1775
|
+
} catch {
|
|
1741
1776
|
}
|
|
1742
|
-
return
|
|
1777
|
+
return await syncPromise;
|
|
1743
1778
|
}
|
|
1744
1779
|
hasValue() {
|
|
1745
|
-
return this.getValue() !== "";
|
|
1746
|
-
}
|
|
1747
|
-
isValidValue() {
|
|
1748
1780
|
return !!this.getValue();
|
|
1749
1781
|
}
|
|
1750
1782
|
async validate() {
|
|
@@ -1754,7 +1786,7 @@ class FieldWithAttribute extends Field {
|
|
|
1754
1786
|
return false;
|
|
1755
1787
|
}
|
|
1756
1788
|
}
|
|
1757
|
-
const isValid = isFieldShowAsText(this) || this.
|
|
1789
|
+
const isValid = isFieldShowAsText(this) || this.hasValue() || !this.properties.required || this.properties.visibilityHidden || this.properties.disabled;
|
|
1758
1790
|
this.state.validation.errorMessage = isValid ? null : labels.errorFieldRequired(this.form.execution);
|
|
1759
1791
|
return !this.state.validation.errorMessage;
|
|
1760
1792
|
}
|
|
@@ -1790,7 +1822,10 @@ class Checkbox extends FieldWithAttribute {
|
|
|
1790
1822
|
getInitialValue({
|
|
1791
1823
|
value
|
|
1792
1824
|
}) {
|
|
1793
|
-
|
|
1825
|
+
if (value === "" || value === void 0) {
|
|
1826
|
+
return Promise.resolve(false);
|
|
1827
|
+
}
|
|
1828
|
+
return Promise.resolve(toBoolean(value));
|
|
1794
1829
|
}
|
|
1795
1830
|
}
|
|
1796
1831
|
|
|
@@ -2003,8 +2038,8 @@ class Editor extends TranslatableField {
|
|
|
2003
2038
|
fireEvent(eventName, options) {
|
|
2004
2039
|
return super.fireEvent(eventName, options);
|
|
2005
2040
|
}
|
|
2006
|
-
|
|
2007
|
-
return !!
|
|
2041
|
+
hasValue() {
|
|
2042
|
+
return !!String(this.getValue()).trim();
|
|
2008
2043
|
}
|
|
2009
2044
|
getSynchronizePostConfiguration(value) {
|
|
2010
2045
|
const conf = super.getSynchronizePostConfiguration(value);
|
|
@@ -2329,6 +2364,7 @@ class UploaderApi extends EventEmitter$1 {
|
|
|
2329
2364
|
translatedFiles: /* @__PURE__ */ new Map(),
|
|
2330
2365
|
hasAllDocTypes: false
|
|
2331
2366
|
});
|
|
2367
|
+
__publicField$i(this, "getCheckSignatureParameters", returnExactlyTheSame);
|
|
2332
2368
|
__publicField$i(this, "getAjaxUploadFileStatusParameters", returnExactlyTheSame);
|
|
2333
2369
|
__publicField$i(this, "getAjaxUploadStartParameters", returnExactlyTheSame);
|
|
2334
2370
|
__publicField$i(this, "getConfirmDropModalParameters", returnExactlyTheSame);
|
|
@@ -2560,6 +2596,7 @@ class UploaderApi extends EventEmitter$1 {
|
|
|
2560
2596
|
this.modalController.state.isReadonly = false;
|
|
2561
2597
|
}
|
|
2562
2598
|
this.state.inProgressFiles = [];
|
|
2599
|
+
this.state.versioningFile = null;
|
|
2563
2600
|
this.state.hiddenFiles = [];
|
|
2564
2601
|
}
|
|
2565
2602
|
clearState() {
|
|
@@ -2895,14 +2932,17 @@ class UploaderApi extends EventEmitter$1 {
|
|
|
2895
2932
|
if (Number(file.docId) >= 0)
|
|
2896
2933
|
res = await get(
|
|
2897
2934
|
this.execution,
|
|
2898
|
-
makeApiaUrl(
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2935
|
+
makeApiaUrl(
|
|
2936
|
+
this.execution,
|
|
2937
|
+
this.getCheckSignatureParameters({
|
|
2938
|
+
action: "viewDocSigns",
|
|
2939
|
+
docId: file.docId,
|
|
2940
|
+
lock: false,
|
|
2941
|
+
isAjax: true,
|
|
2942
|
+
prefix: this.type,
|
|
2943
|
+
react: true
|
|
2944
|
+
})
|
|
2945
|
+
)
|
|
2906
2946
|
);
|
|
2907
2947
|
return res;
|
|
2908
2948
|
}
|
|
@@ -3002,8 +3042,11 @@ class UploaderApi extends EventEmitter$1 {
|
|
|
3002
3042
|
async version(file, conf = { newFiles: [] }) {
|
|
3003
3043
|
const checkLock = await this.checkLockDocument(file.docId, true);
|
|
3004
3044
|
const isLocked = await this.checkWebDavLock(file.docId);
|
|
3005
|
-
if (checkLock === true && isLocked)
|
|
3006
|
-
|
|
3045
|
+
if (!(checkLock === true && isLocked))
|
|
3046
|
+
return;
|
|
3047
|
+
this.state.versioningFile = file;
|
|
3048
|
+
const openVersionModal = () => {
|
|
3049
|
+
if (!this.modalConfig.oneClickUpload) {
|
|
3007
3050
|
this.modalController = new UploaderModalController(
|
|
3008
3051
|
this,
|
|
3009
3052
|
this.modalConfig,
|
|
@@ -3013,36 +3056,30 @@ class UploaderApi extends EventEmitter$1 {
|
|
|
3013
3056
|
);
|
|
3014
3057
|
this.modalController.openModal();
|
|
3015
3058
|
}
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
versionFile: file
|
|
3035
|
-
}
|
|
3036
|
-
);
|
|
3037
|
-
this.modalController.openModal();
|
|
3038
|
-
}
|
|
3039
|
-
}
|
|
3040
|
-
} else {
|
|
3041
|
-
await this.reloadMetadata({
|
|
3042
|
-
docId: file.docId,
|
|
3043
|
-
docTypeId: file.docTypeId
|
|
3044
|
-
});
|
|
3059
|
+
};
|
|
3060
|
+
if (!conf.newFiles || conf.newFiles.length === 0) {
|
|
3061
|
+
openVersionModal();
|
|
3062
|
+
}
|
|
3063
|
+
await this.ajaxUploadStart();
|
|
3064
|
+
if (file.docTypeId)
|
|
3065
|
+
this.state.selectedDocTypeId = file.docTypeId;
|
|
3066
|
+
await this.versionFileInfo(file);
|
|
3067
|
+
const hasNewFiles = !!(conf.newFiles && conf.newFiles.length > 0);
|
|
3068
|
+
if (hasNewFiles) {
|
|
3069
|
+
const res = await this.saveDroppedFiles(conf.newFiles, {
|
|
3070
|
+
langId: conf.langId,
|
|
3071
|
+
translatingFile: conf.translatingFile,
|
|
3072
|
+
shouldReset: false,
|
|
3073
|
+
strictMode: true
|
|
3074
|
+
});
|
|
3075
|
+
if (res) {
|
|
3076
|
+
openVersionModal();
|
|
3045
3077
|
}
|
|
3078
|
+
} else {
|
|
3079
|
+
await this.reloadMetadata({
|
|
3080
|
+
docId: file.docId,
|
|
3081
|
+
docTypeId: file.docTypeId
|
|
3082
|
+
});
|
|
3046
3083
|
}
|
|
3047
3084
|
}
|
|
3048
3085
|
async versionFileInfo(file) {
|
|
@@ -3102,6 +3139,7 @@ class UploaderApi extends EventEmitter$1 {
|
|
|
3102
3139
|
const document = documentInfo.function.data.general;
|
|
3103
3140
|
const { permissions } = documentInfo.function.data;
|
|
3104
3141
|
if (this.modalController) {
|
|
3142
|
+
this.setCurrentDocTypeId(document.docTypeId);
|
|
3105
3143
|
this.modalController.addDirectoryFile(document);
|
|
3106
3144
|
this.modalController.state.description = document.docDesc;
|
|
3107
3145
|
this.modalController.state.docExpDate = document.docExpDate;
|
|
@@ -3277,7 +3315,7 @@ class UploaderApi extends EventEmitter$1 {
|
|
|
3277
3315
|
} else {
|
|
3278
3316
|
this.state.files = { ...currentFiles, ...newFiles };
|
|
3279
3317
|
}
|
|
3280
|
-
this.
|
|
3318
|
+
this.clearFiles();
|
|
3281
3319
|
this.emit("fileUploaded", null);
|
|
3282
3320
|
return true;
|
|
3283
3321
|
}
|
|
@@ -3402,7 +3440,9 @@ class UploaderApi extends EventEmitter$1 {
|
|
|
3402
3440
|
const versioningFile = this.state.versioningFile;
|
|
3403
3441
|
if (versioningFile)
|
|
3404
3442
|
return files;
|
|
3405
|
-
const uploadedFiles = this.state.
|
|
3443
|
+
const uploadedFiles = Object.values(this.state.files).filter(
|
|
3444
|
+
(file) => Number(file.docId) > 0
|
|
3445
|
+
);
|
|
3406
3446
|
const existingFiles = [];
|
|
3407
3447
|
const nonExistingFiles = [];
|
|
3408
3448
|
if (conf?.langId) {
|
|
@@ -3415,7 +3455,7 @@ class UploaderApi extends EventEmitter$1 {
|
|
|
3415
3455
|
existingFiles.push(files[0]);
|
|
3416
3456
|
} else
|
|
3417
3457
|
files.forEach((file) => {
|
|
3418
|
-
if (uploadedFiles.find((search) => search.
|
|
3458
|
+
if (uploadedFiles.find((search) => search.docName === file.name)) {
|
|
3419
3459
|
existingFiles.push(file);
|
|
3420
3460
|
} else
|
|
3421
3461
|
nonExistingFiles.push(file);
|
|
@@ -3548,15 +3588,6 @@ class UploaderApi extends EventEmitter$1 {
|
|
|
3548
3588
|
}
|
|
3549
3589
|
return newFiles;
|
|
3550
3590
|
}
|
|
3551
|
-
if (files.length === 1 && conf?.translatingFile === void 0 && conf?.langId === void 0) {
|
|
3552
|
-
const actualVersioningFile = Object.values(this.state.files).find(
|
|
3553
|
-
(c) => (c.name || c.docName) === files[0].name
|
|
3554
|
-
);
|
|
3555
|
-
if (actualVersioningFile) {
|
|
3556
|
-
if (actualVersioningFile.isLockedByMe)
|
|
3557
|
-
this.state.versioningFile = actualVersioningFile;
|
|
3558
|
-
}
|
|
3559
|
-
}
|
|
3560
3591
|
return files;
|
|
3561
3592
|
}
|
|
3562
3593
|
getLoadFileSystemStructureTree() {
|
|
@@ -3957,6 +3988,11 @@ class File extends FieldWithAttribute {
|
|
|
3957
3988
|
}
|
|
3958
3989
|
}
|
|
3959
3990
|
}
|
|
3991
|
+
async downloadDocument() {
|
|
3992
|
+
await this.uploader.downloadDocument(
|
|
3993
|
+
Object.values(this.uploader.state.files)[0].docId
|
|
3994
|
+
);
|
|
3995
|
+
}
|
|
3960
3996
|
}
|
|
3961
3997
|
|
|
3962
3998
|
function noNaN(number, defaultReturn = 0) {
|
|
@@ -4343,7 +4379,7 @@ class Grid extends Field {
|
|
|
4343
4379
|
}));
|
|
4344
4380
|
this.state.isLoading = false;
|
|
4345
4381
|
this.state.isMaximized = false;
|
|
4346
|
-
this.controller.on("
|
|
4382
|
+
this.controller.on("columnSort", (col) => {
|
|
4347
4383
|
this.sortColumn(col.getState("properties").col.fldId);
|
|
4348
4384
|
});
|
|
4349
4385
|
}
|
|
@@ -4385,7 +4421,7 @@ class Grid extends Field {
|
|
|
4385
4421
|
}
|
|
4386
4422
|
get selectedIndices() {
|
|
4387
4423
|
return [...this.tableController.getState("selection").values()].map(
|
|
4388
|
-
(c) => c.
|
|
4424
|
+
(c) => c.getIndex()
|
|
4389
4425
|
);
|
|
4390
4426
|
}
|
|
4391
4427
|
get selectedItems() {
|
|
@@ -4431,7 +4467,8 @@ class Grid extends Field {
|
|
|
4431
4467
|
const res = this.runAction({
|
|
4432
4468
|
postData: {
|
|
4433
4469
|
gridAction: "add",
|
|
4434
|
-
addRowsCount: 1
|
|
4470
|
+
addRowsCount: 1,
|
|
4471
|
+
fireEvents: this.hasServerAjaxEventsOfType("gridAdd")
|
|
4435
4472
|
}
|
|
4436
4473
|
});
|
|
4437
4474
|
const response = await res;
|
|
@@ -4482,7 +4519,8 @@ class Grid extends Field {
|
|
|
4482
4519
|
return this.asyncAction(async () => {
|
|
4483
4520
|
const res = this.runAction({
|
|
4484
4521
|
postData: {
|
|
4485
|
-
gridAction: "delete"
|
|
4522
|
+
gridAction: "delete",
|
|
4523
|
+
fireEvents: this.hasServerAjaxEventsOfType("gridDelete")
|
|
4486
4524
|
}
|
|
4487
4525
|
});
|
|
4488
4526
|
const currentRows = [...this.tableController.body.rows];
|
|
@@ -4517,7 +4555,7 @@ class Grid extends Field {
|
|
|
4517
4555
|
if (await this.fireScriptEvent("gridDelete")) {
|
|
4518
4556
|
if (void 0 === index) {
|
|
4519
4557
|
index = [...this.controller.getState("selection")].map((c) => {
|
|
4520
|
-
return c.
|
|
4558
|
+
return c.getIndex();
|
|
4521
4559
|
});
|
|
4522
4560
|
} else {
|
|
4523
4561
|
this.controller.setSelection(arrayOrArray(index));
|
|
@@ -4539,7 +4577,8 @@ class Grid extends Field {
|
|
|
4539
4577
|
const res = this.runAction({
|
|
4540
4578
|
postData: {
|
|
4541
4579
|
gridAction: "delete",
|
|
4542
|
-
rowId: deletingIndices
|
|
4580
|
+
rowId: deletingIndices,
|
|
4581
|
+
fireEvents: this.hasServerAjaxEventsOfType("gridDelete")
|
|
4543
4582
|
}
|
|
4544
4583
|
});
|
|
4545
4584
|
const currentRows = [...this.tableController.body.rows];
|
|
@@ -4681,7 +4720,7 @@ class Grid extends Field {
|
|
|
4681
4720
|
return null;
|
|
4682
4721
|
}
|
|
4683
4722
|
getSelectedRows() {
|
|
4684
|
-
return this.tableController.getSelectedRows().map((c) => this.getRow(c.
|
|
4723
|
+
return this.tableController.getSelectedRows().map((c) => this.getRow(c.getIndex()));
|
|
4685
4724
|
}
|
|
4686
4725
|
refreshColumnsVisibilities() {
|
|
4687
4726
|
const shownColumns = /* @__PURE__ */ new Set();
|
|
@@ -4689,19 +4728,20 @@ class Grid extends Field {
|
|
|
4689
4728
|
for (const row of this.tableController.body.rows) {
|
|
4690
4729
|
const cell = row.cells[i];
|
|
4691
4730
|
const field = cell.getState("properties")?.field;
|
|
4692
|
-
if (!(field && (field.properties.visibilityHidden || field instanceof Hidden))
|
|
4731
|
+
if (!(field && (field.properties.visibilityHidden || field instanceof Hidden))) {
|
|
4693
4732
|
shownColumns.add(cell.getState("colName"));
|
|
4694
4733
|
break;
|
|
4695
4734
|
}
|
|
4696
4735
|
}
|
|
4697
4736
|
}
|
|
4698
|
-
|
|
4699
|
-
|
|
4700
|
-
|
|
4701
|
-
|
|
4702
|
-
|
|
4703
|
-
|
|
4704
|
-
|
|
4737
|
+
for (const column of new Set(
|
|
4738
|
+
this.tableController.head.rows[0].cells.map((c) => c.getState("colName"))
|
|
4739
|
+
)) {
|
|
4740
|
+
this.tableController.toggleColumnVisibility(
|
|
4741
|
+
column,
|
|
4742
|
+
shownColumns.has(column)
|
|
4743
|
+
);
|
|
4744
|
+
}
|
|
4705
4745
|
}
|
|
4706
4746
|
async init(form) {
|
|
4707
4747
|
await super.init(form);
|
|
@@ -4748,11 +4788,14 @@ class Grid extends Field {
|
|
|
4748
4788
|
style: { width, maxWidth: width },
|
|
4749
4789
|
title: col.title
|
|
4750
4790
|
},
|
|
4751
|
-
properties: { col }
|
|
4791
|
+
properties: { col },
|
|
4792
|
+
isHidden: hiddenColumns.has(col.fldId)
|
|
4752
4793
|
})
|
|
4753
4794
|
);
|
|
4754
4795
|
});
|
|
4755
|
-
|
|
4796
|
+
for (const column of hiddenColumns) {
|
|
4797
|
+
this.tableController.toggleColumnVisibility(column, false);
|
|
4798
|
+
}
|
|
4756
4799
|
this.controller.head.addRow(headerRow);
|
|
4757
4800
|
getDocument(this.form.execution).addEventListener?.("keydown", (ev) => {
|
|
4758
4801
|
if (ev.code === "Escape") {
|
|
@@ -4790,7 +4833,8 @@ class Grid extends Field {
|
|
|
4790
4833
|
const res = this.runAction({
|
|
4791
4834
|
postData: {
|
|
4792
4835
|
gridAction: "down",
|
|
4793
|
-
rowId: indices
|
|
4836
|
+
rowId: indices,
|
|
4837
|
+
fireEvents: this.hasServerAjaxEventsOfType("gridSort")
|
|
4794
4838
|
}
|
|
4795
4839
|
});
|
|
4796
4840
|
this.swapRows(indices, "down");
|
|
@@ -4828,7 +4872,8 @@ class Grid extends Field {
|
|
|
4828
4872
|
const res = this.runAction({
|
|
4829
4873
|
postData: {
|
|
4830
4874
|
gridAction: "up",
|
|
4831
|
-
rowId: indices
|
|
4875
|
+
rowId: indices,
|
|
4876
|
+
fireEvents: this.hasServerAjaxEventsOfType("gridSort")
|
|
4832
4877
|
}
|
|
4833
4878
|
});
|
|
4834
4879
|
this.swapRows(indices, "up");
|
|
@@ -4911,9 +4956,9 @@ class Grid extends Field {
|
|
|
4911
4956
|
newRow.addCell(
|
|
4912
4957
|
new AdditionalCell(
|
|
4913
4958
|
this,
|
|
4914
|
-
() => newRow.
|
|
4959
|
+
() => newRow.getIndex(),
|
|
4915
4960
|
() => {
|
|
4916
|
-
this.deleteRows(newRow.
|
|
4961
|
+
this.deleteRows(newRow.getIndex());
|
|
4917
4962
|
},
|
|
4918
4963
|
this.properties.gridForm ? (handler) => {
|
|
4919
4964
|
this.openEditionModal(handler);
|
|
@@ -4966,14 +5011,6 @@ class Grid extends Field {
|
|
|
4966
5011
|
this.tableController.clearSelection();
|
|
4967
5012
|
this.tableController.toggleRowSelection(newRow, true);
|
|
4968
5013
|
}
|
|
4969
|
-
for (let i = 0; i < 10; i++) {
|
|
4970
|
-
if (newRow.cells[0]?.getTable() instanceof TableController) {
|
|
4971
|
-
newRow.cells[0]?.focus();
|
|
4972
|
-
break;
|
|
4973
|
-
} else {
|
|
4974
|
-
await awaitTime(50);
|
|
4975
|
-
}
|
|
4976
|
-
}
|
|
4977
5014
|
return newRow;
|
|
4978
5015
|
}
|
|
4979
5016
|
async asyncAction(cb, mutex = true) {
|
|
@@ -5010,6 +5047,7 @@ class Grid extends Field {
|
|
|
5010
5047
|
);
|
|
5011
5048
|
this.properties.pages = xml.pages || this.properties.pages;
|
|
5012
5049
|
this.properties.currentPage = xml.curPage || this.properties.currentPage;
|
|
5050
|
+
this.properties.visibilityHidden = xml.properties.visibilityHidden ?? this.properties.visibilityHidden;
|
|
5013
5051
|
if (statesArray[0].length > this.controller.body.rows.length) {
|
|
5014
5052
|
for (let i = this.controller.body.rows.length; i < statesArray[0].length; i++) {
|
|
5015
5053
|
const parsedFieldGroups = fieldsArray.map((field, columnIndex) => {
|
|
@@ -5075,7 +5113,7 @@ class Grid extends Field {
|
|
|
5075
5113
|
});
|
|
5076
5114
|
this.refreshColumnsVisibilities();
|
|
5077
5115
|
}
|
|
5078
|
-
async runAction(
|
|
5116
|
+
async runAction(postData) {
|
|
5079
5117
|
return post(
|
|
5080
5118
|
this.form.execution,
|
|
5081
5119
|
await makeApiaUrl(this.form.execution, {
|
|
@@ -5088,7 +5126,7 @@ class Grid extends Field {
|
|
|
5088
5126
|
{
|
|
5089
5127
|
postDataTreatment: "stringify",
|
|
5090
5128
|
stringifyOptions: { arrayFormat: "repeat" },
|
|
5091
|
-
...
|
|
5129
|
+
...postData
|
|
5092
5130
|
}
|
|
5093
5131
|
);
|
|
5094
5132
|
}
|
|
@@ -5128,7 +5166,10 @@ class GridPaginated extends Grid {
|
|
|
5128
5166
|
*/
|
|
5129
5167
|
get finalIndex() {
|
|
5130
5168
|
const pageSize = this.properties.pageSize;
|
|
5131
|
-
return noNaN$1(
|
|
5169
|
+
return noNaN$1(
|
|
5170
|
+
(this.properties.currentPage - 1) * pageSize - 1 + this.controller.body.rows.length,
|
|
5171
|
+
0
|
|
5172
|
+
);
|
|
5132
5173
|
}
|
|
5133
5174
|
addRow() {
|
|
5134
5175
|
return this.asyncAction(async () => {
|
|
@@ -5157,12 +5198,14 @@ class GridPaginated extends Grid {
|
|
|
5157
5198
|
return false;
|
|
5158
5199
|
});
|
|
5159
5200
|
}
|
|
5160
|
-
|
|
5201
|
+
actualDeleteRows(props) {
|
|
5202
|
+
let index = props.index;
|
|
5203
|
+
const action = props.action ?? "delete";
|
|
5161
5204
|
return this.asyncAction(async () => {
|
|
5162
5205
|
if (await this.fireScriptEvent("gridDelete")) {
|
|
5163
5206
|
if (void 0 === index) {
|
|
5164
5207
|
index = [...this.controller.getState("selection")].map((c) => {
|
|
5165
|
-
return c.
|
|
5208
|
+
return c.getIndex();
|
|
5166
5209
|
});
|
|
5167
5210
|
} else {
|
|
5168
5211
|
this.controller.setSelection(arrayOrArray(index));
|
|
@@ -5170,13 +5213,13 @@ class GridPaginated extends Grid {
|
|
|
5170
5213
|
const deletingIndices = arrayOrArray(index).sort((a, b) => b - a).map((c) => c + this.startIndex);
|
|
5171
5214
|
if (this.hasServerNoAjaxEventsOfType("gridDelete")) {
|
|
5172
5215
|
await this.fireServerEvent("gridDelete", {
|
|
5173
|
-
gridAction:
|
|
5216
|
+
gridAction: action,
|
|
5174
5217
|
rowId: deletingIndices
|
|
5175
5218
|
});
|
|
5176
5219
|
} else {
|
|
5177
5220
|
const res = await this.runAction({
|
|
5178
5221
|
postData: {
|
|
5179
|
-
gridAction:
|
|
5222
|
+
gridAction: action,
|
|
5180
5223
|
rowId: deletingIndices
|
|
5181
5224
|
}
|
|
5182
5225
|
});
|
|
@@ -5204,6 +5247,12 @@ class GridPaginated extends Grid {
|
|
|
5204
5247
|
return false;
|
|
5205
5248
|
});
|
|
5206
5249
|
}
|
|
5250
|
+
async deleteAllRows() {
|
|
5251
|
+
return this.actualDeleteRows({ action: "deleteAllRows" });
|
|
5252
|
+
}
|
|
5253
|
+
async deleteRows(index) {
|
|
5254
|
+
return this.actualDeleteRows({ index });
|
|
5255
|
+
}
|
|
5207
5256
|
async gotoPage(page) {
|
|
5208
5257
|
return this.asyncAction(async () => {
|
|
5209
5258
|
const res = await this.runAction({
|
|
@@ -5245,7 +5294,7 @@ class GridPaginated extends Grid {
|
|
|
5245
5294
|
await setAjaxFormResponse(this.form.execution, parseXml(evs));
|
|
5246
5295
|
}
|
|
5247
5296
|
if (res?.data?.success) {
|
|
5248
|
-
const currentSelectionIndices = this.controller.getSelectedRows().map((c) => c.
|
|
5297
|
+
const currentSelectionIndices = this.controller.getSelectedRows().map((c) => c.getIndex());
|
|
5249
5298
|
const currentPage = this.currentPage;
|
|
5250
5299
|
this.rebuildGrid(res.data.gridXml);
|
|
5251
5300
|
this.controller.clearSelection();
|
|
@@ -5286,7 +5335,7 @@ class GridPaginated extends Grid {
|
|
|
5286
5335
|
await setAjaxFormResponse(this.form.execution, parseXml(evs));
|
|
5287
5336
|
}
|
|
5288
5337
|
if (res?.data?.success) {
|
|
5289
|
-
const currentSelectionIndices = this.controller.getSelectedRows().map((c) => c.
|
|
5338
|
+
const currentSelectionIndices = this.controller.getSelectedRows().map((c) => c.getIndex());
|
|
5290
5339
|
const currentPage = this.currentPage;
|
|
5291
5340
|
this.rebuildGrid(res.data.gridXml);
|
|
5292
5341
|
this.controller.clearSelection();
|
|
@@ -5381,7 +5430,7 @@ class Input extends TranslatableField {
|
|
|
5381
5430
|
return false;
|
|
5382
5431
|
return super.validate();
|
|
5383
5432
|
}
|
|
5384
|
-
|
|
5433
|
+
hasValue() {
|
|
5385
5434
|
return !!String(this.getValue()).trim();
|
|
5386
5435
|
}
|
|
5387
5436
|
}
|
|
@@ -5429,7 +5478,7 @@ class Multiple extends FieldWithAttribute {
|
|
|
5429
5478
|
}
|
|
5430
5479
|
|
|
5431
5480
|
class Password extends FieldWithAttribute {
|
|
5432
|
-
|
|
5481
|
+
hasValue() {
|
|
5433
5482
|
return !!String(this.getValue()).trim();
|
|
5434
5483
|
}
|
|
5435
5484
|
}
|
|
@@ -5486,7 +5535,7 @@ class Select extends FieldWithAttribute {
|
|
|
5486
5535
|
}
|
|
5487
5536
|
|
|
5488
5537
|
class Textarea extends TranslatableField {
|
|
5489
|
-
|
|
5538
|
+
hasValue() {
|
|
5490
5539
|
return !!String(this.getValue()).trim();
|
|
5491
5540
|
}
|
|
5492
5541
|
getSynchronizePostConfiguration(value) {
|
|
@@ -5576,7 +5625,7 @@ class Tree extends FieldWithAttribute {
|
|
|
5576
5625
|
this.state.value = getValuesArray(this.properties.possibleValue);
|
|
5577
5626
|
this.controller = new MobXTree({
|
|
5578
5627
|
onSelect: (ev) => {
|
|
5579
|
-
if (isFieldShowAsText(this) || this.properties.disabled) {
|
|
5628
|
+
if (isFieldShowAsText(this) || this.properties.disabled || this.properties.readOnly || this.properties.readonly || this.getParentGrid()?.properties.readonly) {
|
|
5580
5629
|
return false;
|
|
5581
5630
|
} else {
|
|
5582
5631
|
const selection = [...ev.values()].map((c) => c.id);
|
|
@@ -5595,9 +5644,6 @@ class Tree extends FieldWithAttribute {
|
|
|
5595
5644
|
arrayOrArray(this.properties.possibleValue)
|
|
5596
5645
|
);
|
|
5597
5646
|
}
|
|
5598
|
-
isValidValue() {
|
|
5599
|
-
return this.state.value.length > 0;
|
|
5600
|
-
}
|
|
5601
5647
|
async setValue(newValue, options) {
|
|
5602
5648
|
const res = await super.setValue(newValue, options);
|
|
5603
5649
|
if (res) {
|
|
@@ -6071,6 +6117,9 @@ class ApiaFieldWithAttribute extends ApiaField {
|
|
|
6071
6117
|
setValue(v) {
|
|
6072
6118
|
__privateGet$g(this, _field$c).setValue(v);
|
|
6073
6119
|
}
|
|
6120
|
+
_setValue(v, options) {
|
|
6121
|
+
__privateGet$g(this, _field$c).setValue(v, options);
|
|
6122
|
+
}
|
|
6074
6123
|
getLabel() {
|
|
6075
6124
|
return __privateGet$g(this, _field$c).attribute.title;
|
|
6076
6125
|
}
|
|
@@ -6755,6 +6804,7 @@ class GridField extends ApiaField {
|
|
|
6755
6804
|
__privateAdd$6(this, _mutex, new Mutex());
|
|
6756
6805
|
__privateSet$6(this, _execution$2, execution);
|
|
6757
6806
|
__privateSet$6(this, _field$2, field);
|
|
6807
|
+
__privateSet$6(this, _execution$2, execution);
|
|
6758
6808
|
}
|
|
6759
6809
|
async addRow() {
|
|
6760
6810
|
try {
|
|
@@ -6822,6 +6872,11 @@ class GridField extends ApiaField {
|
|
|
6822
6872
|
})
|
|
6823
6873
|
);
|
|
6824
6874
|
}
|
|
6875
|
+
getSelectedIndexes(useAbsoluteIndex) {
|
|
6876
|
+
return __privateGet$6(this, _field$2).controller.getSelectedRows().map(
|
|
6877
|
+
(row) => row.getIndex() + (useAbsoluteIndex ? +noNaN$1(__privateGet$6(this, _field$2).startIndex) : 0)
|
|
6878
|
+
);
|
|
6879
|
+
}
|
|
6825
6880
|
getAllColumns() {
|
|
6826
6881
|
return __privateGet$6(this, _field$2).getAllColumns().map(
|
|
6827
6882
|
(c) => c.map((f) => createNewField(__privateGet$6(this, _field$2).getForm().execution, f))
|
|
@@ -6943,6 +6998,9 @@ class FileUploaderField extends ApiaFieldWithAttribute {
|
|
|
6943
6998
|
}
|
|
6944
6999
|
return null;
|
|
6945
7000
|
}
|
|
7001
|
+
async downloadDocument() {
|
|
7002
|
+
await __privateGet$5(this, _field$1).downloadDocument();
|
|
7003
|
+
}
|
|
6946
7004
|
}
|
|
6947
7005
|
_field$1 = new WeakMap();
|
|
6948
7006
|
|
|
@@ -7077,8 +7135,8 @@ class ApiaForm {
|
|
|
7077
7135
|
hideModal() {
|
|
7078
7136
|
__privateGet$3(this, _execution$1).emit("hideFormModal", __privateGet$3(this, _form));
|
|
7079
7137
|
}
|
|
7080
|
-
showAsModal() {
|
|
7081
|
-
__privateGet$3(this, _execution$1).emit("showFormAsModal", __privateGet$3(this, _form));
|
|
7138
|
+
showAsModal(size) {
|
|
7139
|
+
__privateGet$3(this, _execution$1).emit("showFormAsModal", { form: __privateGet$3(this, _form), size });
|
|
7082
7140
|
}
|
|
7083
7141
|
}
|
|
7084
7142
|
_form = new WeakMap();
|
|
@@ -7277,6 +7335,13 @@ class ApiaFunctions {
|
|
|
7277
7335
|
viewAdmEntity(entName, entNum) {
|
|
7278
7336
|
this.admEntity(entName, entNum);
|
|
7279
7337
|
}
|
|
7338
|
+
changeTab(index) {
|
|
7339
|
+
if (window.tabsController)
|
|
7340
|
+
window.tabsController.tabsList.forEach((tab, i) => {
|
|
7341
|
+
if (arrayOrArray(index).includes(i))
|
|
7342
|
+
tab.open();
|
|
7343
|
+
});
|
|
7344
|
+
}
|
|
7280
7345
|
}
|
|
7281
7346
|
_execution = new WeakMap();
|
|
7282
7347
|
|
|
@@ -7485,7 +7550,7 @@ class CustomComponent {
|
|
|
7485
7550
|
}),
|
|
7486
7551
|
{
|
|
7487
7552
|
postData: typeof body === "string" ? {
|
|
7488
|
-
payload: body
|
|
7553
|
+
payload: encodeStrToBase64Utf8(body)
|
|
7489
7554
|
} : body,
|
|
7490
7555
|
postDataTreatment: "stringify"
|
|
7491
7556
|
}
|
|
@@ -8012,6 +8077,21 @@ class Form extends WithProperties {
|
|
|
8012
8077
|
}
|
|
8013
8078
|
return super.getProperty(propName);
|
|
8014
8079
|
}
|
|
8080
|
+
getErrorsList() {
|
|
8081
|
+
const errors = [];
|
|
8082
|
+
this.allFields.forEach((f) => {
|
|
8083
|
+
if (f instanceof FieldWithAttribute) {
|
|
8084
|
+
const fieldErrors = f.state.validation.errorMessage;
|
|
8085
|
+
if (fieldErrors) {
|
|
8086
|
+
errors.push({
|
|
8087
|
+
id: `${f.getForm().definition.frmParent}_${f.getForm().definition.id}_${f.definition.id}`,
|
|
8088
|
+
errorMessage: fieldErrors
|
|
8089
|
+
});
|
|
8090
|
+
}
|
|
8091
|
+
}
|
|
8092
|
+
});
|
|
8093
|
+
return errors;
|
|
8094
|
+
}
|
|
8015
8095
|
}
|
|
8016
8096
|
|
|
8017
8097
|
function decodeBase64ToUtf8(base64String) {
|
|
@@ -8389,9 +8469,9 @@ class Entity {
|
|
|
8389
8469
|
}
|
|
8390
8470
|
deleteAssociation() {
|
|
8391
8471
|
const selectedRows = this.controller.getState("selection");
|
|
8392
|
-
const lastIdx = Array.from(selectedRows).pop()?.
|
|
8472
|
+
const lastIdx = Array.from(selectedRows).pop()?.getIndex();
|
|
8393
8473
|
[...selectedRows.values()].forEach((row) => {
|
|
8394
|
-
this.state.associations = this.state?.associations.filter((_, idx) => row.
|
|
8474
|
+
this.state.associations = this.state?.associations.filter((_, idx) => row.getIndex() !== idx) ?? [];
|
|
8395
8475
|
this.controller.body.removeRow(row);
|
|
8396
8476
|
});
|
|
8397
8477
|
if (lastIdx)
|
|
@@ -8470,7 +8550,8 @@ class Observations {
|
|
|
8470
8550
|
this.execution,
|
|
8471
8551
|
makeApiaUrl(this.execution, {
|
|
8472
8552
|
action: "getObservationsData",
|
|
8473
|
-
isAjax: true
|
|
8553
|
+
isAjax: true,
|
|
8554
|
+
isTask: !window.isMonitor ? true : false
|
|
8474
8555
|
})
|
|
8475
8556
|
);
|
|
8476
8557
|
if (!res?.data?.obData) {
|
|
@@ -8485,18 +8566,30 @@ class Observations {
|
|
|
8485
8566
|
chkRemAlert: false
|
|
8486
8567
|
};
|
|
8487
8568
|
this.state.newObservation = newObservation;
|
|
8569
|
+
this.areObservationsChecked();
|
|
8488
8570
|
}
|
|
8489
8571
|
}
|
|
8490
8572
|
getConfirmParams() {
|
|
8491
|
-
|
|
8573
|
+
const params = {
|
|
8492
8574
|
txtComment: this.state.newObservation?.commentValue,
|
|
8493
8575
|
chkAddAlert: this.state.newObservation?.chkAddAlert === true ? "on" : void 0,
|
|
8494
8576
|
chkAddAllAlert: this.state.newObservation?.chkAddAllAlert === true ? "on" : void 0,
|
|
8495
8577
|
chkRemAlert: this.state.newObservation?.chkRemAlert === true ? "on" : void 0
|
|
8496
8578
|
};
|
|
8579
|
+
const obs = this.state.observations ?? [];
|
|
8580
|
+
for (const o of obs) {
|
|
8581
|
+
if (!o || !o.name)
|
|
8582
|
+
continue;
|
|
8583
|
+
params[o.name] = o.checked === true ? "on" : void 0;
|
|
8584
|
+
}
|
|
8585
|
+
return params;
|
|
8497
8586
|
}
|
|
8498
8587
|
setPriority(newPriority) {
|
|
8499
8588
|
}
|
|
8589
|
+
areObservationsChecked() {
|
|
8590
|
+
const isChecked = this.state.observations?.some((o) => o.checked === true);
|
|
8591
|
+
return isChecked;
|
|
8592
|
+
}
|
|
8500
8593
|
}
|
|
8501
8594
|
|
|
8502
8595
|
let FlowModal$1 = class FlowModal {
|
|
@@ -8753,6 +8846,25 @@ async function defaultConfirm$1(execution, status) {
|
|
|
8753
8846
|
postDataTreatment: "stringify",
|
|
8754
8847
|
stringifyOptions: {
|
|
8755
8848
|
arrayFormat: "repeat"
|
|
8849
|
+
},
|
|
8850
|
+
xmlParser: (xml) => {
|
|
8851
|
+
const processStringObjPreserveValue = (value, key) => {
|
|
8852
|
+
if (key === "value" && typeof value === "string") {
|
|
8853
|
+
return value;
|
|
8854
|
+
}
|
|
8855
|
+
return processStringObj(value, key);
|
|
8856
|
+
};
|
|
8857
|
+
const baseOptions = getDefaultXmlParserOptions();
|
|
8858
|
+
baseOptions.attrValueProcessors = [
|
|
8859
|
+
customBooleanProcessor,
|
|
8860
|
+
processStringObjPreserveValue,
|
|
8861
|
+
processAjaxEventResponse
|
|
8862
|
+
];
|
|
8863
|
+
const parser = new xml2js.Parser(baseOptions);
|
|
8864
|
+
return getDefaultXmlPostProcessor()(
|
|
8865
|
+
xml,
|
|
8866
|
+
parser
|
|
8867
|
+
);
|
|
8756
8868
|
}
|
|
8757
8869
|
}
|
|
8758
8870
|
);
|
|
@@ -9126,6 +9238,7 @@ class Execution extends EventEmitter$1 {
|
|
|
9126
9238
|
__publicField(this, "_stepCount", 1);
|
|
9127
9239
|
__publicField(this, "notifications");
|
|
9128
9240
|
__publicField(this, "lastModalReturn", []);
|
|
9241
|
+
__publicField(this, "_pendingPromises", /* @__PURE__ */ new Set());
|
|
9129
9242
|
__publicField(this, "formsById", {
|
|
9130
9243
|
E: /* @__PURE__ */ new Map(),
|
|
9131
9244
|
P: /* @__PURE__ */ new Map()
|
|
@@ -9177,6 +9290,23 @@ class Execution extends EventEmitter$1 {
|
|
|
9177
9290
|
this.notifications = new Notifications(this);
|
|
9178
9291
|
makeObservable(this, { state: observable });
|
|
9179
9292
|
}
|
|
9293
|
+
addPendingPromise(promise) {
|
|
9294
|
+
this._pendingPromises.add(promise);
|
|
9295
|
+
promise.finally(() => {
|
|
9296
|
+
this._pendingPromises.delete(promise);
|
|
9297
|
+
});
|
|
9298
|
+
}
|
|
9299
|
+
getErrorsList() {
|
|
9300
|
+
const entityErrors = [];
|
|
9301
|
+
this.forms.E.forEach((form) => {
|
|
9302
|
+
entityErrors.push(...form.getErrorsList());
|
|
9303
|
+
});
|
|
9304
|
+
const processErrors = [];
|
|
9305
|
+
this.forms.P.forEach((form) => {
|
|
9306
|
+
processErrors.push(...form.getErrorsList());
|
|
9307
|
+
});
|
|
9308
|
+
return [...entityErrors, ...processErrors];
|
|
9309
|
+
}
|
|
9180
9310
|
getAllForms() {
|
|
9181
9311
|
return [...this.forms.E.values(), ...this.forms.P.values()];
|
|
9182
9312
|
}
|
|
@@ -9272,21 +9402,21 @@ class Execution extends EventEmitter$1 {
|
|
|
9272
9402
|
for (let i = 1; i < Number(getWindow(this).STEP_QTY) + 1; i++) {
|
|
9273
9403
|
if (i < this._currentStep) {
|
|
9274
9404
|
this._steps.push({
|
|
9275
|
-
title:
|
|
9405
|
+
title: `${getLabel(this, "lblTraStep").text} ${i}`,
|
|
9276
9406
|
stepNumber: i,
|
|
9277
9407
|
status: "completed"
|
|
9278
9408
|
});
|
|
9279
9409
|
}
|
|
9280
9410
|
if (i > this._currentStep && i <= this._stepCount) {
|
|
9281
9411
|
this._steps.push({
|
|
9282
|
-
title:
|
|
9412
|
+
title: `${getLabel(this, "lblTraStep").text} ${i}`,
|
|
9283
9413
|
stepNumber: i,
|
|
9284
9414
|
status: "pending"
|
|
9285
9415
|
});
|
|
9286
9416
|
}
|
|
9287
9417
|
if (i === this._currentStep) {
|
|
9288
9418
|
this._steps.push({
|
|
9289
|
-
title:
|
|
9419
|
+
title: `${getLabel(this, "lblTraStep").text} ${i}`,
|
|
9290
9420
|
stepNumber: i,
|
|
9291
9421
|
status: "current"
|
|
9292
9422
|
});
|
|
@@ -9546,8 +9676,19 @@ class Execution extends EventEmitter$1 {
|
|
|
9546
9676
|
makeApiaUrl(this, {
|
|
9547
9677
|
action: "saveTask",
|
|
9548
9678
|
asXML: true,
|
|
9549
|
-
react: true
|
|
9550
|
-
|
|
9679
|
+
react: true,
|
|
9680
|
+
currentTab: getCurrentTabsString(this)
|
|
9681
|
+
}),
|
|
9682
|
+
{
|
|
9683
|
+
postData: {
|
|
9684
|
+
...this.observations.getConfirmParams(),
|
|
9685
|
+
...this.process.getConfirmParams()
|
|
9686
|
+
},
|
|
9687
|
+
postDataTreatment: "stringify",
|
|
9688
|
+
stringifyOptions: {
|
|
9689
|
+
arrayFormat: "repeat"
|
|
9690
|
+
}
|
|
9691
|
+
}
|
|
9551
9692
|
);
|
|
9552
9693
|
const canClose = response?.data?.load?.canClose;
|
|
9553
9694
|
if (canClose) {
|
|
@@ -9625,6 +9766,12 @@ class Execution extends EventEmitter$1 {
|
|
|
9625
9766
|
unlock();
|
|
9626
9767
|
}
|
|
9627
9768
|
}
|
|
9769
|
+
async waitForPendingSyncs() {
|
|
9770
|
+
if (this._pendingPromises.size === 0)
|
|
9771
|
+
return;
|
|
9772
|
+
const pending = Array.from(this._pendingPromises);
|
|
9773
|
+
await Promise.allSettled(pending);
|
|
9774
|
+
}
|
|
9628
9775
|
}
|
|
9629
9776
|
|
|
9630
9777
|
export { ActionsController, AdditionalCell, ApiaAttribute, ApiaField, ApiaFieldWithAttribute, ApiaForm, ApiaFunctions, BouncingEmitter, Button, ButtonField, Captcha, CaptchaField, CheckField, Checkbox, CustomComponent, GridField as DataGridField, Editor, EditorField, EventEmitter, Execution, ExecutionState, Field, FieldWithAttribute, File, FileUploaderField, FlowModal$1 as FlowModal, Form, FormsUploader, Grid, GridCell, GridField, GridPaginated, HeaderCell, Hidden, HiddenField, IProperty, Image, ImageField, Input, InputField, InvalidSessionException, Label, Link, LinkField, MessageNotification, ModalInput, ModalInputField, Multiple, MultipleField, Notifications, Password, PasswordField, Radio, RadioField, SchedulerField, Select, SelectField, ShowConfirmMessage, ShowPathSelection, ShowPoolSelection, ShowSign$1 as ShowSign, ShowSignSelection$1 as ShowSignSelection, StatefulEmitter, StatusNotification, AreaField as TextAreaField, TextField, Textarea, Title, TranslatableField, Translation, Tree, TreeField, UploaderApi, UploaderModalController, createNewField, deepEqual, get, getLabel, isHtmlResponse, isJsonResponse, isOneClickUploadEnabled, isXmlResponse, makeApiaUrl, parseFakeJSON$1 as parseFakeJSON, parseFileDefinition, parseSuccessfulResponse, parseXml, post, returnExactlyTheSame, shallowEqual };
|