@apia/execution 4.0.40 → 4.0.42
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 +3 -8
- package/dist/index.js +72 -33
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
package/dist/index.d.ts
CHANGED
|
@@ -2300,7 +2300,8 @@ declare class UploaderApi extends EventEmitter$1<{
|
|
|
2300
2300
|
shouldReset?: boolean;
|
|
2301
2301
|
}): File[];
|
|
2302
2302
|
parseFileDefinition: (file: TFileUploaded) => TUploaderFileInfo;
|
|
2303
|
-
getLoadFileSystemStructureTree
|
|
2303
|
+
getLoadFileSystemStructureTree(): Record<string, unknown>;
|
|
2304
|
+
getLoadFilesForFolderParameters(): Record<string, unknown>;
|
|
2304
2305
|
}
|
|
2305
2306
|
|
|
2306
2307
|
declare class UploaderModalController {
|
|
@@ -3396,13 +3397,7 @@ declare class Captcha extends Field<TApiaCaptchaProperties, TApiaCaptchaDefiniti
|
|
|
3396
3397
|
type CheckboxEvents = 'onClick';
|
|
3397
3398
|
declare class Checkbox extends FieldWithAttribute<TApiaCheckboxProperties, boolean> {
|
|
3398
3399
|
fireEvent(eventName: CheckboxEvents, options?: TFireEventOptions): Promise<boolean>;
|
|
3399
|
-
protected getInitialValue({ value,
|
|
3400
|
-
setValue(newValue: boolean, options?: Partial<{
|
|
3401
|
-
comparator: Comparator$1<any>;
|
|
3402
|
-
format: 'd/m/Y' | 'apia';
|
|
3403
|
-
markAsDirty: boolean;
|
|
3404
|
-
synchronize: boolean;
|
|
3405
|
-
}> | undefined): Promise<boolean>;
|
|
3400
|
+
protected getInitialValue({ value, }: TApiaFieldWithAttributeBaseProps<TApiaCheckboxProperties>): Promise<boolean>;
|
|
3406
3401
|
}
|
|
3407
3402
|
|
|
3408
3403
|
type EditorEvents = 'onChange';
|
package/dist/index.js
CHANGED
|
@@ -10,7 +10,6 @@ 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
|
-
import { ApiaUtil } from '@apia/components';
|
|
14
13
|
|
|
15
14
|
const deepEqual = (a, b) => {
|
|
16
15
|
if (Object.is(a, b))
|
|
@@ -1063,10 +1062,16 @@ const setAjaxFormResponse = async (execution, response) => {
|
|
|
1063
1062
|
)) {
|
|
1064
1063
|
apiField.setProperty(
|
|
1065
1064
|
"possibleValue",
|
|
1066
|
-
items.map((current) =>
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
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
|
+
})
|
|
1070
1075
|
);
|
|
1071
1076
|
}
|
|
1072
1077
|
}
|
|
@@ -1126,7 +1131,15 @@ const setAjaxFormResponse = async (execution, response) => {
|
|
|
1126
1131
|
const prop = arrayOrArray(ajaxProps[c]?.f);
|
|
1127
1132
|
for (let p = 0; p < prop.length; p += 1) {
|
|
1128
1133
|
if (prop[p]?.i) {
|
|
1129
|
-
|
|
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
|
+
}
|
|
1130
1143
|
}
|
|
1131
1144
|
}
|
|
1132
1145
|
}
|
|
@@ -1628,7 +1641,13 @@ class FieldWithAttribute extends Field {
|
|
|
1628
1641
|
async getInitialValue({
|
|
1629
1642
|
value
|
|
1630
1643
|
}) {
|
|
1631
|
-
|
|
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
|
+
}
|
|
1632
1651
|
}
|
|
1633
1652
|
getValidationState() {
|
|
1634
1653
|
return this.state.validation;
|
|
@@ -1759,7 +1778,7 @@ class FieldWithAttribute extends Field {
|
|
|
1759
1778
|
valueType: this.attribute.valueType,
|
|
1760
1779
|
value: this.state.value
|
|
1761
1780
|
});
|
|
1762
|
-
this.state.value = initialValue
|
|
1781
|
+
this.state.value = initialValue ?? "";
|
|
1763
1782
|
}
|
|
1764
1783
|
}
|
|
1765
1784
|
_lastOnChangeValue = new WeakMap();
|
|
@@ -1769,16 +1788,9 @@ class Checkbox extends FieldWithAttribute {
|
|
|
1769
1788
|
return super.fireEvent(eventName, options);
|
|
1770
1789
|
}
|
|
1771
1790
|
getInitialValue({
|
|
1772
|
-
value
|
|
1773
|
-
properties
|
|
1791
|
+
value
|
|
1774
1792
|
}) {
|
|
1775
|
-
return value ===
|
|
1776
|
-
}
|
|
1777
|
-
setValue(newValue, options) {
|
|
1778
|
-
if (newValue !== "") {
|
|
1779
|
-
return super.setValue(isTrue(newValue), options);
|
|
1780
|
-
}
|
|
1781
|
-
return Promise.resolve(false);
|
|
1793
|
+
return value === "" || value === void 0 ? Promise.resolve(false) : value;
|
|
1782
1794
|
}
|
|
1783
1795
|
}
|
|
1784
1796
|
|
|
@@ -2362,11 +2374,6 @@ class UploaderApi extends EventEmitter$1 {
|
|
|
2362
2374
|
canRead: file.canRead
|
|
2363
2375
|
};
|
|
2364
2376
|
});
|
|
2365
|
-
__publicField$i(this, "getLoadFileSystemStructureTree", () => ({
|
|
2366
|
-
useDocTypePermitted: true,
|
|
2367
|
-
docTypePermittedObjId: this.docTypePermittedObjId,
|
|
2368
|
-
docTypePermittedObjType: this.type
|
|
2369
|
-
}));
|
|
2370
2377
|
if (!getWindow(this.execution).fileApi) {
|
|
2371
2378
|
getWindow(this.execution).fileApi = {};
|
|
2372
2379
|
}
|
|
@@ -2996,7 +3003,7 @@ class UploaderApi extends EventEmitter$1 {
|
|
|
2996
3003
|
const checkLock = await this.checkLockDocument(file.docId, true);
|
|
2997
3004
|
const isLocked = await this.checkWebDavLock(file.docId);
|
|
2998
3005
|
if (checkLock === true && isLocked) {
|
|
2999
|
-
if (!this.modalConfig.oneClickUpload) {
|
|
3006
|
+
if (!this.modalConfig.oneClickUpload && conf.newFiles?.length === 0) {
|
|
3000
3007
|
this.modalController = new UploaderModalController(
|
|
3001
3008
|
this,
|
|
3002
3009
|
this.modalConfig,
|
|
@@ -3012,12 +3019,24 @@ class UploaderApi extends EventEmitter$1 {
|
|
|
3012
3019
|
this.state.selectedDocTypeId = file.docTypeId;
|
|
3013
3020
|
await this.versionFileInfo(file);
|
|
3014
3021
|
if (conf.newFiles && conf.newFiles.length > 0) {
|
|
3015
|
-
await this.saveDroppedFiles(conf.newFiles, {
|
|
3022
|
+
const res = await this.saveDroppedFiles(conf.newFiles, {
|
|
3016
3023
|
langId: conf.langId,
|
|
3017
3024
|
translatingFile: conf.translatingFile,
|
|
3018
3025
|
shouldReset: false,
|
|
3019
3026
|
strictMode: true
|
|
3020
3027
|
});
|
|
3028
|
+
if (res) {
|
|
3029
|
+
if (!this.modalConfig.oneClickUpload) {
|
|
3030
|
+
this.modalController = new UploaderModalController(
|
|
3031
|
+
this,
|
|
3032
|
+
this.modalConfig,
|
|
3033
|
+
{
|
|
3034
|
+
versionFile: file
|
|
3035
|
+
}
|
|
3036
|
+
);
|
|
3037
|
+
this.modalController.openModal();
|
|
3038
|
+
}
|
|
3039
|
+
}
|
|
3021
3040
|
} else {
|
|
3022
3041
|
await this.reloadMetadata({
|
|
3023
3042
|
docId: file.docId,
|
|
@@ -3496,7 +3515,7 @@ class UploaderApi extends EventEmitter$1 {
|
|
|
3496
3515
|
if (conf?.langId)
|
|
3497
3516
|
return files;
|
|
3498
3517
|
const currentFiles = this.state.inProgressFiles;
|
|
3499
|
-
const alreadyUploadedFiles = this.
|
|
3518
|
+
const alreadyUploadedFiles = Object.values(this.state.files).filter(
|
|
3500
3519
|
(current) => Number(current.docId) < 0
|
|
3501
3520
|
);
|
|
3502
3521
|
let alreadyIncludedFileNames = "";
|
|
@@ -3540,6 +3559,20 @@ class UploaderApi extends EventEmitter$1 {
|
|
|
3540
3559
|
}
|
|
3541
3560
|
return files;
|
|
3542
3561
|
}
|
|
3562
|
+
getLoadFileSystemStructureTree() {
|
|
3563
|
+
return {
|
|
3564
|
+
useDocTypePermitted: true,
|
|
3565
|
+
docTypePermittedObjId: this.docTypePermittedObjId,
|
|
3566
|
+
docTypePermittedObjType: this.type
|
|
3567
|
+
};
|
|
3568
|
+
}
|
|
3569
|
+
getLoadFilesForFolderParameters() {
|
|
3570
|
+
return {
|
|
3571
|
+
useDocTypePermitted: true,
|
|
3572
|
+
docTypePermittedObjId: this.docTypePermittedObjId,
|
|
3573
|
+
docTypePermittedObjType: this.type
|
|
3574
|
+
};
|
|
3575
|
+
}
|
|
3543
3576
|
}
|
|
3544
3577
|
|
|
3545
3578
|
var __defProp$h = Object.defineProperty;
|
|
@@ -5027,12 +5060,15 @@ class Grid extends Field {
|
|
|
5027
5060
|
if (field instanceof File) {
|
|
5028
5061
|
field.loadFromDefinition(state.file_prp);
|
|
5029
5062
|
} else if (field instanceof ModalInput) {
|
|
5030
|
-
field.setValue(
|
|
5031
|
-
|
|
5032
|
-
|
|
5033
|
-
|
|
5063
|
+
field.setValue(
|
|
5064
|
+
{
|
|
5065
|
+
showValue: state.qry_show_value || "",
|
|
5066
|
+
storeValue: state.value || ""
|
|
5067
|
+
},
|
|
5068
|
+
{ force: true }
|
|
5069
|
+
);
|
|
5034
5070
|
} else if (field instanceof FieldWithAttribute) {
|
|
5035
|
-
field.setValue(state.value, { synchronize: false });
|
|
5071
|
+
field.setValue(state.value, { synchronize: false, force: true });
|
|
5036
5072
|
}
|
|
5037
5073
|
}
|
|
5038
5074
|
});
|
|
@@ -5413,7 +5449,7 @@ class Radio extends FieldWithAttribute {
|
|
|
5413
5449
|
return super.fireEvent(eventName, options);
|
|
5414
5450
|
}
|
|
5415
5451
|
getTextValue(value) {
|
|
5416
|
-
return this.
|
|
5452
|
+
return this.properties.possibleValue ? arrayOrArray(this.properties.possibleValue).find(
|
|
5417
5453
|
(c) => c.value === value
|
|
5418
5454
|
)?.label : value;
|
|
5419
5455
|
}
|
|
@@ -5443,7 +5479,7 @@ class Select extends FieldWithAttribute {
|
|
|
5443
5479
|
return conf;
|
|
5444
5480
|
}
|
|
5445
5481
|
getTextValue(value) {
|
|
5446
|
-
return this.
|
|
5482
|
+
return this.properties.possibleValue ? arrayOrArray(this.properties.possibleValue).find(
|
|
5447
5483
|
(c) => c.value === value
|
|
5448
5484
|
)?.label : value;
|
|
5449
5485
|
}
|
|
@@ -8600,6 +8636,9 @@ function buildPathSelection(execution, status, form) {
|
|
|
8600
8636
|
})
|
|
8601
8637
|
);
|
|
8602
8638
|
return { ...status, step: void 0, finishedWithError: true };
|
|
8639
|
+
} else if (parsedRes.load?.canClose) {
|
|
8640
|
+
execution.state.executionState = ExecutionState.FINISHED;
|
|
8641
|
+
return buildConfirmMessage(status, parsedRes.load?.text?.content ?? "");
|
|
8603
8642
|
}
|
|
8604
8643
|
return { ...status, step: void 0, finishedWithError: true };
|
|
8605
8644
|
} else {
|
|
@@ -9013,7 +9052,7 @@ async function defaultConfirm(execution, status) {
|
|
|
9013
9052
|
}
|
|
9014
9053
|
const url = arrayOrArray(confirmResponse.data.actions?.action.param)[1];
|
|
9015
9054
|
if (url === "callNavigateClose") {
|
|
9016
|
-
ApiaUtil.
|
|
9055
|
+
(getWindow(execution)?.top?.ApiaUtil).tabs.currentTab.close(true);
|
|
9017
9056
|
} else {
|
|
9018
9057
|
const c = new Url(url);
|
|
9019
9058
|
getWindow(execution).location.assign(
|