@apia/execution 4.0.41 → 4.0.43
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 +7 -3
- package/dist/index.js +89 -69
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
package/dist/index.d.ts
CHANGED
|
@@ -1042,7 +1042,7 @@ declare class ApiaForm implements IApiaForm {
|
|
|
1042
1042
|
getAllFields(): IApiaField[];
|
|
1043
1043
|
clearForm(clearReadonlyFields: boolean, deleteGridsRows: boolean): void;
|
|
1044
1044
|
hideModal(): void;
|
|
1045
|
-
showAsModal(): void;
|
|
1045
|
+
showAsModal(size?: TModalSize): void;
|
|
1046
1046
|
}
|
|
1047
1047
|
|
|
1048
1048
|
declare abstract class ApiaField<Props extends typeof FieldConstants = typeof FieldConstants> implements IApiaField<Props> {
|
|
@@ -3076,6 +3076,7 @@ type TExecutionConfig = {
|
|
|
3076
3076
|
canShare: boolean;
|
|
3077
3077
|
isEntity?: boolean;
|
|
3078
3078
|
};
|
|
3079
|
+
type TModalSize = 'editGrid' | 'sm' | 'md' | 'md-fixed' | 'lg' | 'lg-fixed' | 'xl' | 'xl-fixed' | 'xxl' | 'xxxl' | 'xxxl-fixed' | 'flex' | 'cal' | 'finder' | 'fileModal';
|
|
3079
3080
|
type TExecutionEnvironment = {
|
|
3080
3081
|
fieldsMapping?: FieldsMapping;
|
|
3081
3082
|
window: Window;
|
|
@@ -3090,7 +3091,10 @@ declare class Execution extends EventEmitter$1<{
|
|
|
3090
3091
|
flow: 'previous' | 'confirm' | 'next' | 'save' | 'release' | 'share' | 'viewDocs' | 'print' | 'delegate';
|
|
3091
3092
|
sendToDesktop: null;
|
|
3092
3093
|
hideFormModal: Form;
|
|
3093
|
-
showFormAsModal:
|
|
3094
|
+
showFormAsModal: {
|
|
3095
|
+
form: Form;
|
|
3096
|
+
size?: TModalSize;
|
|
3097
|
+
};
|
|
3094
3098
|
}> {
|
|
3095
3099
|
environment: TExecutionEnvironment;
|
|
3096
3100
|
fieldsMapping: FieldsMapping;
|
|
@@ -3601,7 +3605,7 @@ declare class Grid extends Field<GridProps, GridDefinition, GridState> {
|
|
|
3601
3605
|
definition: Omit<TApiaFieldBaseDefinition<TApiaFieldCommonProperties>, "properties">;
|
|
3602
3606
|
}>[];
|
|
3603
3607
|
protected rebuildGrid(xmlString: string | TApiaGridDefinition): Promise<void>;
|
|
3604
|
-
protected runAction<T extends Record<string, any>>(
|
|
3608
|
+
protected runAction<T extends Record<string, any>>(postData: IApiaApiPostConfig<Record<string, any>>): Promise<TApiaApiAxiosResponse<(T & ResponseSysMessages) | null> | null>;
|
|
3605
3609
|
private swapRows;
|
|
3606
3610
|
toggleMaximize(): void;
|
|
3607
3611
|
}
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ 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';
|
|
@@ -1062,10 +1062,16 @@ const setAjaxFormResponse = async (execution, response) => {
|
|
|
1062
1062
|
)) {
|
|
1063
1063
|
apiField.setProperty(
|
|
1064
1064
|
"possibleValue",
|
|
1065
|
-
items.map((current) =>
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1065
|
+
items.map((current) => {
|
|
1066
|
+
const v = current.v;
|
|
1067
|
+
const l = current.text;
|
|
1068
|
+
const value = typeof v === "boolean" ? String(v) : v;
|
|
1069
|
+
const label = typeof l === "boolean" ? String(l) : l;
|
|
1070
|
+
return {
|
|
1071
|
+
value,
|
|
1072
|
+
label
|
|
1073
|
+
};
|
|
1074
|
+
})
|
|
1069
1075
|
);
|
|
1070
1076
|
}
|
|
1071
1077
|
}
|
|
@@ -1125,7 +1131,15 @@ const setAjaxFormResponse = async (execution, response) => {
|
|
|
1125
1131
|
const prop = arrayOrArray(ajaxProps[c]?.f);
|
|
1126
1132
|
for (let p = 0; p < prop.length; p += 1) {
|
|
1127
1133
|
if (prop[p]?.i) {
|
|
1128
|
-
|
|
1134
|
+
if (prop[p]?.i) {
|
|
1135
|
+
if (prop[p]?.v.toLowerCase() === "f") {
|
|
1136
|
+
apiField.setProperty(prop[p]?.i, false);
|
|
1137
|
+
} else if (prop[p]?.v.toLowerCase() === "t") {
|
|
1138
|
+
apiField.setProperty(prop[p]?.i, true);
|
|
1139
|
+
} else {
|
|
1140
|
+
apiField.setProperty(prop[p]?.i, prop[p]?.v);
|
|
1141
|
+
}
|
|
1142
|
+
}
|
|
1129
1143
|
}
|
|
1130
1144
|
}
|
|
1131
1145
|
}
|
|
@@ -1627,7 +1641,13 @@ class FieldWithAttribute extends Field {
|
|
|
1627
1641
|
async getInitialValue({
|
|
1628
1642
|
value
|
|
1629
1643
|
}) {
|
|
1630
|
-
|
|
1644
|
+
if (value === void 0 || value === null) {
|
|
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
|
+
}
|
|
1631
1651
|
}
|
|
1632
1652
|
getValidationState() {
|
|
1633
1653
|
return this.state.validation;
|
|
@@ -1758,7 +1778,7 @@ class FieldWithAttribute extends Field {
|
|
|
1758
1778
|
valueType: this.attribute.valueType,
|
|
1759
1779
|
value: this.state.value
|
|
1760
1780
|
});
|
|
1761
|
-
this.state.value = initialValue
|
|
1781
|
+
this.state.value = initialValue ?? "";
|
|
1762
1782
|
}
|
|
1763
1783
|
}
|
|
1764
1784
|
_lastOnChangeValue = new WeakMap();
|
|
@@ -2982,8 +3002,11 @@ class UploaderApi extends EventEmitter$1 {
|
|
|
2982
3002
|
async version(file, conf = { newFiles: [] }) {
|
|
2983
3003
|
const checkLock = await this.checkLockDocument(file.docId, true);
|
|
2984
3004
|
const isLocked = await this.checkWebDavLock(file.docId);
|
|
2985
|
-
if (checkLock === true && isLocked)
|
|
2986
|
-
|
|
3005
|
+
if (!(checkLock === true && isLocked))
|
|
3006
|
+
return;
|
|
3007
|
+
this.state.versioningFile = file;
|
|
3008
|
+
const openVersionModal = () => {
|
|
3009
|
+
if (!this.modalConfig.oneClickUpload) {
|
|
2987
3010
|
this.modalController = new UploaderModalController(
|
|
2988
3011
|
this,
|
|
2989
3012
|
this.modalConfig,
|
|
@@ -2993,36 +3016,30 @@ class UploaderApi extends EventEmitter$1 {
|
|
|
2993
3016
|
);
|
|
2994
3017
|
this.modalController.openModal();
|
|
2995
3018
|
}
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
versionFile: file
|
|
3015
|
-
}
|
|
3016
|
-
);
|
|
3017
|
-
this.modalController.openModal();
|
|
3018
|
-
}
|
|
3019
|
-
}
|
|
3020
|
-
} else {
|
|
3021
|
-
await this.reloadMetadata({
|
|
3022
|
-
docId: file.docId,
|
|
3023
|
-
docTypeId: file.docTypeId
|
|
3024
|
-
});
|
|
3019
|
+
};
|
|
3020
|
+
if (!conf.newFiles || conf.newFiles.length === 0) {
|
|
3021
|
+
openVersionModal();
|
|
3022
|
+
}
|
|
3023
|
+
await this.ajaxUploadStart();
|
|
3024
|
+
if (file.docTypeId)
|
|
3025
|
+
this.state.selectedDocTypeId = file.docTypeId;
|
|
3026
|
+
await this.versionFileInfo(file);
|
|
3027
|
+
const hasNewFiles = !!(conf.newFiles && conf.newFiles.length > 0);
|
|
3028
|
+
if (hasNewFiles) {
|
|
3029
|
+
const res = await this.saveDroppedFiles(conf.newFiles, {
|
|
3030
|
+
langId: conf.langId,
|
|
3031
|
+
translatingFile: conf.translatingFile,
|
|
3032
|
+
shouldReset: false,
|
|
3033
|
+
strictMode: true
|
|
3034
|
+
});
|
|
3035
|
+
if (res) {
|
|
3036
|
+
openVersionModal();
|
|
3025
3037
|
}
|
|
3038
|
+
} else {
|
|
3039
|
+
await this.reloadMetadata({
|
|
3040
|
+
docId: file.docId,
|
|
3041
|
+
docTypeId: file.docTypeId
|
|
3042
|
+
});
|
|
3026
3043
|
}
|
|
3027
3044
|
}
|
|
3028
3045
|
async versionFileInfo(file) {
|
|
@@ -3382,7 +3399,9 @@ class UploaderApi extends EventEmitter$1 {
|
|
|
3382
3399
|
const versioningFile = this.state.versioningFile;
|
|
3383
3400
|
if (versioningFile)
|
|
3384
3401
|
return files;
|
|
3385
|
-
const uploadedFiles = this.state.
|
|
3402
|
+
const uploadedFiles = Object.values(this.state.files).filter(
|
|
3403
|
+
(file) => Number(file.docId) > 0
|
|
3404
|
+
);
|
|
3386
3405
|
const existingFiles = [];
|
|
3387
3406
|
const nonExistingFiles = [];
|
|
3388
3407
|
if (conf?.langId) {
|
|
@@ -3395,7 +3414,7 @@ class UploaderApi extends EventEmitter$1 {
|
|
|
3395
3414
|
existingFiles.push(files[0]);
|
|
3396
3415
|
} else
|
|
3397
3416
|
files.forEach((file) => {
|
|
3398
|
-
if (uploadedFiles.find((search) => search.
|
|
3417
|
+
if (uploadedFiles.find((search) => search.docName === file.name)) {
|
|
3399
3418
|
existingFiles.push(file);
|
|
3400
3419
|
} else
|
|
3401
3420
|
nonExistingFiles.push(file);
|
|
@@ -3528,15 +3547,6 @@ class UploaderApi extends EventEmitter$1 {
|
|
|
3528
3547
|
}
|
|
3529
3548
|
return newFiles;
|
|
3530
3549
|
}
|
|
3531
|
-
if (files.length === 1 && conf?.translatingFile === void 0 && conf?.langId === void 0) {
|
|
3532
|
-
const actualVersioningFile = Object.values(this.state.files).find(
|
|
3533
|
-
(c) => (c.name || c.docName) === files[0].name
|
|
3534
|
-
);
|
|
3535
|
-
if (actualVersioningFile) {
|
|
3536
|
-
if (actualVersioningFile.isLockedByMe)
|
|
3537
|
-
this.state.versioningFile = actualVersioningFile;
|
|
3538
|
-
}
|
|
3539
|
-
}
|
|
3540
3550
|
return files;
|
|
3541
3551
|
}
|
|
3542
3552
|
getLoadFileSystemStructureTree() {
|
|
@@ -4411,7 +4421,8 @@ class Grid extends Field {
|
|
|
4411
4421
|
const res = this.runAction({
|
|
4412
4422
|
postData: {
|
|
4413
4423
|
gridAction: "add",
|
|
4414
|
-
addRowsCount: 1
|
|
4424
|
+
addRowsCount: 1,
|
|
4425
|
+
fireEvents: this.hasServerAjaxEventsOfType("gridAdd")
|
|
4415
4426
|
}
|
|
4416
4427
|
});
|
|
4417
4428
|
const response = await res;
|
|
@@ -4462,7 +4473,8 @@ class Grid extends Field {
|
|
|
4462
4473
|
return this.asyncAction(async () => {
|
|
4463
4474
|
const res = this.runAction({
|
|
4464
4475
|
postData: {
|
|
4465
|
-
gridAction: "delete"
|
|
4476
|
+
gridAction: "delete",
|
|
4477
|
+
fireEvents: this.hasServerAjaxEventsOfType("gridDelete")
|
|
4466
4478
|
}
|
|
4467
4479
|
});
|
|
4468
4480
|
const currentRows = [...this.tableController.body.rows];
|
|
@@ -4519,7 +4531,8 @@ class Grid extends Field {
|
|
|
4519
4531
|
const res = this.runAction({
|
|
4520
4532
|
postData: {
|
|
4521
4533
|
gridAction: "delete",
|
|
4522
|
-
rowId: deletingIndices
|
|
4534
|
+
rowId: deletingIndices,
|
|
4535
|
+
fireEvents: this.hasServerAjaxEventsOfType("gridDelete")
|
|
4523
4536
|
}
|
|
4524
4537
|
});
|
|
4525
4538
|
const currentRows = [...this.tableController.body.rows];
|
|
@@ -4770,7 +4783,8 @@ class Grid extends Field {
|
|
|
4770
4783
|
const res = this.runAction({
|
|
4771
4784
|
postData: {
|
|
4772
4785
|
gridAction: "down",
|
|
4773
|
-
rowId: indices
|
|
4786
|
+
rowId: indices,
|
|
4787
|
+
fireEvents: this.hasServerAjaxEventsOfType("gridSort")
|
|
4774
4788
|
}
|
|
4775
4789
|
});
|
|
4776
4790
|
this.swapRows(indices, "down");
|
|
@@ -4808,7 +4822,8 @@ class Grid extends Field {
|
|
|
4808
4822
|
const res = this.runAction({
|
|
4809
4823
|
postData: {
|
|
4810
4824
|
gridAction: "up",
|
|
4811
|
-
rowId: indices
|
|
4825
|
+
rowId: indices,
|
|
4826
|
+
fireEvents: this.hasServerAjaxEventsOfType("gridSort")
|
|
4812
4827
|
}
|
|
4813
4828
|
});
|
|
4814
4829
|
this.swapRows(indices, "up");
|
|
@@ -4946,14 +4961,6 @@ class Grid extends Field {
|
|
|
4946
4961
|
this.tableController.clearSelection();
|
|
4947
4962
|
this.tableController.toggleRowSelection(newRow, true);
|
|
4948
4963
|
}
|
|
4949
|
-
for (let i = 0; i < 10; i++) {
|
|
4950
|
-
if (newRow.cells[0]?.getTable() instanceof TableController) {
|
|
4951
|
-
newRow.cells[0]?.focus();
|
|
4952
|
-
break;
|
|
4953
|
-
} else {
|
|
4954
|
-
await awaitTime(50);
|
|
4955
|
-
}
|
|
4956
|
-
}
|
|
4957
4964
|
return newRow;
|
|
4958
4965
|
}
|
|
4959
4966
|
async asyncAction(cb, mutex = true) {
|
|
@@ -5055,7 +5062,7 @@ class Grid extends Field {
|
|
|
5055
5062
|
});
|
|
5056
5063
|
this.refreshColumnsVisibilities();
|
|
5057
5064
|
}
|
|
5058
|
-
async runAction(
|
|
5065
|
+
async runAction(postData) {
|
|
5059
5066
|
return post(
|
|
5060
5067
|
this.form.execution,
|
|
5061
5068
|
await makeApiaUrl(this.form.execution, {
|
|
@@ -5068,7 +5075,7 @@ class Grid extends Field {
|
|
|
5068
5075
|
{
|
|
5069
5076
|
postDataTreatment: "stringify",
|
|
5070
5077
|
stringifyOptions: { arrayFormat: "repeat" },
|
|
5071
|
-
...
|
|
5078
|
+
...postData
|
|
5072
5079
|
}
|
|
5073
5080
|
);
|
|
5074
5081
|
}
|
|
@@ -7057,8 +7064,8 @@ class ApiaForm {
|
|
|
7057
7064
|
hideModal() {
|
|
7058
7065
|
__privateGet$3(this, _execution$1).emit("hideFormModal", __privateGet$3(this, _form));
|
|
7059
7066
|
}
|
|
7060
|
-
showAsModal() {
|
|
7061
|
-
__privateGet$3(this, _execution$1).emit("showFormAsModal", __privateGet$3(this, _form));
|
|
7067
|
+
showAsModal(size) {
|
|
7068
|
+
__privateGet$3(this, _execution$1).emit("showFormAsModal", { form: __privateGet$3(this, _form), size });
|
|
7062
7069
|
}
|
|
7063
7070
|
}
|
|
7064
7071
|
_form = new WeakMap();
|
|
@@ -7465,7 +7472,7 @@ class CustomComponent {
|
|
|
7465
7472
|
}),
|
|
7466
7473
|
{
|
|
7467
7474
|
postData: typeof body === "string" ? {
|
|
7468
|
-
payload: body
|
|
7475
|
+
payload: encodeStrToBase64Utf8(body)
|
|
7469
7476
|
} : body,
|
|
7470
7477
|
postDataTreatment: "stringify"
|
|
7471
7478
|
}
|
|
@@ -8616,6 +8623,9 @@ function buildPathSelection(execution, status, form) {
|
|
|
8616
8623
|
})
|
|
8617
8624
|
);
|
|
8618
8625
|
return { ...status, step: void 0, finishedWithError: true };
|
|
8626
|
+
} else if (parsedRes.load?.canClose) {
|
|
8627
|
+
execution.state.executionState = ExecutionState.FINISHED;
|
|
8628
|
+
return buildConfirmMessage(status, parsedRes.load?.text?.content ?? "");
|
|
8619
8629
|
}
|
|
8620
8630
|
return { ...status, step: void 0, finishedWithError: true };
|
|
8621
8631
|
} else {
|
|
@@ -9524,7 +9534,17 @@ class Execution extends EventEmitter$1 {
|
|
|
9524
9534
|
action: "saveTask",
|
|
9525
9535
|
asXML: true,
|
|
9526
9536
|
react: true
|
|
9527
|
-
})
|
|
9537
|
+
}),
|
|
9538
|
+
{
|
|
9539
|
+
postData: {
|
|
9540
|
+
...this.observations.getConfirmParams(),
|
|
9541
|
+
...this.process.getConfirmParams()
|
|
9542
|
+
},
|
|
9543
|
+
postDataTreatment: "stringify",
|
|
9544
|
+
stringifyOptions: {
|
|
9545
|
+
arrayFormat: "repeat"
|
|
9546
|
+
}
|
|
9547
|
+
}
|
|
9528
9548
|
);
|
|
9529
9549
|
const canClose = response?.data?.load?.canClose;
|
|
9530
9550
|
if (canClose) {
|