@apia/execution 4.0.31 → 4.0.33
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 +17 -7
- package/dist/index.js +126 -35
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
package/dist/index.d.ts
CHANGED
|
@@ -2244,6 +2244,7 @@ declare class UploaderApi extends EventEmitter$1<{
|
|
|
2244
2244
|
markedToSign: boolean;
|
|
2245
2245
|
} & ResponseSysMessages) | null> | null>;
|
|
2246
2246
|
editDocument(id: string): Promise<void>;
|
|
2247
|
+
downloadVersion(fileId: string, version?: string): Promise<void>;
|
|
2247
2248
|
downloadDocument(id: string, version?: string): Promise<void>;
|
|
2248
2249
|
ajaxDeleteDocument(id: string, langId?: number): Promise<void>;
|
|
2249
2250
|
version(file: TUploaderFileInfo, conf?: {
|
|
@@ -2710,6 +2711,7 @@ declare class FormsUploader extends UploaderApi {
|
|
|
2710
2711
|
getProcessDroppedFilesPostdata: ({ useDocTypePermitted, docTypePermittedObjId, docTypePermittedObjType, ...parameters }: Record<string, unknown>) => Record<string, unknown>;
|
|
2711
2712
|
getReloadMetadataParameters: (defaultParameters: Record<string, unknown>) => Record<string, unknown>;
|
|
2712
2713
|
getSaveDroppedFilesParameters: (defaultParameters: Record<string, unknown>) => Record<string, unknown>;
|
|
2714
|
+
downloadVersion(fileId: string, version?: string): Promise<void>;
|
|
2713
2715
|
downloadDocument(fileId: string, version?: string): Promise<void>;
|
|
2714
2716
|
loadCurrentDocuments(): Promise<void>;
|
|
2715
2717
|
parseFileDefinition: (file: TFileUploaded) => TUploaderFileInfo;
|
|
@@ -2742,7 +2744,7 @@ type TEntity = {
|
|
|
2742
2744
|
title: string;
|
|
2743
2745
|
readOnly: boolean;
|
|
2744
2746
|
separator: string;
|
|
2745
|
-
associations:
|
|
2747
|
+
associations: Association[];
|
|
2746
2748
|
date: {
|
|
2747
2749
|
label: string;
|
|
2748
2750
|
toolTip: string;
|
|
@@ -2825,10 +2827,13 @@ type PoolId = {
|
|
|
2825
2827
|
poolName: string;
|
|
2826
2828
|
canUpdate: boolean;
|
|
2827
2829
|
};
|
|
2828
|
-
type
|
|
2830
|
+
type Association = {
|
|
2829
2831
|
asocName: string;
|
|
2830
2832
|
asocId: string;
|
|
2831
2833
|
asocRelName: string;
|
|
2834
|
+
errorNameMessage?: string;
|
|
2835
|
+
errorRelNameMessage?: string;
|
|
2836
|
+
focusTarget?: boolean;
|
|
2832
2837
|
};
|
|
2833
2838
|
|
|
2834
2839
|
declare class Entity {
|
|
@@ -2840,13 +2845,15 @@ declare class Entity {
|
|
|
2840
2845
|
get name(): string | undefined;
|
|
2841
2846
|
private hasInited;
|
|
2842
2847
|
init(): Promise<void>;
|
|
2848
|
+
addAssociation(): void;
|
|
2843
2849
|
getConfirmParams(): any;
|
|
2844
|
-
loadCategories: () => Promise<void>;
|
|
2845
|
-
loadPools: () => Promise<void>;
|
|
2846
|
-
loadAssociations: () => Promise<void>;
|
|
2850
|
+
protected loadCategories: () => Promise<void>;
|
|
2851
|
+
protected loadPools: () => Promise<void>;
|
|
2852
|
+
protected loadAssociations: () => Promise<void>;
|
|
2847
2853
|
private parseRows;
|
|
2848
|
-
|
|
2849
|
-
|
|
2854
|
+
deleteAssociation(): void;
|
|
2855
|
+
deleteVisibility(id: string): void;
|
|
2856
|
+
validateAssociations(): boolean;
|
|
2850
2857
|
}
|
|
2851
2858
|
|
|
2852
2859
|
type TObservations = {
|
|
@@ -3404,6 +3411,7 @@ type EditorEvents = 'onChange';
|
|
|
3404
3411
|
declare class Editor extends TranslatableField<TApiaEditorProperties, string> {
|
|
3405
3412
|
fireEvent(eventName: EditorEvents, options?: TFireEventOptions): Promise<boolean>;
|
|
3406
3413
|
protected isValidValue(): boolean;
|
|
3414
|
+
protected getSynchronizePostConfiguration(value: string): IApiaApiPostConfig<any>;
|
|
3407
3415
|
}
|
|
3408
3416
|
|
|
3409
3417
|
declare class File$1 extends FieldWithAttribute<TApiaFileProperties> {
|
|
@@ -3722,10 +3730,12 @@ declare class Radio extends FieldWithAttribute<TApiaRadioProperties, number | st
|
|
|
3722
3730
|
declare class Select extends FieldWithAttribute<TApiaSelectProperties, string, TApiaSelectDefinition> {
|
|
3723
3731
|
constructor({ possibleValue, ...definition }: TApiaSelectDefinition);
|
|
3724
3732
|
protected getInitialValue({ properties: { possibleValue }, }: TApiaFieldWithAttributeBaseProps<TApiaSelectProperties>): Promise<string>;
|
|
3733
|
+
protected getSynchronizePostConfiguration(value: any): IApiaApiPostConfig<any>;
|
|
3725
3734
|
}
|
|
3726
3735
|
|
|
3727
3736
|
declare class Textarea extends TranslatableField<TApiaTextareaProperties, string> {
|
|
3728
3737
|
protected isValidValue(): boolean;
|
|
3738
|
+
protected getSynchronizePostConfiguration(value: string): IApiaApiPostConfig<any>;
|
|
3729
3739
|
}
|
|
3730
3740
|
|
|
3731
3741
|
declare class Title extends Field<TApiaTitleProperties> {
|
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, awaitTime, noNaN as noNaN$1, getDateFormat, uniqueId, parseXMLRequestResponse, Url, postNavigation } from '@apia/util';
|
|
7
|
+
import { arrayOrArray, EventEmitter as EventEmitter$1, isTrue, toBoolean, downloadUrl, addBoundary, formatMessage, parseAsSize, shallowEqual as shallowEqual$1, Mutex, awaitTime, noNaN as noNaN$1, getDateFormat, decodeBase64ToUtf8 as decodeBase64ToUtf8$1, 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
|
+
import { ApiaUtil } from '@apia/components';
|
|
13
14
|
|
|
14
15
|
const deepEqual = (a, b) => {
|
|
15
16
|
if (Object.is(a, b))
|
|
@@ -683,7 +684,7 @@ function makeApiaUrl(execution, props) {
|
|
|
683
684
|
if (props?.queryString && props.queryString.includes("timestamp=") || queryString?.includes("timestamp=")) {
|
|
684
685
|
timestamp = "";
|
|
685
686
|
}
|
|
686
|
-
const contextWord = CONTEXT.
|
|
687
|
+
const contextWord = CONTEXT.replace(/^\/?(.+?)\/?$/, "$1");
|
|
687
688
|
actualAjaxUrl = actualAjaxUrl.match(
|
|
688
689
|
new RegExp(`^(?:(?:/?${contextWord})?/)?(.+)$`)
|
|
689
690
|
)?.[1];
|
|
@@ -1990,6 +1991,11 @@ class Editor extends TranslatableField {
|
|
|
1990
1991
|
isValidValue() {
|
|
1991
1992
|
return !!new DOMParser().parseFromString(this.getValue(), "text/html").documentElement.textContent;
|
|
1992
1993
|
}
|
|
1994
|
+
getSynchronizePostConfiguration(value) {
|
|
1995
|
+
const conf = super.getSynchronizePostConfiguration(value);
|
|
1996
|
+
conf.postData.clearValues = "true";
|
|
1997
|
+
return conf;
|
|
1998
|
+
}
|
|
1993
1999
|
}
|
|
1994
2000
|
|
|
1995
2001
|
var __defProp$j = Object.defineProperty;
|
|
@@ -2250,7 +2256,8 @@ class UploaderModalController {
|
|
|
2250
2256
|
isValid = false;
|
|
2251
2257
|
}
|
|
2252
2258
|
if (c.value.trim() === "") {
|
|
2253
|
-
c.errorMessage
|
|
2259
|
+
if (!c.errorMessage)
|
|
2260
|
+
c.errorMessage = getLabel(this.api.execution, "msgReqField").text;
|
|
2254
2261
|
isValid = false;
|
|
2255
2262
|
}
|
|
2256
2263
|
}
|
|
@@ -2828,7 +2835,7 @@ class UploaderApi extends EventEmitter$1 {
|
|
|
2828
2835
|
if (isOneClickUploadEnabled(
|
|
2829
2836
|
this.execution,
|
|
2830
2837
|
this.modalConfig.oneClickUpload
|
|
2831
|
-
)
|
|
2838
|
+
)) {
|
|
2832
2839
|
if (langId && translatingFile)
|
|
2833
2840
|
void this.confirmDropModal({ langId, translatingFile });
|
|
2834
2841
|
else
|
|
@@ -2936,6 +2943,19 @@ class UploaderApi extends EventEmitter$1 {
|
|
|
2936
2943
|
}
|
|
2937
2944
|
}
|
|
2938
2945
|
}
|
|
2946
|
+
async downloadVersion(fileId, version) {
|
|
2947
|
+
const file = this.getDocument(fileId);
|
|
2948
|
+
if (!file)
|
|
2949
|
+
return;
|
|
2950
|
+
if (getWindow(this.execution).IN_MONITOR || await this.checkWebDavLock(file.docId))
|
|
2951
|
+
await downloadUrl(
|
|
2952
|
+
makeApiaUrl(this.execution, {
|
|
2953
|
+
action: "downloadDocument",
|
|
2954
|
+
docId: file.downloadDocId,
|
|
2955
|
+
version
|
|
2956
|
+
})
|
|
2957
|
+
);
|
|
2958
|
+
}
|
|
2939
2959
|
async downloadDocument(id, version) {
|
|
2940
2960
|
const file = this.getDocument(id);
|
|
2941
2961
|
if (getWindow(this.execution).IN_MONITOR || await this.checkWebDavLock(file.docId)) {
|
|
@@ -3751,7 +3771,7 @@ class FormsUploader extends UploaderApi {
|
|
|
3751
3771
|
}
|
|
3752
3772
|
};
|
|
3753
3773
|
}
|
|
3754
|
-
async
|
|
3774
|
+
async downloadVersion(fileId, version) {
|
|
3755
3775
|
const file = this.getDocument(fileId);
|
|
3756
3776
|
if (!file)
|
|
3757
3777
|
return;
|
|
@@ -3764,6 +3784,22 @@ class FormsUploader extends UploaderApi {
|
|
|
3764
3784
|
})
|
|
3765
3785
|
);
|
|
3766
3786
|
}
|
|
3787
|
+
async downloadDocument(fileId, version) {
|
|
3788
|
+
const file = this.getDocument(fileId);
|
|
3789
|
+
const { prefix, ...rest } = this.getFormParameters();
|
|
3790
|
+
if (!file)
|
|
3791
|
+
return;
|
|
3792
|
+
if (getWindow(this.execution).IN_MONITOR || await this.checkWebDavLock(file.docId))
|
|
3793
|
+
await downloadUrl(
|
|
3794
|
+
makeApiaUrl(this.execution, {
|
|
3795
|
+
action: "download",
|
|
3796
|
+
docId: file.downloadDocId,
|
|
3797
|
+
ajaxUrl: "/page/generic/downloadAttDoc.jsp",
|
|
3798
|
+
version,
|
|
3799
|
+
...rest
|
|
3800
|
+
})
|
|
3801
|
+
);
|
|
3802
|
+
}
|
|
3767
3803
|
loadCurrentDocuments() {
|
|
3768
3804
|
return null;
|
|
3769
3805
|
}
|
|
@@ -5379,16 +5415,25 @@ class Select extends FieldWithAttribute {
|
|
|
5379
5415
|
}) {
|
|
5380
5416
|
return Promise.resolve(
|
|
5381
5417
|
String(
|
|
5382
|
-
possibleValue?.find((c) => c.selected)?.value || possibleValue?.[0]?.value || ""
|
|
5418
|
+
this.state.value !== void 0 ? this.state.value : possibleValue?.find((c) => c.selected)?.value || possibleValue?.[0]?.value || ""
|
|
5383
5419
|
)
|
|
5384
5420
|
);
|
|
5385
5421
|
}
|
|
5422
|
+
getSynchronizePostConfiguration(value) {
|
|
5423
|
+
const conf = super.getSynchronizePostConfiguration(String(value));
|
|
5424
|
+
return conf;
|
|
5425
|
+
}
|
|
5386
5426
|
}
|
|
5387
5427
|
|
|
5388
5428
|
class Textarea extends TranslatableField {
|
|
5389
5429
|
isValidValue() {
|
|
5390
5430
|
return !!String(this.getValue()).trim();
|
|
5391
5431
|
}
|
|
5432
|
+
getSynchronizePostConfiguration(value) {
|
|
5433
|
+
const conf = super.getSynchronizePostConfiguration(value);
|
|
5434
|
+
conf.postData.clearValues = "true";
|
|
5435
|
+
return conf;
|
|
5436
|
+
}
|
|
5392
5437
|
}
|
|
5393
5438
|
|
|
5394
5439
|
class Title extends Field {
|
|
@@ -7253,7 +7298,9 @@ class CustomComponent {
|
|
|
7253
7298
|
}
|
|
7254
7299
|
}
|
|
7255
7300
|
arrayOrArray(o.attribute).forEach((c) => {
|
|
7256
|
-
this._state.attributes[c.name] = arrayOrArray(
|
|
7301
|
+
this._state.attributes[c.name] = arrayOrArray(
|
|
7302
|
+
JSON.parse(decodeBase64ToUtf8$1(c.values))
|
|
7303
|
+
);
|
|
7257
7304
|
});
|
|
7258
7305
|
arrayOrArray(o.property).forEach((c) => {
|
|
7259
7306
|
this._state.properties[c.name] = c.value;
|
|
@@ -8215,6 +8262,24 @@ class Entity {
|
|
|
8215
8262
|
}
|
|
8216
8263
|
}
|
|
8217
8264
|
}
|
|
8265
|
+
addAssociation() {
|
|
8266
|
+
const id = String(uniqueId());
|
|
8267
|
+
this.state.associations.push({
|
|
8268
|
+
asocId: id,
|
|
8269
|
+
asocName: "",
|
|
8270
|
+
asocRelName: ""
|
|
8271
|
+
});
|
|
8272
|
+
const row = new Row(id);
|
|
8273
|
+
row.build({
|
|
8274
|
+
id: String(uniqueId()),
|
|
8275
|
+
cells: [{ colName: "name" }, { colName: "relName" }],
|
|
8276
|
+
isSelected: true
|
|
8277
|
+
});
|
|
8278
|
+
this.controller.body.addRow(row);
|
|
8279
|
+
this.controller.setSelection([
|
|
8280
|
+
this.controller.body.getState("rows").length
|
|
8281
|
+
]);
|
|
8282
|
+
}
|
|
8218
8283
|
getConfirmParams() {
|
|
8219
8284
|
const result = {
|
|
8220
8285
|
busEntSta: this.state?.status.value ?? ""
|
|
@@ -8262,27 +8327,46 @@ class Entity {
|
|
|
8262
8327
|
return newRow;
|
|
8263
8328
|
});
|
|
8264
8329
|
}
|
|
8265
|
-
|
|
8330
|
+
deleteAssociation() {
|
|
8266
8331
|
const selectedRows = this.controller.getState("selection");
|
|
8267
|
-
|
|
8268
|
-
|
|
8332
|
+
const lastIdx = Array.from(selectedRows).pop()?.index;
|
|
8333
|
+
[...selectedRows.values()].forEach((row) => {
|
|
8334
|
+
this.state.associations = this.state?.associations.filter((_, idx) => row.index !== idx) ?? [];
|
|
8269
8335
|
this.controller.body.removeRow(row);
|
|
8270
8336
|
});
|
|
8337
|
+
if (lastIdx)
|
|
8338
|
+
this.controller.setSelection([lastIdx - 1]);
|
|
8271
8339
|
}
|
|
8272
|
-
|
|
8273
|
-
|
|
8274
|
-
|
|
8275
|
-
|
|
8276
|
-
|
|
8277
|
-
|
|
8278
|
-
|
|
8279
|
-
|
|
8280
|
-
|
|
8281
|
-
|
|
8282
|
-
|
|
8283
|
-
|
|
8284
|
-
|
|
8285
|
-
|
|
8340
|
+
deleteVisibility(id) {
|
|
8341
|
+
if (this.state) {
|
|
8342
|
+
this.state.visibilities = this.state.visibilities.filter(
|
|
8343
|
+
(c) => c.poolId !== id
|
|
8344
|
+
);
|
|
8345
|
+
}
|
|
8346
|
+
}
|
|
8347
|
+
validateAssociations() {
|
|
8348
|
+
if (this.state?.associations.length === 0)
|
|
8349
|
+
return true;
|
|
8350
|
+
if (this.state) {
|
|
8351
|
+
const invalidAssociations = this.state.associations.filter(
|
|
8352
|
+
(c) => !c.asocName || !c.asocRelName
|
|
8353
|
+
);
|
|
8354
|
+
if (invalidAssociations.length > 0) {
|
|
8355
|
+
invalidAssociations.forEach((c, idx) => {
|
|
8356
|
+
c.errorRelNameMessage = "";
|
|
8357
|
+
c.errorNameMessage = "";
|
|
8358
|
+
c.focusTarget = void 0;
|
|
8359
|
+
if (idx === 0)
|
|
8360
|
+
c.focusTarget = true;
|
|
8361
|
+
if (c.asocName === "")
|
|
8362
|
+
c.errorNameMessage = labels.errorFieldRequired(this.execution);
|
|
8363
|
+
if (c.asocRelName === "")
|
|
8364
|
+
c.errorRelNameMessage = labels.errorFieldRequired(this.execution);
|
|
8365
|
+
});
|
|
8366
|
+
return false;
|
|
8367
|
+
}
|
|
8368
|
+
}
|
|
8369
|
+
return true;
|
|
8286
8370
|
}
|
|
8287
8371
|
}
|
|
8288
8372
|
|
|
@@ -8904,17 +8988,21 @@ async function defaultConfirm(execution, status) {
|
|
|
8904
8988
|
setAjaxFormResponse(execution, checkConfirmEntity.data?.form);
|
|
8905
8989
|
}
|
|
8906
8990
|
const url = arrayOrArray(confirmResponse.data.actions?.action.param)[1];
|
|
8907
|
-
|
|
8908
|
-
|
|
8909
|
-
|
|
8910
|
-
|
|
8911
|
-
|
|
8912
|
-
|
|
8913
|
-
|
|
8914
|
-
|
|
8915
|
-
|
|
8916
|
-
|
|
8917
|
-
|
|
8991
|
+
if (url === "callNavigateClose") {
|
|
8992
|
+
ApiaUtil.instance.tabs.currentTab.close(true);
|
|
8993
|
+
} else {
|
|
8994
|
+
const c = new Url(url);
|
|
8995
|
+
getWindow(execution).location.assign(
|
|
8996
|
+
makeApiaUrl(execution, {
|
|
8997
|
+
ajaxUrl: c.base,
|
|
8998
|
+
action: c.getParameter("action")
|
|
8999
|
+
})
|
|
9000
|
+
);
|
|
9001
|
+
(getWindow(execution)?.top?.ApiaUtil).notifications.notify({
|
|
9002
|
+
message: confirmResponse?.data?.load?.text?.label,
|
|
9003
|
+
type: "success"
|
|
9004
|
+
});
|
|
9005
|
+
}
|
|
8918
9006
|
}
|
|
8919
9007
|
return {
|
|
8920
9008
|
...status,
|
|
@@ -9237,6 +9325,9 @@ class Execution extends EventEmitter$1 {
|
|
|
9237
9325
|
if (validationResult !== true) {
|
|
9238
9326
|
return validationResult;
|
|
9239
9327
|
}
|
|
9328
|
+
if (this.executionConfig?.isEntity && !this.entity.validateAssociations()) {
|
|
9329
|
+
return false;
|
|
9330
|
+
}
|
|
9240
9331
|
const isValid = status !== void 0 || await this.fireEvents("onSubmit");
|
|
9241
9332
|
const canConfirm = this.executionConfig?.canConfirm && isValid === true;
|
|
9242
9333
|
if (canConfirm) {
|