@apia/execution 4.0.87 → 4.0.89
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 +6 -1
- package/dist/index.js +97 -34
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
package/dist/index.d.ts
CHANGED
|
@@ -103,6 +103,8 @@ interface IApiaDataGridColumn {
|
|
|
103
103
|
type TApiaGridField = TApiaFieldBaseDefinition<any> & {
|
|
104
104
|
fieldValue?: Pick<TApiaFieldWithAttributeBaseProps<any>, 'value' | 'properties' | 'qry_show_value'>;
|
|
105
105
|
row?: Pick<TApiaFieldWithAttributeBaseProps<any>, 'value' | 'properties'> & Pick<TApiaSelectProperties, 'possibleValue'>;
|
|
106
|
+
attLabel?: string;
|
|
107
|
+
valueType?: string;
|
|
106
108
|
};
|
|
107
109
|
type TApiaGridDefinition = TApiaFieldBaseDefinition<TApiaGridProperties> & {
|
|
108
110
|
curPage?: number;
|
|
@@ -305,6 +307,7 @@ type TApiaGridProperties = TApiaFieldCommonProperties & {
|
|
|
305
307
|
paged?: boolean;
|
|
306
308
|
pagedGridSize?: number;
|
|
307
309
|
hideMaximizeButton: boolean;
|
|
310
|
+
gridQuery?: string;
|
|
308
311
|
};
|
|
309
312
|
type TApiaHiddenProperties = TApiaFieldCommonProperties & TApiaGroupableFieldProperties & TApiaFieldWithAttributeProperties & {};
|
|
310
313
|
type TApiaImageProperties = TApiaFieldCommonProperties & TApiaGroupableFieldProperties & {
|
|
@@ -2736,6 +2739,7 @@ type ConfirmStep = 'CHECK_LOCK' | 'CONFIRM' | 'CHECK_SIGN' | 'CHECK_WIZARD' | 'S
|
|
|
2736
2739
|
type Status = {
|
|
2737
2740
|
step?: ConfirmStep;
|
|
2738
2741
|
error?: string;
|
|
2742
|
+
type?: string;
|
|
2739
2743
|
finishedWithError?: boolean;
|
|
2740
2744
|
};
|
|
2741
2745
|
declare abstract class FlowModal<T extends {
|
|
@@ -3356,7 +3360,8 @@ declare class Grid extends Field<GridProps, GridDefinition, GridState> {
|
|
|
3356
3360
|
definition: Omit<TApiaFieldBaseDefinition<TApiaFieldCommonProperties>, "properties">;
|
|
3357
3361
|
}>[][];
|
|
3358
3362
|
get startIndex(): number;
|
|
3359
|
-
|
|
3363
|
+
protected static parseGridDefinition(xml: string | TApiaGridDefinition): TApiaGridDefinition;
|
|
3364
|
+
constructor(definition: TApiaGridDefinition);
|
|
3360
3365
|
private resolveHeaderWidth;
|
|
3361
3366
|
protected getGridActionFromEventName(eventName: GridEvents): "delete" | "add" | undefined;
|
|
3362
3367
|
protected fireServerEvent(eventName: GridEvents, params?: FireEventParameters): Promise<boolean>;
|
package/dist/index.js
CHANGED
|
@@ -1028,10 +1028,12 @@ function getDocument(execution) {
|
|
|
1028
1028
|
return execution.environment.document;
|
|
1029
1029
|
}
|
|
1030
1030
|
|
|
1031
|
-
function getCurrentTabsString(execution) {
|
|
1031
|
+
function getCurrentTabsString(execution, avoidScroll) {
|
|
1032
1032
|
const tabsList = getWindow(execution).tabsController?.tabsList;
|
|
1033
1033
|
if (tabsList)
|
|
1034
|
-
return `${tabsList.map((c) => c.state.isOpen ? c.id : -1).filter((c) => !(typeof c === "number")).join(
|
|
1034
|
+
return `${tabsList.map((c) => c.state.isOpen ? c.id : -1).filter((c) => !(typeof c === "number")).join(
|
|
1035
|
+
","
|
|
1036
|
+
)}~${!avoidScroll ? getDocument(execution).scrollingElement?.scrollTop ?? 0 : 0}`;
|
|
1035
1037
|
}
|
|
1036
1038
|
|
|
1037
1039
|
const actions = {
|
|
@@ -1371,6 +1373,7 @@ class Field extends WithProperties {
|
|
|
1371
1373
|
async fireNoAjaxServerEvent(event, params) {
|
|
1372
1374
|
const p = this.getServerEventParams(event.evtId, params);
|
|
1373
1375
|
this.form.execution.markNoAjaxNavigationAsPending();
|
|
1376
|
+
const unlock = this.getForm().execution.lock();
|
|
1374
1377
|
try {
|
|
1375
1378
|
getWindow(this.form.execution).location.assign(
|
|
1376
1379
|
await makeApiaUrl(this.form.execution, {
|
|
@@ -1381,6 +1384,7 @@ class Field extends WithProperties {
|
|
|
1381
1384
|
);
|
|
1382
1385
|
} catch (e) {
|
|
1383
1386
|
this.form.execution.clearNoAjaxNavigationPendingState();
|
|
1387
|
+
unlock();
|
|
1384
1388
|
throw e;
|
|
1385
1389
|
}
|
|
1386
1390
|
return false;
|
|
@@ -2115,6 +2119,7 @@ class UploaderApi extends UploaderApi$1 {
|
|
|
2115
2119
|
return this.addPrefix(defaultParameters);
|
|
2116
2120
|
});
|
|
2117
2121
|
this.docTypePermittedObjId = type === "E" ? getWindow(execution).docTypePerEntId : getWindow(execution).docTypePerProId;
|
|
2122
|
+
this.showConfirmMessage = getWindow(execution).config?.components?.uploader?.showSuccessMessage;
|
|
2118
2123
|
}
|
|
2119
2124
|
getLoadFileSystemStructureTree() {
|
|
2120
2125
|
return {
|
|
@@ -2924,14 +2929,16 @@ async function inlineTimeout(cb, _t) {
|
|
|
2924
2929
|
return Promise.resolve(true);
|
|
2925
2930
|
}
|
|
2926
2931
|
class Grid extends Field {
|
|
2927
|
-
constructor(
|
|
2932
|
+
constructor(definition) {
|
|
2933
|
+
const parsedDefinition = Grid.parseGridDefinition(definition);
|
|
2934
|
+
const { properties, field, ...gridDefinition } = parsedDefinition;
|
|
2928
2935
|
super({
|
|
2929
|
-
...
|
|
2936
|
+
...gridDefinition,
|
|
2930
2937
|
properties: {
|
|
2931
|
-
currentPage: noNaN(
|
|
2938
|
+
currentPage: noNaN(parsedDefinition.curPage, 1),
|
|
2932
2939
|
maxRows: properties.maxRecords || Infinity,
|
|
2933
2940
|
paged: false,
|
|
2934
|
-
pages: noNaN(
|
|
2941
|
+
pages: noNaN(parsedDefinition.pages, 1),
|
|
2935
2942
|
pageSize: noNaN(
|
|
2936
2943
|
properties.pagedGridSize,
|
|
2937
2944
|
properties.paged ? 5 : Infinity
|
|
@@ -2969,15 +2976,17 @@ class Grid extends Field {
|
|
|
2969
2976
|
return { ...current, properties: parseFakeJSON$1(properties2) };
|
|
2970
2977
|
}
|
|
2971
2978
|
);
|
|
2972
|
-
this.state.header = arrayOrArray(
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2979
|
+
this.state.header = arrayOrArray(parsedDefinition.gridHeader.col).map(
|
|
2980
|
+
(c) => ({
|
|
2981
|
+
fldId: c.fldId,
|
|
2982
|
+
label: c.colTitle,
|
|
2983
|
+
title: c.title,
|
|
2984
|
+
width: c.colWidth || this.resolveHeaderWidth(c),
|
|
2985
|
+
hidden: false,
|
|
2986
|
+
required: false,
|
|
2987
|
+
fldType: c.fldType
|
|
2988
|
+
})
|
|
2989
|
+
);
|
|
2981
2990
|
this.state.isLoading = false;
|
|
2982
2991
|
this.state.isMaximized = false;
|
|
2983
2992
|
this.controller.on("columnClick", (col) => {
|
|
@@ -3032,6 +3041,35 @@ class Grid extends Field {
|
|
|
3032
3041
|
const pageSize = this.properties.pageSize;
|
|
3033
3042
|
return noNaN((this.properties.currentPage - 1) * pageSize, 0);
|
|
3034
3043
|
}
|
|
3044
|
+
static parseGridDefinition(xml) {
|
|
3045
|
+
const definition = typeof xml === "string" ? parseXml(xml) : xml;
|
|
3046
|
+
if (!definition.properties?.gridQuery) {
|
|
3047
|
+
return definition;
|
|
3048
|
+
}
|
|
3049
|
+
const fields = arrayOrArray(definition.field);
|
|
3050
|
+
const columns = arrayOrArray(definition.gridHeader?.col);
|
|
3051
|
+
const totalColumns = Math.max(fields.length, columns.length);
|
|
3052
|
+
return {
|
|
3053
|
+
...definition,
|
|
3054
|
+
gridHeader: {
|
|
3055
|
+
...definition.gridHeader,
|
|
3056
|
+
col: new Array(totalColumns).fill(null).map((_, index) => {
|
|
3057
|
+
const column = columns[index] || {};
|
|
3058
|
+
const field = fields[index];
|
|
3059
|
+
return {
|
|
3060
|
+
...column,
|
|
3061
|
+
colTitle: column.colTitle || field?.properties?.gridColTitle || field?.attLabel || field?.properties?.name || "",
|
|
3062
|
+
colWidth: column.colWidth || field?.colWidth || field?.properties?.colWidth || "",
|
|
3063
|
+
dataType: column.dataType || field?.valueType || "S",
|
|
3064
|
+
fldId: column.fldId || field?.id || String(index),
|
|
3065
|
+
fldType: column.fldType || "",
|
|
3066
|
+
hasQuery: typeof column.hasQuery === "boolean" ? column.hasQuery : !!field?.qryId,
|
|
3067
|
+
title: column.title || field?.attLabel || ""
|
|
3068
|
+
};
|
|
3069
|
+
})
|
|
3070
|
+
}
|
|
3071
|
+
};
|
|
3072
|
+
}
|
|
3035
3073
|
resolveHeaderWidth(c) {
|
|
3036
3074
|
if (c.fldType === "9" || c.fldType === "1" && c.dataType === "D" || c.fldType === "1" && c.hasQuery) {
|
|
3037
3075
|
return "200px";
|
|
@@ -3073,7 +3111,7 @@ class Grid extends Field {
|
|
|
3073
3111
|
});
|
|
3074
3112
|
const response = await res;
|
|
3075
3113
|
if (response?.data?.gridXml) {
|
|
3076
|
-
const xml =
|
|
3114
|
+
const xml = Grid.parseGridDefinition(response.data.gridXml);
|
|
3077
3115
|
const fieldsArray = arrayOrArray(xml.field);
|
|
3078
3116
|
this.newRowStates = fieldsArray.map(
|
|
3079
3117
|
(current) => current.fieldValue || current.row ? arrayOrArray(current.fieldValue || current.row) : void 0
|
|
@@ -3640,16 +3678,17 @@ class Grid extends Field {
|
|
|
3640
3678
|
return this.tableController.body.getRowByIndex(index)?.cells.filter((c) => c instanceof GridCell).map((c) => c.getField());
|
|
3641
3679
|
}
|
|
3642
3680
|
async rebuildGrid(xmlString) {
|
|
3643
|
-
const xml =
|
|
3681
|
+
const xml = Grid.parseGridDefinition(xmlString);
|
|
3644
3682
|
const fieldsArray = arrayOrArray(xml.field);
|
|
3645
3683
|
const statesArray = fieldsArray.map(
|
|
3646
3684
|
(field) => arrayOrArray(field.fieldValue || field.row)
|
|
3647
3685
|
);
|
|
3686
|
+
const rowCount = statesArray[0]?.length || 0;
|
|
3648
3687
|
this.properties.pages = xml.pages || this.properties.pages;
|
|
3649
3688
|
this.properties.currentPage = xml.curPage || this.properties.currentPage;
|
|
3650
3689
|
this.properties.visibilityHidden = xml.properties.visibilityHidden ?? this.properties.visibilityHidden;
|
|
3651
|
-
if (
|
|
3652
|
-
for (let i = this.controller.body.rows.length; i <
|
|
3690
|
+
if (rowCount > this.controller.body.rows.length) {
|
|
3691
|
+
for (let i = this.controller.body.rows.length; i < rowCount; i++) {
|
|
3653
3692
|
const parsedFieldGroups = fieldsArray.map((field, columnIndex) => {
|
|
3654
3693
|
if (field.fieldType === "radio" || field.fieldType === "select") {
|
|
3655
3694
|
const parsedField = {
|
|
@@ -3669,10 +3708,10 @@ class Grid extends Field {
|
|
|
3669
3708
|
});
|
|
3670
3709
|
await this.addRowFromDefinitions(false, parsedFieldGroups);
|
|
3671
3710
|
}
|
|
3672
|
-
} else if (
|
|
3711
|
+
} else if (rowCount < this.controller.body.rows.length) {
|
|
3673
3712
|
const removeIndices = new Array(
|
|
3674
|
-
this.controller.body.rows.length -
|
|
3675
|
-
).fill(0).map((_, i) => i +
|
|
3713
|
+
this.controller.body.rows.length - rowCount
|
|
3714
|
+
).fill(0).map((_, i) => i + rowCount);
|
|
3676
3715
|
removeIndices.sort((a, b) => b - a).forEach((i) => {
|
|
3677
3716
|
this.controller.body.getRowByIndex(i)?.remove();
|
|
3678
3717
|
});
|
|
@@ -7669,7 +7708,10 @@ async function defaultConfirm$1(execution, status) {
|
|
|
7669
7708
|
return {
|
|
7670
7709
|
step: void 0,
|
|
7671
7710
|
finishedWithError: true,
|
|
7672
|
-
|
|
7711
|
+
type: String(
|
|
7712
|
+
arrayOrArray(confirmResponse?.data?.sysMessages?.message)[0]?.type
|
|
7713
|
+
),
|
|
7714
|
+
error: `${[
|
|
7673
7715
|
...arrayOrArray(confirmResponse?.data?.sysMessages?.message).map(
|
|
7674
7716
|
(c) => c.text || c.label
|
|
7675
7717
|
),
|
|
@@ -7812,9 +7854,25 @@ async function confirm(execution, status) {
|
|
|
7812
7854
|
}
|
|
7813
7855
|
result = checkerResult;
|
|
7814
7856
|
if (result.error) {
|
|
7815
|
-
|
|
7816
|
-
|
|
7817
|
-
|
|
7857
|
+
let notificationType = "error";
|
|
7858
|
+
switch (result.type) {
|
|
7859
|
+
case "1":
|
|
7860
|
+
notificationType = "success";
|
|
7861
|
+
break;
|
|
7862
|
+
case "2":
|
|
7863
|
+
notificationType = "warning";
|
|
7864
|
+
break;
|
|
7865
|
+
case "3":
|
|
7866
|
+
notificationType = "error";
|
|
7867
|
+
break;
|
|
7868
|
+
case "4":
|
|
7869
|
+
notificationType = "modal";
|
|
7870
|
+
break;
|
|
7871
|
+
default:
|
|
7872
|
+
notificationType = "error";
|
|
7873
|
+
break;
|
|
7874
|
+
}
|
|
7875
|
+
console.error(`Error: ${result.error}, type: ${notificationType}`);
|
|
7818
7876
|
}
|
|
7819
7877
|
if (result.error || result.finishedWithError) {
|
|
7820
7878
|
return false;
|
|
@@ -7998,9 +8056,7 @@ async function confirmEntity(execution, status) {
|
|
|
7998
8056
|
}
|
|
7999
8057
|
result = checkerResult;
|
|
8000
8058
|
if (result.error) {
|
|
8001
|
-
|
|
8002
|
-
new MessageNotification({ message: result.error, type: "error" })
|
|
8003
|
-
);
|
|
8059
|
+
console.error(`Error: ${result.error}`);
|
|
8004
8060
|
}
|
|
8005
8061
|
if (result.error || result.finishedWithError) {
|
|
8006
8062
|
return false;
|
|
@@ -8322,6 +8378,7 @@ class Execution extends EventEmitter$1 {
|
|
|
8322
8378
|
async doBack() {
|
|
8323
8379
|
const canGoBack = this.executionConfig?.canGoBack;
|
|
8324
8380
|
if (canGoBack) {
|
|
8381
|
+
const unlock = this.lock();
|
|
8325
8382
|
try {
|
|
8326
8383
|
const nextUrl = makeApiaUrl(this, {
|
|
8327
8384
|
action: "gotoPrevStep",
|
|
@@ -8336,6 +8393,7 @@ class Execution extends EventEmitter$1 {
|
|
|
8336
8393
|
};
|
|
8337
8394
|
postNavigation(nextUrl, serverParams);
|
|
8338
8395
|
} catch (error) {
|
|
8396
|
+
unlock();
|
|
8339
8397
|
console.error("Confirmation process failed:", error);
|
|
8340
8398
|
this.notifications.add(
|
|
8341
8399
|
new MessageNotification({
|
|
@@ -8370,10 +8428,14 @@ class Execution extends EventEmitter$1 {
|
|
|
8370
8428
|
}
|
|
8371
8429
|
);
|
|
8372
8430
|
if (result instanceof FlowModal) {
|
|
8431
|
+
if (!(result instanceof ShowConfirmMessage)) {
|
|
8432
|
+
unlock();
|
|
8433
|
+
}
|
|
8373
8434
|
return result;
|
|
8374
8435
|
}
|
|
8375
8436
|
return result;
|
|
8376
8437
|
} catch (error) {
|
|
8438
|
+
unlock();
|
|
8377
8439
|
console.error("Confirmation process failed:", error);
|
|
8378
8440
|
this.notifications.add(
|
|
8379
8441
|
new MessageNotification({
|
|
@@ -8382,8 +8444,6 @@ class Execution extends EventEmitter$1 {
|
|
|
8382
8444
|
})
|
|
8383
8445
|
);
|
|
8384
8446
|
return false;
|
|
8385
|
-
} finally {
|
|
8386
|
-
unlock();
|
|
8387
8447
|
}
|
|
8388
8448
|
} else {
|
|
8389
8449
|
return isValid;
|
|
@@ -8428,6 +8488,9 @@ class Execution extends EventEmitter$1 {
|
|
|
8428
8488
|
const canGoNext = this.executionConfig?.canGoForward && isValid === true;
|
|
8429
8489
|
if (canGoNext) {
|
|
8430
8490
|
const unlock = this.lock();
|
|
8491
|
+
if (result?.confirmed === false) {
|
|
8492
|
+
unlock();
|
|
8493
|
+
}
|
|
8431
8494
|
try {
|
|
8432
8495
|
const checkLocksRes = await post(
|
|
8433
8496
|
this,
|
|
@@ -8464,6 +8527,7 @@ class Execution extends EventEmitter$1 {
|
|
|
8464
8527
|
}
|
|
8465
8528
|
const mustShowSignModal = checkSignableFormsRes?.data?.sign;
|
|
8466
8529
|
if (mustShowSignModal && !result?.signed) {
|
|
8530
|
+
unlock();
|
|
8467
8531
|
return new ShowSignSelection(
|
|
8468
8532
|
checkSignableFormsRes?.data,
|
|
8469
8533
|
async () => {
|
|
@@ -8477,7 +8541,7 @@ class Execution extends EventEmitter$1 {
|
|
|
8477
8541
|
action: "gotoNextStep",
|
|
8478
8542
|
asXML: true,
|
|
8479
8543
|
react: true,
|
|
8480
|
-
currentTab: getCurrentTabsString(this),
|
|
8544
|
+
currentTab: getCurrentTabsString(this, true),
|
|
8481
8545
|
fromPanel: null
|
|
8482
8546
|
});
|
|
8483
8547
|
const serverParams = {
|
|
@@ -8489,6 +8553,7 @@ class Execution extends EventEmitter$1 {
|
|
|
8489
8553
|
postNavigation(nextUrl, serverParams);
|
|
8490
8554
|
return true;
|
|
8491
8555
|
} catch (error) {
|
|
8556
|
+
unlock();
|
|
8492
8557
|
console.error("Confirmation process failed:", error);
|
|
8493
8558
|
this.notifications.add(
|
|
8494
8559
|
new MessageNotification({
|
|
@@ -8497,8 +8562,6 @@ class Execution extends EventEmitter$1 {
|
|
|
8497
8562
|
})
|
|
8498
8563
|
);
|
|
8499
8564
|
return false;
|
|
8500
|
-
} finally {
|
|
8501
|
-
unlock();
|
|
8502
8565
|
}
|
|
8503
8566
|
}
|
|
8504
8567
|
}
|