@apia/execution 4.0.84 → 4.0.87
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 +4 -0
- package/dist/index.js +27 -9
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
package/dist/index.d.ts
CHANGED
|
@@ -2914,6 +2914,7 @@ declare class Execution extends EventEmitter$1<{
|
|
|
2914
2914
|
readonly notifications: Notifications;
|
|
2915
2915
|
private lastModalReturn;
|
|
2916
2916
|
private _pendingPromises;
|
|
2917
|
+
private _pendingNoAjaxNavigation;
|
|
2917
2918
|
constructor(environment: TExecutionEnvironment, renderers?: TModalConfig['renderers']);
|
|
2918
2919
|
protected formsById: {
|
|
2919
2920
|
E: Map<string, Form>;
|
|
@@ -2929,6 +2930,9 @@ declare class Execution extends EventEmitter$1<{
|
|
|
2929
2930
|
hasChangedAnything: boolean;
|
|
2930
2931
|
};
|
|
2931
2932
|
addPendingPromise(promise: Promise<boolean>): void;
|
|
2933
|
+
markNoAjaxNavigationAsPending(): void;
|
|
2934
|
+
clearNoAjaxNavigationPendingState(): void;
|
|
2935
|
+
hasPendingNoAjaxNavigation(): boolean;
|
|
2932
2936
|
getErrorsList(): FieldError[];
|
|
2933
2937
|
getAllForms(): Form[];
|
|
2934
2938
|
private hasInitializedFormsTabs;
|
package/dist/index.js
CHANGED
|
@@ -1370,15 +1370,8 @@ class Field extends WithProperties {
|
|
|
1370
1370
|
}
|
|
1371
1371
|
async fireNoAjaxServerEvent(event, params) {
|
|
1372
1372
|
const p = this.getServerEventParams(event.evtId, params);
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
await makeApiaUrl(this.form.execution, {
|
|
1376
|
-
...p,
|
|
1377
|
-
currentTab: getCurrentTabsString(this.form.execution),
|
|
1378
|
-
stringifyOptions: { arrayFormat: "repeat" }
|
|
1379
|
-
})
|
|
1380
|
-
);
|
|
1381
|
-
} else {
|
|
1373
|
+
this.form.execution.markNoAjaxNavigationAsPending();
|
|
1374
|
+
try {
|
|
1382
1375
|
getWindow(this.form.execution).location.assign(
|
|
1383
1376
|
await makeApiaUrl(this.form.execution, {
|
|
1384
1377
|
...p,
|
|
@@ -1386,10 +1379,17 @@ class Field extends WithProperties {
|
|
|
1386
1379
|
stringifyOptions: { arrayFormat: "repeat" }
|
|
1387
1380
|
})
|
|
1388
1381
|
);
|
|
1382
|
+
} catch (e) {
|
|
1383
|
+
this.form.execution.clearNoAjaxNavigationPendingState();
|
|
1384
|
+
throw e;
|
|
1389
1385
|
}
|
|
1390
1386
|
return false;
|
|
1391
1387
|
}
|
|
1392
1388
|
async fireServerEvent(eventName, params) {
|
|
1389
|
+
if (this.form.execution.hasPendingNoAjaxNavigation()) {
|
|
1390
|
+
console.warn(`Server busy, firing event failed: ${eventName}`);
|
|
1391
|
+
return false;
|
|
1392
|
+
}
|
|
1393
1393
|
let event = this.definition.serverEvents?.find(
|
|
1394
1394
|
(c) => c.evtName === eventName
|
|
1395
1395
|
);
|
|
@@ -1415,6 +1415,10 @@ class Field extends WithProperties {
|
|
|
1415
1415
|
return true;
|
|
1416
1416
|
}
|
|
1417
1417
|
async fireEvent(eventName, params) {
|
|
1418
|
+
if (this.form.execution.hasPendingNoAjaxNavigation()) {
|
|
1419
|
+
console.warn(`Server busy, firing event failed: ${eventName}`);
|
|
1420
|
+
return false;
|
|
1421
|
+
}
|
|
1418
1422
|
const unlock = this.form.execution.lock();
|
|
1419
1423
|
try {
|
|
1420
1424
|
let result = await this.fireScriptEvent(eventName);
|
|
@@ -1424,6 +1428,10 @@ class Field extends WithProperties {
|
|
|
1424
1428
|
} catch (e) {
|
|
1425
1429
|
console.warn("waitForPendingSyncs failed or timed out", e);
|
|
1426
1430
|
}
|
|
1431
|
+
if (this.form.execution.hasPendingNoAjaxNavigation()) {
|
|
1432
|
+
console.warn(`Server busy, firing event failed: ${eventName}`);
|
|
1433
|
+
return false;
|
|
1434
|
+
}
|
|
1427
1435
|
result = await this.fireServerEvent(eventName, params);
|
|
1428
1436
|
}
|
|
1429
1437
|
return result;
|
|
@@ -8052,6 +8060,7 @@ class Execution extends EventEmitter$1 {
|
|
|
8052
8060
|
__publicField(this, "notifications");
|
|
8053
8061
|
__publicField(this, "lastModalReturn", []);
|
|
8054
8062
|
__publicField(this, "_pendingPromises", /* @__PURE__ */ new Set());
|
|
8063
|
+
__publicField(this, "_pendingNoAjaxNavigation", false);
|
|
8055
8064
|
__publicField(this, "formsById", {
|
|
8056
8065
|
E: /* @__PURE__ */ new Map(),
|
|
8057
8066
|
P: /* @__PURE__ */ new Map()
|
|
@@ -8114,6 +8123,15 @@ class Execution extends EventEmitter$1 {
|
|
|
8114
8123
|
this._pendingPromises.delete(promise);
|
|
8115
8124
|
});
|
|
8116
8125
|
}
|
|
8126
|
+
markNoAjaxNavigationAsPending() {
|
|
8127
|
+
this._pendingNoAjaxNavigation = true;
|
|
8128
|
+
}
|
|
8129
|
+
clearNoAjaxNavigationPendingState() {
|
|
8130
|
+
this._pendingNoAjaxNavigation = false;
|
|
8131
|
+
}
|
|
8132
|
+
hasPendingNoAjaxNavigation() {
|
|
8133
|
+
return this._pendingNoAjaxNavigation;
|
|
8134
|
+
}
|
|
8117
8135
|
getErrorsList() {
|
|
8118
8136
|
const entityErrors = [];
|
|
8119
8137
|
this.forms.E.forEach((form) => {
|