@apia/execution 4.0.43 → 4.0.45
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 +28 -15
- package/dist/index.js +236 -101
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -403,44 +403,63 @@ function replaceLabelHtmlValues(o) {
|
|
|
403
403
|
}
|
|
404
404
|
return o;
|
|
405
405
|
}
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
406
|
+
function customBooleanProcessor(value, name) {
|
|
407
|
+
if (name === "value")
|
|
408
|
+
return value;
|
|
409
|
+
return parseBooleans(value);
|
|
410
|
+
}
|
|
411
|
+
function getDefaultXmlParserOptions(behaveConfig) {
|
|
412
|
+
return {
|
|
413
|
+
trim: true,
|
|
414
|
+
normalize: true,
|
|
414
415
|
explicitRoot: false,
|
|
415
416
|
mergeAttrs: true,
|
|
416
417
|
explicitArray: false,
|
|
417
418
|
charkey: "label",
|
|
418
419
|
attrValueProcessors: [
|
|
419
|
-
|
|
420
|
+
customBooleanProcessor,
|
|
420
421
|
processStringObj,
|
|
421
422
|
processAjaxEventResponse
|
|
422
423
|
],
|
|
423
424
|
tagNameProcessors: [processAjaxEventTagNames],
|
|
424
425
|
attrNameProcessors: [processAjaxEventAttrNames]
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
if (
|
|
434
|
-
|
|
426
|
+
};
|
|
427
|
+
}
|
|
428
|
+
function getDefaultXmlPostProcessor() {
|
|
429
|
+
return (xml, parser) => {
|
|
430
|
+
let objJS;
|
|
431
|
+
parser.parseString(
|
|
432
|
+
xml,
|
|
433
|
+
(err, result) => {
|
|
434
|
+
if (err) {
|
|
435
|
+
console.warn("Error Parsing XML data", err);
|
|
436
|
+
objJS = err;
|
|
437
|
+
} else {
|
|
438
|
+
if (result?.code === "-1" && result.exceptions) {
|
|
439
|
+
throw new InvalidSessionException();
|
|
440
|
+
}
|
|
441
|
+
objJS = result;
|
|
435
442
|
}
|
|
436
|
-
objJS = result;
|
|
437
443
|
}
|
|
444
|
+
);
|
|
445
|
+
if (objJS) {
|
|
446
|
+
return typeof objJS === "object" && objJS ? replaceLabelHtmlValues(objJS) : objJS;
|
|
438
447
|
}
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
448
|
+
return {};
|
|
449
|
+
};
|
|
450
|
+
}
|
|
451
|
+
function getDefaultXmlParser(behaveConfig) {
|
|
452
|
+
return (xml, _behaveConfig) => {
|
|
453
|
+
const parser = new xml2js.Parser(getDefaultXmlParserOptions());
|
|
454
|
+
return getDefaultXmlPostProcessor()(xml, parser);
|
|
455
|
+
};
|
|
456
|
+
}
|
|
457
|
+
const parseXml = (xml, behaveConfig) => {
|
|
458
|
+
if (typeof xml === "object" && !(xml instanceof XMLDocument)) {
|
|
459
|
+
return xml;
|
|
442
460
|
}
|
|
443
|
-
|
|
461
|
+
const parser = behaveConfig?.xmlParser ?? getDefaultXmlParser();
|
|
462
|
+
return parser(xml, behaveConfig);
|
|
444
463
|
};
|
|
445
464
|
|
|
446
465
|
function getWindow(execution) {
|
|
@@ -1282,8 +1301,15 @@ class Field extends WithProperties {
|
|
|
1282
1301
|
}).text
|
|
1283
1302
|
);
|
|
1284
1303
|
}
|
|
1304
|
+
const evtSrc = await asyncCreateNewField(
|
|
1305
|
+
this.form.execution,
|
|
1306
|
+
this
|
|
1307
|
+
);
|
|
1308
|
+
if (evtSrc.setValue) {
|
|
1309
|
+
evtSrc.setValue = (value) => evtSrc._setValue(value, { fireEvents: false });
|
|
1310
|
+
}
|
|
1285
1311
|
result = await fn(
|
|
1286
|
-
|
|
1312
|
+
evtSrc,
|
|
1287
1313
|
...await this.getScriptEventParams(event.fncParams)
|
|
1288
1314
|
);
|
|
1289
1315
|
if (result === false) {
|
|
@@ -1381,6 +1407,11 @@ class Field extends WithProperties {
|
|
|
1381
1407
|
try {
|
|
1382
1408
|
let result = await this.fireScriptEvent(eventName);
|
|
1383
1409
|
if (result) {
|
|
1410
|
+
try {
|
|
1411
|
+
await this.form.execution.waitForPendingSyncs();
|
|
1412
|
+
} catch (e) {
|
|
1413
|
+
console.warn("waitForPendingSyncs failed or timed out", e);
|
|
1414
|
+
}
|
|
1384
1415
|
result = await this.fireServerEvent(eventName, params);
|
|
1385
1416
|
}
|
|
1386
1417
|
return result;
|
|
@@ -1641,13 +1672,7 @@ class FieldWithAttribute extends Field {
|
|
|
1641
1672
|
async getInitialValue({
|
|
1642
1673
|
value
|
|
1643
1674
|
}) {
|
|
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
|
-
}
|
|
1675
|
+
return value;
|
|
1651
1676
|
}
|
|
1652
1677
|
getValidationState() {
|
|
1653
1678
|
return this.state.validation;
|
|
@@ -1672,7 +1697,10 @@ class FieldWithAttribute extends Field {
|
|
|
1672
1697
|
if (options?.markAsDirty !== false) {
|
|
1673
1698
|
this.form.execution.state.hasChangedAnything = true;
|
|
1674
1699
|
}
|
|
1675
|
-
|
|
1700
|
+
if (options?.fireEvents !== false) {
|
|
1701
|
+
return this.fireEvent("onChange", { force: options?.force });
|
|
1702
|
+
}
|
|
1703
|
+
return true;
|
|
1676
1704
|
}
|
|
1677
1705
|
return Promise.resolve(false);
|
|
1678
1706
|
});
|
|
@@ -1711,35 +1739,48 @@ class FieldWithAttribute extends Field {
|
|
|
1711
1739
|
async synchronize(newValue) {
|
|
1712
1740
|
if (newValue === this.lastSynchronizationValue)
|
|
1713
1741
|
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
|
-
|
|
1742
|
+
const syncPromise = (async () => {
|
|
1743
|
+
try {
|
|
1744
|
+
const postData = this.getSynchronizePostConfiguration(newValue);
|
|
1745
|
+
const response = await asyncRetry(
|
|
1746
|
+
async () => {
|
|
1747
|
+
try {
|
|
1748
|
+
const res = await post(
|
|
1749
|
+
this.form.execution,
|
|
1750
|
+
await this.getSynchronizeUrl(),
|
|
1751
|
+
postData
|
|
1752
|
+
);
|
|
1753
|
+
return res;
|
|
1754
|
+
} catch (e) {
|
|
1755
|
+
this.form.execution.notifications.add(
|
|
1756
|
+
new MessageNotification({ message: String(e) })
|
|
1757
|
+
);
|
|
1758
|
+
return null;
|
|
1759
|
+
}
|
|
1760
|
+
},
|
|
1761
|
+
(result2) => {
|
|
1762
|
+
const success = !!result2?.data?.success;
|
|
1763
|
+
return success;
|
|
1764
|
+
},
|
|
1765
|
+
{ retries: 10, timeout: 500 }
|
|
1766
|
+
);
|
|
1767
|
+
const result = response?.data?.success || false;
|
|
1768
|
+
if (result) {
|
|
1769
|
+
this.lastSynchronizationValue = newValue;
|
|
1770
|
+
this.state.validation.dirty = false;
|
|
1771
|
+
return true;
|
|
1772
|
+
}
|
|
1773
|
+
} catch (e) {
|
|
1774
|
+
console.error("synchronize error:", e);
|
|
1775
|
+
this.processSynchronizeError(e);
|
|
1738
1776
|
}
|
|
1739
|
-
|
|
1740
|
-
|
|
1777
|
+
return false;
|
|
1778
|
+
})();
|
|
1779
|
+
try {
|
|
1780
|
+
this.form.execution.addPendingPromise(syncPromise);
|
|
1781
|
+
} catch {
|
|
1741
1782
|
}
|
|
1742
|
-
return
|
|
1783
|
+
return await syncPromise;
|
|
1743
1784
|
}
|
|
1744
1785
|
hasValue() {
|
|
1745
1786
|
return this.getValue() !== "";
|
|
@@ -1790,7 +1831,10 @@ class Checkbox extends FieldWithAttribute {
|
|
|
1790
1831
|
getInitialValue({
|
|
1791
1832
|
value
|
|
1792
1833
|
}) {
|
|
1793
|
-
|
|
1834
|
+
if (value === "" || value === void 0) {
|
|
1835
|
+
return Promise.resolve(false);
|
|
1836
|
+
}
|
|
1837
|
+
return Promise.resolve(toBoolean(value));
|
|
1794
1838
|
}
|
|
1795
1839
|
}
|
|
1796
1840
|
|
|
@@ -2329,6 +2373,7 @@ class UploaderApi extends EventEmitter$1 {
|
|
|
2329
2373
|
translatedFiles: /* @__PURE__ */ new Map(),
|
|
2330
2374
|
hasAllDocTypes: false
|
|
2331
2375
|
});
|
|
2376
|
+
__publicField$i(this, "getCheckSignatureParameters", returnExactlyTheSame);
|
|
2332
2377
|
__publicField$i(this, "getAjaxUploadFileStatusParameters", returnExactlyTheSame);
|
|
2333
2378
|
__publicField$i(this, "getAjaxUploadStartParameters", returnExactlyTheSame);
|
|
2334
2379
|
__publicField$i(this, "getConfirmDropModalParameters", returnExactlyTheSame);
|
|
@@ -2560,6 +2605,7 @@ class UploaderApi extends EventEmitter$1 {
|
|
|
2560
2605
|
this.modalController.state.isReadonly = false;
|
|
2561
2606
|
}
|
|
2562
2607
|
this.state.inProgressFiles = [];
|
|
2608
|
+
this.state.versioningFile = null;
|
|
2563
2609
|
this.state.hiddenFiles = [];
|
|
2564
2610
|
}
|
|
2565
2611
|
clearState() {
|
|
@@ -2895,14 +2941,17 @@ class UploaderApi extends EventEmitter$1 {
|
|
|
2895
2941
|
if (Number(file.docId) >= 0)
|
|
2896
2942
|
res = await get(
|
|
2897
2943
|
this.execution,
|
|
2898
|
-
makeApiaUrl(
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2944
|
+
makeApiaUrl(
|
|
2945
|
+
this.execution,
|
|
2946
|
+
this.getCheckSignatureParameters({
|
|
2947
|
+
action: "viewDocSigns",
|
|
2948
|
+
docId: file.docId,
|
|
2949
|
+
lock: false,
|
|
2950
|
+
isAjax: true,
|
|
2951
|
+
prefix: this.type,
|
|
2952
|
+
react: true
|
|
2953
|
+
})
|
|
2954
|
+
)
|
|
2906
2955
|
);
|
|
2907
2956
|
return res;
|
|
2908
2957
|
}
|
|
@@ -3099,6 +3148,7 @@ class UploaderApi extends EventEmitter$1 {
|
|
|
3099
3148
|
const document = documentInfo.function.data.general;
|
|
3100
3149
|
const { permissions } = documentInfo.function.data;
|
|
3101
3150
|
if (this.modalController) {
|
|
3151
|
+
this.setCurrentDocTypeId(document.docTypeId);
|
|
3102
3152
|
this.modalController.addDirectoryFile(document);
|
|
3103
3153
|
this.modalController.state.description = document.docDesc;
|
|
3104
3154
|
this.modalController.state.docExpDate = document.docExpDate;
|
|
@@ -3274,7 +3324,7 @@ class UploaderApi extends EventEmitter$1 {
|
|
|
3274
3324
|
} else {
|
|
3275
3325
|
this.state.files = { ...currentFiles, ...newFiles };
|
|
3276
3326
|
}
|
|
3277
|
-
this.
|
|
3327
|
+
this.clearFiles();
|
|
3278
3328
|
this.emit("fileUploaded", null);
|
|
3279
3329
|
return true;
|
|
3280
3330
|
}
|
|
@@ -3947,6 +3997,11 @@ class File extends FieldWithAttribute {
|
|
|
3947
3997
|
}
|
|
3948
3998
|
}
|
|
3949
3999
|
}
|
|
4000
|
+
async downloadDocument() {
|
|
4001
|
+
await this.uploader.downloadDocument(
|
|
4002
|
+
Object.values(this.uploader.state.files)[0].docId
|
|
4003
|
+
);
|
|
4004
|
+
}
|
|
3950
4005
|
}
|
|
3951
4006
|
|
|
3952
4007
|
function noNaN(number, defaultReturn = 0) {
|
|
@@ -4375,7 +4430,7 @@ class Grid extends Field {
|
|
|
4375
4430
|
}
|
|
4376
4431
|
get selectedIndices() {
|
|
4377
4432
|
return [...this.tableController.getState("selection").values()].map(
|
|
4378
|
-
(c) => c.
|
|
4433
|
+
(c) => c.getIndex()
|
|
4379
4434
|
);
|
|
4380
4435
|
}
|
|
4381
4436
|
get selectedItems() {
|
|
@@ -4509,7 +4564,7 @@ class Grid extends Field {
|
|
|
4509
4564
|
if (await this.fireScriptEvent("gridDelete")) {
|
|
4510
4565
|
if (void 0 === index) {
|
|
4511
4566
|
index = [...this.controller.getState("selection")].map((c) => {
|
|
4512
|
-
return c.
|
|
4567
|
+
return c.getIndex();
|
|
4513
4568
|
});
|
|
4514
4569
|
} else {
|
|
4515
4570
|
this.controller.setSelection(arrayOrArray(index));
|
|
@@ -4674,7 +4729,7 @@ class Grid extends Field {
|
|
|
4674
4729
|
return null;
|
|
4675
4730
|
}
|
|
4676
4731
|
getSelectedRows() {
|
|
4677
|
-
return this.tableController.getSelectedRows().map((c) => this.getRow(c.
|
|
4732
|
+
return this.tableController.getSelectedRows().map((c) => this.getRow(c.getIndex()));
|
|
4678
4733
|
}
|
|
4679
4734
|
refreshColumnsVisibilities() {
|
|
4680
4735
|
const shownColumns = /* @__PURE__ */ new Set();
|
|
@@ -4682,19 +4737,20 @@ class Grid extends Field {
|
|
|
4682
4737
|
for (const row of this.tableController.body.rows) {
|
|
4683
4738
|
const cell = row.cells[i];
|
|
4684
4739
|
const field = cell.getState("properties")?.field;
|
|
4685
|
-
if (!(field && (field.properties.visibilityHidden || field instanceof Hidden))
|
|
4740
|
+
if (!(field && (field.properties.visibilityHidden || field instanceof Hidden))) {
|
|
4686
4741
|
shownColumns.add(cell.getState("colName"));
|
|
4687
4742
|
break;
|
|
4688
4743
|
}
|
|
4689
4744
|
}
|
|
4690
4745
|
}
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
|
|
4694
|
-
|
|
4695
|
-
|
|
4696
|
-
|
|
4697
|
-
|
|
4746
|
+
for (const column of new Set(
|
|
4747
|
+
this.tableController.head.rows[0].cells.map((c) => c.getState("colName"))
|
|
4748
|
+
)) {
|
|
4749
|
+
this.tableController.toggleColumnVisibility(
|
|
4750
|
+
column,
|
|
4751
|
+
shownColumns.has(column)
|
|
4752
|
+
);
|
|
4753
|
+
}
|
|
4698
4754
|
}
|
|
4699
4755
|
async init(form) {
|
|
4700
4756
|
await super.init(form);
|
|
@@ -4741,11 +4797,14 @@ class Grid extends Field {
|
|
|
4741
4797
|
style: { width, maxWidth: width },
|
|
4742
4798
|
title: col.title
|
|
4743
4799
|
},
|
|
4744
|
-
properties: { col }
|
|
4800
|
+
properties: { col },
|
|
4801
|
+
isHidden: hiddenColumns.has(col.fldId)
|
|
4745
4802
|
})
|
|
4746
4803
|
);
|
|
4747
4804
|
});
|
|
4748
|
-
|
|
4805
|
+
for (const column of hiddenColumns) {
|
|
4806
|
+
this.tableController.toggleColumnVisibility(column, false);
|
|
4807
|
+
}
|
|
4749
4808
|
this.controller.head.addRow(headerRow);
|
|
4750
4809
|
getDocument(this.form.execution).addEventListener?.("keydown", (ev) => {
|
|
4751
4810
|
if (ev.code === "Escape") {
|
|
@@ -4906,9 +4965,9 @@ class Grid extends Field {
|
|
|
4906
4965
|
newRow.addCell(
|
|
4907
4966
|
new AdditionalCell(
|
|
4908
4967
|
this,
|
|
4909
|
-
() => newRow.
|
|
4968
|
+
() => newRow.getIndex(),
|
|
4910
4969
|
() => {
|
|
4911
|
-
this.deleteRows(newRow.
|
|
4970
|
+
this.deleteRows(newRow.getIndex());
|
|
4912
4971
|
},
|
|
4913
4972
|
this.properties.gridForm ? (handler) => {
|
|
4914
4973
|
this.openEditionModal(handler);
|
|
@@ -4997,6 +5056,7 @@ class Grid extends Field {
|
|
|
4997
5056
|
);
|
|
4998
5057
|
this.properties.pages = xml.pages || this.properties.pages;
|
|
4999
5058
|
this.properties.currentPage = xml.curPage || this.properties.currentPage;
|
|
5059
|
+
this.properties.visibilityHidden = xml.properties.visibilityHidden ?? this.properties.visibilityHidden;
|
|
5000
5060
|
if (statesArray[0].length > this.controller.body.rows.length) {
|
|
5001
5061
|
for (let i = this.controller.body.rows.length; i < statesArray[0].length; i++) {
|
|
5002
5062
|
const parsedFieldGroups = fieldsArray.map((field, columnIndex) => {
|
|
@@ -5115,7 +5175,10 @@ class GridPaginated extends Grid {
|
|
|
5115
5175
|
*/
|
|
5116
5176
|
get finalIndex() {
|
|
5117
5177
|
const pageSize = this.properties.pageSize;
|
|
5118
|
-
return noNaN$1(
|
|
5178
|
+
return noNaN$1(
|
|
5179
|
+
(this.properties.currentPage - 1) * pageSize - 1 + this.controller.body.rows.length,
|
|
5180
|
+
0
|
|
5181
|
+
);
|
|
5119
5182
|
}
|
|
5120
5183
|
addRow() {
|
|
5121
5184
|
return this.asyncAction(async () => {
|
|
@@ -5144,12 +5207,14 @@ class GridPaginated extends Grid {
|
|
|
5144
5207
|
return false;
|
|
5145
5208
|
});
|
|
5146
5209
|
}
|
|
5147
|
-
|
|
5210
|
+
actualDeleteRows(props) {
|
|
5211
|
+
let index = props.index;
|
|
5212
|
+
const action = props.action ?? "delete";
|
|
5148
5213
|
return this.asyncAction(async () => {
|
|
5149
5214
|
if (await this.fireScriptEvent("gridDelete")) {
|
|
5150
5215
|
if (void 0 === index) {
|
|
5151
5216
|
index = [...this.controller.getState("selection")].map((c) => {
|
|
5152
|
-
return c.
|
|
5217
|
+
return c.getIndex();
|
|
5153
5218
|
});
|
|
5154
5219
|
} else {
|
|
5155
5220
|
this.controller.setSelection(arrayOrArray(index));
|
|
@@ -5157,13 +5222,13 @@ class GridPaginated extends Grid {
|
|
|
5157
5222
|
const deletingIndices = arrayOrArray(index).sort((a, b) => b - a).map((c) => c + this.startIndex);
|
|
5158
5223
|
if (this.hasServerNoAjaxEventsOfType("gridDelete")) {
|
|
5159
5224
|
await this.fireServerEvent("gridDelete", {
|
|
5160
|
-
gridAction:
|
|
5225
|
+
gridAction: action,
|
|
5161
5226
|
rowId: deletingIndices
|
|
5162
5227
|
});
|
|
5163
5228
|
} else {
|
|
5164
5229
|
const res = await this.runAction({
|
|
5165
5230
|
postData: {
|
|
5166
|
-
gridAction:
|
|
5231
|
+
gridAction: action,
|
|
5167
5232
|
rowId: deletingIndices
|
|
5168
5233
|
}
|
|
5169
5234
|
});
|
|
@@ -5191,6 +5256,12 @@ class GridPaginated extends Grid {
|
|
|
5191
5256
|
return false;
|
|
5192
5257
|
});
|
|
5193
5258
|
}
|
|
5259
|
+
async deleteAllRows() {
|
|
5260
|
+
return this.actualDeleteRows({ action: "deleteAllRows" });
|
|
5261
|
+
}
|
|
5262
|
+
async deleteRows(index) {
|
|
5263
|
+
return this.actualDeleteRows({ index });
|
|
5264
|
+
}
|
|
5194
5265
|
async gotoPage(page) {
|
|
5195
5266
|
return this.asyncAction(async () => {
|
|
5196
5267
|
const res = await this.runAction({
|
|
@@ -5232,7 +5303,7 @@ class GridPaginated extends Grid {
|
|
|
5232
5303
|
await setAjaxFormResponse(this.form.execution, parseXml(evs));
|
|
5233
5304
|
}
|
|
5234
5305
|
if (res?.data?.success) {
|
|
5235
|
-
const currentSelectionIndices = this.controller.getSelectedRows().map((c) => c.
|
|
5306
|
+
const currentSelectionIndices = this.controller.getSelectedRows().map((c) => c.getIndex());
|
|
5236
5307
|
const currentPage = this.currentPage;
|
|
5237
5308
|
this.rebuildGrid(res.data.gridXml);
|
|
5238
5309
|
this.controller.clearSelection();
|
|
@@ -5273,7 +5344,7 @@ class GridPaginated extends Grid {
|
|
|
5273
5344
|
await setAjaxFormResponse(this.form.execution, parseXml(evs));
|
|
5274
5345
|
}
|
|
5275
5346
|
if (res?.data?.success) {
|
|
5276
|
-
const currentSelectionIndices = this.controller.getSelectedRows().map((c) => c.
|
|
5347
|
+
const currentSelectionIndices = this.controller.getSelectedRows().map((c) => c.getIndex());
|
|
5277
5348
|
const currentPage = this.currentPage;
|
|
5278
5349
|
this.rebuildGrid(res.data.gridXml);
|
|
5279
5350
|
this.controller.clearSelection();
|
|
@@ -5563,7 +5634,7 @@ class Tree extends FieldWithAttribute {
|
|
|
5563
5634
|
this.state.value = getValuesArray(this.properties.possibleValue);
|
|
5564
5635
|
this.controller = new MobXTree({
|
|
5565
5636
|
onSelect: (ev) => {
|
|
5566
|
-
if (isFieldShowAsText(this) || this.properties.disabled) {
|
|
5637
|
+
if (isFieldShowAsText(this) || this.properties.disabled || this.properties.readOnly || this.properties.readonly || this.getParentGrid()?.properties.readonly) {
|
|
5567
5638
|
return false;
|
|
5568
5639
|
} else {
|
|
5569
5640
|
const selection = [...ev.values()].map((c) => c.id);
|
|
@@ -6058,6 +6129,9 @@ class ApiaFieldWithAttribute extends ApiaField {
|
|
|
6058
6129
|
setValue(v) {
|
|
6059
6130
|
__privateGet$g(this, _field$c).setValue(v);
|
|
6060
6131
|
}
|
|
6132
|
+
_setValue(v, options) {
|
|
6133
|
+
__privateGet$g(this, _field$c).setValue(v, options);
|
|
6134
|
+
}
|
|
6061
6135
|
getLabel() {
|
|
6062
6136
|
return __privateGet$g(this, _field$c).attribute.title;
|
|
6063
6137
|
}
|
|
@@ -6809,6 +6883,11 @@ class GridField extends ApiaField {
|
|
|
6809
6883
|
})
|
|
6810
6884
|
);
|
|
6811
6885
|
}
|
|
6886
|
+
getSelectedIndexes(useAbsoluteIndex) {
|
|
6887
|
+
return __privateGet$6(this, _field$2).controller.getSelectedRows().map(
|
|
6888
|
+
(row) => row.getIndex() + (useAbsoluteIndex ? +noNaN$1(__privateGet$6(this, _field$2).startIndex) : 0)
|
|
6889
|
+
);
|
|
6890
|
+
}
|
|
6812
6891
|
getAllColumns() {
|
|
6813
6892
|
return __privateGet$6(this, _field$2).getAllColumns().map(
|
|
6814
6893
|
(c) => c.map((f) => createNewField(__privateGet$6(this, _field$2).getForm().execution, f))
|
|
@@ -6930,6 +7009,9 @@ class FileUploaderField extends ApiaFieldWithAttribute {
|
|
|
6930
7009
|
}
|
|
6931
7010
|
return null;
|
|
6932
7011
|
}
|
|
7012
|
+
async downloadDocument() {
|
|
7013
|
+
await __privateGet$5(this, _field$1).downloadDocument();
|
|
7014
|
+
}
|
|
6933
7015
|
}
|
|
6934
7016
|
_field$1 = new WeakMap();
|
|
6935
7017
|
|
|
@@ -7264,6 +7346,13 @@ class ApiaFunctions {
|
|
|
7264
7346
|
viewAdmEntity(entName, entNum) {
|
|
7265
7347
|
this.admEntity(entName, entNum);
|
|
7266
7348
|
}
|
|
7349
|
+
changeTab(index) {
|
|
7350
|
+
if (window.tabsController)
|
|
7351
|
+
window.tabsController.tabsList.forEach((tab, i) => {
|
|
7352
|
+
if (arrayOrArray(index).includes(i))
|
|
7353
|
+
tab.open();
|
|
7354
|
+
});
|
|
7355
|
+
}
|
|
7267
7356
|
}
|
|
7268
7357
|
_execution = new WeakMap();
|
|
7269
7358
|
|
|
@@ -8376,9 +8465,9 @@ class Entity {
|
|
|
8376
8465
|
}
|
|
8377
8466
|
deleteAssociation() {
|
|
8378
8467
|
const selectedRows = this.controller.getState("selection");
|
|
8379
|
-
const lastIdx = Array.from(selectedRows).pop()?.
|
|
8468
|
+
const lastIdx = Array.from(selectedRows).pop()?.getIndex();
|
|
8380
8469
|
[...selectedRows.values()].forEach((row) => {
|
|
8381
|
-
this.state.associations = this.state?.associations.filter((_, idx) => row.
|
|
8470
|
+
this.state.associations = this.state?.associations.filter((_, idx) => row.getIndex() !== idx) ?? [];
|
|
8382
8471
|
this.controller.body.removeRow(row);
|
|
8383
8472
|
});
|
|
8384
8473
|
if (lastIdx)
|
|
@@ -8457,7 +8546,8 @@ class Observations {
|
|
|
8457
8546
|
this.execution,
|
|
8458
8547
|
makeApiaUrl(this.execution, {
|
|
8459
8548
|
action: "getObservationsData",
|
|
8460
|
-
isAjax: true
|
|
8549
|
+
isAjax: true,
|
|
8550
|
+
isTask: !window.isMonitor ? true : false
|
|
8461
8551
|
})
|
|
8462
8552
|
);
|
|
8463
8553
|
if (!res?.data?.obData) {
|
|
@@ -8472,18 +8562,30 @@ class Observations {
|
|
|
8472
8562
|
chkRemAlert: false
|
|
8473
8563
|
};
|
|
8474
8564
|
this.state.newObservation = newObservation;
|
|
8565
|
+
this.areObservationsChecked();
|
|
8475
8566
|
}
|
|
8476
8567
|
}
|
|
8477
8568
|
getConfirmParams() {
|
|
8478
|
-
|
|
8569
|
+
const params = {
|
|
8479
8570
|
txtComment: this.state.newObservation?.commentValue,
|
|
8480
8571
|
chkAddAlert: this.state.newObservation?.chkAddAlert === true ? "on" : void 0,
|
|
8481
8572
|
chkAddAllAlert: this.state.newObservation?.chkAddAllAlert === true ? "on" : void 0,
|
|
8482
8573
|
chkRemAlert: this.state.newObservation?.chkRemAlert === true ? "on" : void 0
|
|
8483
8574
|
};
|
|
8575
|
+
const obs = this.state.observations ?? [];
|
|
8576
|
+
for (const o of obs) {
|
|
8577
|
+
if (!o || !o.name)
|
|
8578
|
+
continue;
|
|
8579
|
+
params[o.name] = o.checked === true ? "on" : void 0;
|
|
8580
|
+
}
|
|
8581
|
+
return params;
|
|
8484
8582
|
}
|
|
8485
8583
|
setPriority(newPriority) {
|
|
8486
8584
|
}
|
|
8585
|
+
areObservationsChecked() {
|
|
8586
|
+
const isChecked = this.state.observations?.some((o) => o.checked === true);
|
|
8587
|
+
return isChecked;
|
|
8588
|
+
}
|
|
8487
8589
|
}
|
|
8488
8590
|
|
|
8489
8591
|
let FlowModal$1 = class FlowModal {
|
|
@@ -8740,6 +8842,25 @@ async function defaultConfirm$1(execution, status) {
|
|
|
8740
8842
|
postDataTreatment: "stringify",
|
|
8741
8843
|
stringifyOptions: {
|
|
8742
8844
|
arrayFormat: "repeat"
|
|
8845
|
+
},
|
|
8846
|
+
xmlParser: (xml) => {
|
|
8847
|
+
const processStringObjPreserveValue = (value, key) => {
|
|
8848
|
+
if (key === "value" && typeof value === "string") {
|
|
8849
|
+
return value;
|
|
8850
|
+
}
|
|
8851
|
+
return processStringObj(value, key);
|
|
8852
|
+
};
|
|
8853
|
+
const baseOptions = getDefaultXmlParserOptions();
|
|
8854
|
+
baseOptions.attrValueProcessors = [
|
|
8855
|
+
customBooleanProcessor,
|
|
8856
|
+
processStringObjPreserveValue,
|
|
8857
|
+
processAjaxEventResponse
|
|
8858
|
+
];
|
|
8859
|
+
const parser = new xml2js.Parser(baseOptions);
|
|
8860
|
+
return getDefaultXmlPostProcessor()(
|
|
8861
|
+
xml,
|
|
8862
|
+
parser
|
|
8863
|
+
);
|
|
8743
8864
|
}
|
|
8744
8865
|
}
|
|
8745
8866
|
);
|
|
@@ -9113,6 +9234,7 @@ class Execution extends EventEmitter$1 {
|
|
|
9113
9234
|
__publicField(this, "_stepCount", 1);
|
|
9114
9235
|
__publicField(this, "notifications");
|
|
9115
9236
|
__publicField(this, "lastModalReturn", []);
|
|
9237
|
+
__publicField(this, "_pendingPromises", /* @__PURE__ */ new Set());
|
|
9116
9238
|
__publicField(this, "formsById", {
|
|
9117
9239
|
E: /* @__PURE__ */ new Map(),
|
|
9118
9240
|
P: /* @__PURE__ */ new Map()
|
|
@@ -9164,6 +9286,12 @@ class Execution extends EventEmitter$1 {
|
|
|
9164
9286
|
this.notifications = new Notifications(this);
|
|
9165
9287
|
makeObservable(this, { state: observable });
|
|
9166
9288
|
}
|
|
9289
|
+
addPendingPromise(promise) {
|
|
9290
|
+
this._pendingPromises.add(promise);
|
|
9291
|
+
promise.finally(() => {
|
|
9292
|
+
this._pendingPromises.delete(promise);
|
|
9293
|
+
});
|
|
9294
|
+
}
|
|
9167
9295
|
getAllForms() {
|
|
9168
9296
|
return [...this.forms.E.values(), ...this.forms.P.values()];
|
|
9169
9297
|
}
|
|
@@ -9259,21 +9387,21 @@ class Execution extends EventEmitter$1 {
|
|
|
9259
9387
|
for (let i = 1; i < Number(getWindow(this).STEP_QTY) + 1; i++) {
|
|
9260
9388
|
if (i < this._currentStep) {
|
|
9261
9389
|
this._steps.push({
|
|
9262
|
-
title:
|
|
9390
|
+
title: `${getLabel(this, "lblTraStep").text} ${i}`,
|
|
9263
9391
|
stepNumber: i,
|
|
9264
9392
|
status: "completed"
|
|
9265
9393
|
});
|
|
9266
9394
|
}
|
|
9267
9395
|
if (i > this._currentStep && i <= this._stepCount) {
|
|
9268
9396
|
this._steps.push({
|
|
9269
|
-
title:
|
|
9397
|
+
title: `${getLabel(this, "lblTraStep").text} ${i}`,
|
|
9270
9398
|
stepNumber: i,
|
|
9271
9399
|
status: "pending"
|
|
9272
9400
|
});
|
|
9273
9401
|
}
|
|
9274
9402
|
if (i === this._currentStep) {
|
|
9275
9403
|
this._steps.push({
|
|
9276
|
-
title:
|
|
9404
|
+
title: `${getLabel(this, "lblTraStep").text} ${i}`,
|
|
9277
9405
|
stepNumber: i,
|
|
9278
9406
|
status: "current"
|
|
9279
9407
|
});
|
|
@@ -9533,7 +9661,8 @@ class Execution extends EventEmitter$1 {
|
|
|
9533
9661
|
makeApiaUrl(this, {
|
|
9534
9662
|
action: "saveTask",
|
|
9535
9663
|
asXML: true,
|
|
9536
|
-
react: true
|
|
9664
|
+
react: true,
|
|
9665
|
+
currentTab: getCurrentTabsString(this)
|
|
9537
9666
|
}),
|
|
9538
9667
|
{
|
|
9539
9668
|
postData: {
|
|
@@ -9622,6 +9751,12 @@ class Execution extends EventEmitter$1 {
|
|
|
9622
9751
|
unlock();
|
|
9623
9752
|
}
|
|
9624
9753
|
}
|
|
9754
|
+
async waitForPendingSyncs() {
|
|
9755
|
+
if (this._pendingPromises.size === 0)
|
|
9756
|
+
return;
|
|
9757
|
+
const pending = Array.from(this._pendingPromises);
|
|
9758
|
+
await Promise.allSettled(pending);
|
|
9759
|
+
}
|
|
9625
9760
|
}
|
|
9626
9761
|
|
|
9627
9762
|
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 };
|