@apia/execution 4.0.50 → 4.0.60

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.js CHANGED
@@ -1164,6 +1164,9 @@ const setAjaxFormResponse = async (execution, response) => {
1164
1164
  }
1165
1165
  }
1166
1166
  }
1167
+ } else if (ajaxFields[f]?.field) {
1168
+ const ajaxProps = ajaxFields[f]?.field?.properties;
1169
+ apiField.properties = ajaxProps;
1167
1170
  }
1168
1171
  }
1169
1172
  if (form.v === "t" && String(apiaForm.properties[IProperty$1.PROPERTY_FORM_HIDDEN]) !== "true") {
@@ -3050,51 +3053,50 @@ class Grid extends Field {
3050
3053
  */
3051
3054
  async addRow() {
3052
3055
  return this.asyncAction(async () => {
3053
- if (await this.fireScriptEvent("gridAdd")) {
3054
- if (this.hasServerNoAjaxEventsOfType("gridAdd")) {
3055
- await this.fireServerEvent("gridAdd", {});
3056
- } else {
3057
- const res = this.runAction({
3058
- postData: {
3059
- gridAction: "add",
3060
- addRowsCount: 1,
3061
- fireEvents: this.hasServerAjaxEventsOfType("gridAdd")
3062
- }
3063
- });
3064
- const response = await res;
3065
- if (response?.data?.gridXml) {
3066
- const xml = parseXml(response.data.gridXml);
3067
- const fieldsArray = arrayOrArray(xml.field);
3068
- this.newRowStates = fieldsArray.map(
3069
- (current) => current.fieldValue || current.row ? arrayOrArray(current.fieldValue || current.row) : void 0
3070
- ).filter(Boolean);
3071
- } else {
3072
- throw new Error(
3073
- !getWindow(this.form.execution).SERVER_MODE ? "Something went wrong on the add row action." : ""
3074
- );
3056
+ if (this.hasServerNoAjaxEventsOfType("gridAdd")) {
3057
+ await this.fireServerEvent("gridAdd", {});
3058
+ } else {
3059
+ const res = this.runAction({
3060
+ postData: {
3061
+ gridAction: "add",
3062
+ addRowsCount: 1,
3063
+ fireEvents: this.hasServerAjaxEventsOfType("gridAdd")
3075
3064
  }
3076
- const addedRow = await this.addRowFromDefinitions(
3077
- true,
3078
- this.fieldsDefinitions.map((c, i) => ({
3079
- ...c,
3080
- ...this.newRowStates[i][0]
3081
- }))
3065
+ });
3066
+ const response = await res;
3067
+ if (response?.data?.gridXml) {
3068
+ const xml = parseXml(response.data.gridXml);
3069
+ const fieldsArray = arrayOrArray(xml.field);
3070
+ this.newRowStates = fieldsArray.map(
3071
+ (current) => current.fieldValue || current.row ? arrayOrArray(current.fieldValue || current.row) : void 0
3072
+ ).filter(Boolean);
3073
+ } else {
3074
+ throw new Error(
3075
+ !getWindow(this.form.execution).SERVER_MODE ? "Something went wrong on the add row action." : ""
3082
3076
  );
3083
- return await (this.hasServerAjaxEventsOfType("gridAdd") ? inlineCaller : inlineTimeout)(async () => {
3084
- return this.asyncAction(async () => {
3085
- const evs = (await res)?.data?.eventsXml;
3086
- if (evs) {
3087
- setAjaxFormResponse(this.form.execution, parseXml(evs));
3088
- }
3089
- if (!(await res)?.data?.success) {
3090
- (await addedRow).remove();
3091
- return false;
3092
- } else {
3093
- return true;
3094
- }
3095
- }, !this.hasServerAjaxEventsOfType("gridAdd"));
3096
- }, 0);
3097
3077
  }
3078
+ const addedRow = await this.addRowFromDefinitions(
3079
+ true,
3080
+ this.fieldsDefinitions.map((c, i) => ({
3081
+ ...c,
3082
+ ...this.newRowStates[i][0]
3083
+ }))
3084
+ );
3085
+ return await (this.hasServerAjaxEventsOfType("gridAdd") ? inlineCaller : inlineTimeout)(async () => {
3086
+ return this.asyncAction(async () => {
3087
+ const evs = (await res)?.data?.eventsXml;
3088
+ if (evs) {
3089
+ setAjaxFormResponse(this.form.execution, parseXml(evs));
3090
+ }
3091
+ const scriptResult = await this.fireScriptEvent("gridAdd");
3092
+ if (!scriptResult || !(await res)?.data?.success) {
3093
+ (await addedRow).remove();
3094
+ return false;
3095
+ } else {
3096
+ return true;
3097
+ }
3098
+ }, !this.hasServerAjaxEventsOfType("gridAdd"));
3099
+ }, 0);
3098
3100
  }
3099
3101
  return false;
3100
3102
  });
@@ -3142,71 +3144,70 @@ class Grid extends Field {
3142
3144
  */
3143
3145
  async deleteRows(index) {
3144
3146
  return this.asyncAction(async () => {
3145
- if (await this.fireScriptEvent("gridDelete")) {
3146
- if (void 0 === index) {
3147
- index = [...this.controller.getState("selection")].map((c) => {
3148
- return c.getIndex();
3149
- });
3150
- } else {
3151
- this.controller.setSelection(arrayOrArray(index));
3152
- }
3153
- const deletingIndices = arrayOrArray(index).sort((a, b) => b - a);
3154
- if (this.hasServerNoAjaxEventsOfType("gridDelete")) {
3155
- await this.fireServerEvent("gridDelete", {
3147
+ if (void 0 === index) {
3148
+ index = [...this.controller.getState("selection")].map((c) => {
3149
+ return c.getIndex();
3150
+ });
3151
+ } else {
3152
+ this.controller.setSelection(arrayOrArray(index));
3153
+ }
3154
+ const deletingIndices = arrayOrArray(index).sort((a, b) => b - a);
3155
+ if (this.hasServerNoAjaxEventsOfType("gridDelete")) {
3156
+ await this.fireServerEvent("gridDelete", {
3157
+ gridAction: "delete",
3158
+ rowId: deletingIndices
3159
+ });
3160
+ } else {
3161
+ let minIndex = Infinity;
3162
+ deletingIndices.forEach((i) => {
3163
+ if (i < minIndex) {
3164
+ minIndex = i;
3165
+ }
3166
+ });
3167
+ this.cache.truncate(minIndex);
3168
+ const res = this.runAction({
3169
+ postData: {
3156
3170
  gridAction: "delete",
3157
- rowId: deletingIndices
3158
- });
3159
- } else {
3160
- let minIndex = Infinity;
3161
- deletingIndices.forEach((i) => {
3162
- if (i < minIndex) {
3163
- minIndex = i;
3164
- }
3165
- });
3166
- this.cache.truncate(minIndex);
3167
- const res = this.runAction({
3168
- postData: {
3169
- gridAction: "delete",
3170
- rowId: deletingIndices,
3171
- fireEvents: this.hasServerAjaxEventsOfType("gridDelete")
3171
+ rowId: deletingIndices,
3172
+ fireEvents: this.hasServerAjaxEventsOfType("gridDelete")
3173
+ }
3174
+ });
3175
+ const currentRows = [...this.tableController.body.rows];
3176
+ const currentSelection = new Set(
3177
+ this.tableController.getState("selection")
3178
+ );
3179
+ deletingIndices.forEach(
3180
+ (c) => this.controller.body.getRowByIndex(c).remove()
3181
+ );
3182
+ for (let i = minIndex; i < this.controller.body.rows.length; i++) {
3183
+ this.controller.body.getRowByIndex(i).cells.forEach((c) => {
3184
+ if (c instanceof GridCell) {
3185
+ c.getField().definition.index = i;
3172
3186
  }
3173
3187
  });
3174
- const currentRows = [...this.tableController.body.rows];
3175
- const currentSelection = new Set(
3176
- this.tableController.getState("selection")
3177
- );
3178
- deletingIndices.forEach(
3179
- (c) => this.controller.body.getRowByIndex(c).remove()
3180
- );
3181
- for (let i = minIndex; i < this.controller.body.rows.length; i++) {
3182
- this.controller.body.getRowByIndex(i).cells.forEach((c) => {
3183
- if (c instanceof GridCell) {
3184
- c.getField().definition.index = i;
3185
- }
3186
- });
3187
- }
3188
- this.tableController.clearSelection();
3189
- if (this.tableController.body.rows.length === 0 && this.getProperty("includeFirstRow")) {
3190
- await res;
3191
- await this.actualRefreshAction();
3192
- }
3193
- (this.tableController.body.getRowByIndex(minIndex) || this.tableController.body.getRowByIndex(minIndex - 1))?.toggleSelection(true);
3194
- (this.tableController.body.getRowByIndex(minIndex) || this.tableController.body.getRowByIndex(minIndex - 1) || this.tableController.head.getRowByIndex(0)).scrollIntoView();
3195
- return await (this.hasServerAjaxEventsOfType("gridDelete") ? inlineCaller : inlineTimeout)(async () => {
3196
- return this.asyncAction(async () => {
3197
- const evs = (await res)?.data?.eventsXml;
3198
- if (evs) {
3199
- setAjaxFormResponse(this.form.execution, parseXml(evs));
3200
- }
3201
- if (!(await res)?.data?.success) {
3202
- this.tableController.body.setState("rows", currentRows);
3203
- this.tableController.setState("selection", currentSelection);
3204
- return false;
3205
- }
3206
- return true;
3207
- }, !this.hasServerAjaxEventsOfType("gridDelete"));
3208
- }, 0);
3209
3188
  }
3189
+ this.tableController.clearSelection();
3190
+ if (this.tableController.body.rows.length === 0 && this.getProperty("includeFirstRow")) {
3191
+ await res;
3192
+ await this.actualRefreshAction();
3193
+ }
3194
+ (this.tableController.body.getRowByIndex(minIndex) || this.tableController.body.getRowByIndex(minIndex - 1))?.toggleSelection(true);
3195
+ (this.tableController.body.getRowByIndex(minIndex) || this.tableController.body.getRowByIndex(minIndex - 1) || this.tableController.head.getRowByIndex(0)).scrollIntoView();
3196
+ return await (this.hasServerAjaxEventsOfType("gridDelete") ? inlineCaller : inlineTimeout)(async () => {
3197
+ return this.asyncAction(async () => {
3198
+ const evs = (await res)?.data?.eventsXml;
3199
+ if (evs) {
3200
+ setAjaxFormResponse(this.form.execution, parseXml(evs));
3201
+ }
3202
+ const scriptResult = await this.fireScriptEvent("gridAdd");
3203
+ if (!scriptResult || !(await res)?.data?.success) {
3204
+ this.tableController.body.setState("rows", currentRows);
3205
+ this.tableController.setState("selection", currentSelection);
3206
+ return false;
3207
+ }
3208
+ return true;
3209
+ }, !this.hasServerAjaxEventsOfType("gridDelete"));
3210
+ }, 0);
3210
3211
  }
3211
3212
  return false;
3212
3213
  });
@@ -3411,78 +3412,76 @@ class Grid extends Field {
3411
3412
  }
3412
3413
  async sortDown(index) {
3413
3414
  return this.asyncAction(async () => {
3414
- if (await this.fireScriptEvent("gridSort")) {
3415
- const indices = arrayOrArray(index || this.selectedIndices).sort(
3416
- (a, b) => b - a
3417
- );
3418
- if (this.hasServerNoAjaxEventsOfType("gridSort")) {
3419
- await this.fireServerEvent("gridSort", {
3415
+ const indices = arrayOrArray(index || this.selectedIndices).sort(
3416
+ (a, b) => b - a
3417
+ );
3418
+ if (this.hasServerNoAjaxEventsOfType("gridSort")) {
3419
+ await this.fireServerEvent("gridSort", {
3420
+ gridAction: "down",
3421
+ rowId: indices
3422
+ });
3423
+ } else {
3424
+ const currentRows = [...this.tableController.body.rows];
3425
+ const res = this.runAction({
3426
+ postData: {
3420
3427
  gridAction: "down",
3421
- rowId: indices
3422
- });
3423
- } else {
3424
- const currentRows = [...this.tableController.body.rows];
3425
- const res = this.runAction({
3426
- postData: {
3427
- gridAction: "down",
3428
- rowId: indices,
3429
- fireEvents: this.hasServerAjaxEventsOfType("gridSort")
3428
+ rowId: indices,
3429
+ fireEvents: this.hasServerAjaxEventsOfType("gridSort")
3430
+ }
3431
+ });
3432
+ this.swapRows(indices, "down");
3433
+ return await (this.hasServerAjaxEventsOfType("gridSort") ? inlineCaller : inlineTimeout)(() => {
3434
+ return this.asyncAction(async () => {
3435
+ const evs = (await res)?.data?.eventsXml;
3436
+ if (evs) {
3437
+ setAjaxFormResponse(this.form.execution, parseXml(evs));
3430
3438
  }
3431
- });
3432
- this.swapRows(indices, "down");
3433
- return await (this.hasServerAjaxEventsOfType("gridSort") ? inlineCaller : inlineTimeout)(() => {
3434
- return this.asyncAction(async () => {
3435
- const evs = (await res)?.data?.eventsXml;
3436
- if (evs) {
3437
- setAjaxFormResponse(this.form.execution, parseXml(evs));
3438
- }
3439
- if (!(await res)?.data?.success || !await this.fireEvent("gridSort", { mutex: false })) {
3440
- this.tableController.body.setState("rows", currentRows);
3441
- return false;
3442
- }
3443
- return true;
3444
- }, !this.hasServerAjaxEventsOfType("gridSort"));
3445
- }, 0);
3446
- }
3439
+ const scriptEvent = await this.fireScriptEvent("gridSort");
3440
+ if (!scriptEvent || !(await res)?.data?.success || !await this.fireEvent("gridSort", { mutex: false })) {
3441
+ this.tableController.body.setState("rows", currentRows);
3442
+ return false;
3443
+ }
3444
+ return true;
3445
+ }, !this.hasServerAjaxEventsOfType("gridSort"));
3446
+ }, 0);
3447
3447
  }
3448
3448
  return false;
3449
3449
  });
3450
3450
  }
3451
3451
  async sortUp(index) {
3452
3452
  return this.asyncAction(async () => {
3453
- if (await this.fireScriptEvent("gridSort")) {
3454
- const indices = arrayOrArray(index || this.selectedIndices).sort(
3455
- (a, b) => a - b
3456
- );
3457
- if (this.hasServerNoAjaxEventsOfType("gridSort")) {
3458
- await this.fireServerEvent("gridSort", {
3459
- gridAction: "down",
3460
- rowId: indices
3461
- });
3462
- } else {
3463
- const currentRows = [...this.tableController.body.rows];
3464
- const res = this.runAction({
3465
- postData: {
3466
- gridAction: "up",
3467
- rowId: indices,
3468
- fireEvents: this.hasServerAjaxEventsOfType("gridSort")
3453
+ const indices = arrayOrArray(index || this.selectedIndices).sort(
3454
+ (a, b) => a - b
3455
+ );
3456
+ if (this.hasServerNoAjaxEventsOfType("gridSort")) {
3457
+ await this.fireServerEvent("gridSort", {
3458
+ gridAction: "down",
3459
+ rowId: indices
3460
+ });
3461
+ } else {
3462
+ const currentRows = [...this.tableController.body.rows];
3463
+ const res = this.runAction({
3464
+ postData: {
3465
+ gridAction: "up",
3466
+ rowId: indices,
3467
+ fireEvents: this.hasServerAjaxEventsOfType("gridSort")
3468
+ }
3469
+ });
3470
+ this.swapRows(indices, "up");
3471
+ return await (this.hasServerAjaxEventsOfType("gridSort") ? inlineCaller : inlineTimeout)(() => {
3472
+ return this.asyncAction(async () => {
3473
+ const evs = (await res)?.data?.eventsXml;
3474
+ if (evs) {
3475
+ setAjaxFormResponse(this.form.execution, parseXml(evs));
3469
3476
  }
3470
- });
3471
- this.swapRows(indices, "up");
3472
- return await (this.hasServerAjaxEventsOfType("gridSort") ? inlineCaller : inlineTimeout)(() => {
3473
- return this.asyncAction(async () => {
3474
- const evs = (await res)?.data?.eventsXml;
3475
- if (evs) {
3476
- setAjaxFormResponse(this.form.execution, parseXml(evs));
3477
- }
3478
- if (!(await res)?.data?.success || !await this.fireEvent("gridSort", { mutex: false })) {
3479
- this.tableController.body.setState("rows", currentRows);
3480
- return false;
3481
- }
3482
- return true;
3483
- }, !this.hasServerAjaxEventsOfType("gridSort"));
3484
- }, 0);
3485
- }
3477
+ const scriptEvent = await this.fireScriptEvent("gridSort");
3478
+ if (!scriptEvent || !(await res)?.data?.success || !await this.fireEvent("gridSort", { mutex: false })) {
3479
+ this.tableController.body.setState("rows", currentRows);
3480
+ return false;
3481
+ }
3482
+ return true;
3483
+ }, !this.hasServerAjaxEventsOfType("gridSort"));
3484
+ }, 0);
3486
3485
  }
3487
3486
  return false;
3488
3487
  });
@@ -4823,18 +4822,8 @@ class SelectField extends ApiaFieldWithAttribute {
4823
4822
  __privateAdd$f(this, _field$b, void 0);
4824
4823
  __privateSet$f(this, _field$b, field);
4825
4824
  }
4826
- // get all select options either as array[] or object
4827
- getOptions(asObject) {
4828
- if (__privateGet$f(this, _field$b).definition.id) {
4829
- const options = arrayOrArray(__privateGet$f(this, _field$b).properties.possibleValue);
4830
- const obj = /* @__PURE__ */ new Map();
4831
- if (asObject) {
4832
- options.forEach((c) => obj.set(String(c.value), c));
4833
- return obj;
4834
- }
4835
- return options;
4836
- }
4837
- return null;
4825
+ getOptions() {
4826
+ return arrayOrArray(__privateGet$f(this, _field$b).properties.possibleValue);
4838
4827
  }
4839
4828
  getTextValue(value) {
4840
4829
  return __privateGet$f(this, _field$b).getTextValue(value);
@@ -4892,7 +4881,7 @@ class SelectField extends ApiaFieldWithAttribute {
4892
4881
  if (__privateGet$f(this, _field$b).definition.id) {
4893
4882
  return arrayOrArray(__privateGet$f(this, _field$b).properties.possibleValue).find(
4894
4883
  (c) => c.selected
4895
- )?.label ?? "Not option selected";
4884
+ )?.label ?? "";
4896
4885
  }
4897
4886
  return null;
4898
4887
  }
@@ -5019,17 +5008,8 @@ class RadioField extends ApiaFieldWithAttribute {
5019
5008
  __privateAdd$c(this, _field$8, void 0);
5020
5009
  __privateSet$c(this, _field$8, field);
5021
5010
  }
5022
- getOptions(asObject) {
5023
- if (__privateGet$c(this, _field$8).definition.id) {
5024
- const radioValues = arrayOrArray(__privateGet$c(this, _field$8).properties.possibleValue);
5025
- if (asObject) {
5026
- const options = /* @__PURE__ */ new Map();
5027
- radioValues.forEach((c) => options.set(String(c.value), c));
5028
- return options;
5029
- }
5030
- return radioValues;
5031
- }
5032
- return null;
5011
+ getOptions() {
5012
+ return arrayOrArray(__privateGet$c(this, _field$8).properties.possibleValue);
5033
5013
  }
5034
5014
  clearOptions() {
5035
5015
  if (__privateGet$c(this, _field$8).definition.id) {
@@ -5160,17 +5140,8 @@ class MultipleField extends ApiaFieldWithAttribute {
5160
5140
  }
5161
5141
  return null;
5162
5142
  }
5163
- getOptions(asObject) {
5164
- if (__privateGet$b(this, _field$7).definition.id) {
5165
- const options = arrayOrArray(__privateGet$b(this, _field$7).properties.possibleValue);
5166
- const obj = /* @__PURE__ */ new Map();
5167
- if (asObject) {
5168
- options.forEach((c) => obj.set(String(c.value), c));
5169
- return obj;
5170
- }
5171
- return options;
5172
- }
5173
- return null;
5143
+ getOptions() {
5144
+ return arrayOrArray(__privateGet$b(this, _field$7).properties.possibleValue);
5174
5145
  }
5175
5146
  setOptions(optionsArray) {
5176
5147
  if (__privateGet$b(this, _field$7).definition.id) {
@@ -5187,7 +5158,7 @@ class MultipleField extends ApiaFieldWithAttribute {
5187
5158
  }
5188
5159
  _field$7 = new WeakMap();
5189
5160
 
5190
- class HiddenField extends ApiaField {
5161
+ class HiddenField extends ApiaFieldWithAttribute {
5191
5162
  }
5192
5163
 
5193
5164
  class AreaField extends ApiaFieldWithAttribute {
@@ -5809,6 +5780,13 @@ class ApiaForm {
5809
5780
  showAsModal(size = "finder") {
5810
5781
  __privateGet$3(this, _execution$1).emit("showFormAsModal", { form: __privateGet$3(this, _form), size });
5811
5782
  }
5783
+ renderComponent(componentName, el) {
5784
+ __privateGet$3(this, _execution$1).emit("renderComponent", {
5785
+ form: __privateGet$3(this, _form),
5786
+ componentName,
5787
+ el
5788
+ });
5789
+ }
5812
5790
  }
5813
5791
  _form = new WeakMap();
5814
5792
  _execution$1 = new WeakMap();
@@ -5859,6 +5837,13 @@ class ApiaFunctions {
5859
5837
  return null;
5860
5838
  }
5861
5839
  admEntity(entName, entNum, parameters, width, height) {
5840
+ __privateGet$2(this, _execution).emit("adminEntity", {
5841
+ entName,
5842
+ entNum,
5843
+ parameters,
5844
+ width,
5845
+ height
5846
+ });
5862
5847
  }
5863
5848
  clearMessages() {
5864
5849
  }
@@ -6759,6 +6744,23 @@ class Form extends WithProperties {
6759
6744
  }
6760
6745
  return super.getProperty(propName);
6761
6746
  }
6747
+ getErrorsList() {
6748
+ const errors = [];
6749
+ this.allFields.forEach((f) => {
6750
+ if (f instanceof FieldWithAttribute) {
6751
+ const fieldErrors = f.state.validation.errorMessage;
6752
+ if (fieldErrors) {
6753
+ errors.push({
6754
+ id: `${f.getForm().definition.frmParent}_${f.getForm().definition.id}_${f.definition.id}`,
6755
+ errorMessage: fieldErrors,
6756
+ title: f.attribute.title,
6757
+ focus: getFocusIdentifier(f)
6758
+ });
6759
+ }
6760
+ }
6761
+ });
6762
+ return errors;
6763
+ }
6762
6764
  }
6763
6765
 
6764
6766
  function decodeBase64ToUtf8(base64String) {
@@ -7259,10 +7261,10 @@ class Observations {
7259
7261
  }
7260
7262
  }
7261
7263
 
7262
- let FlowModal$1 = class FlowModal {
7263
- };
7264
+ class FlowModal {
7265
+ }
7264
7266
 
7265
- class ShowPoolSelection extends FlowModal$1 {
7267
+ class ShowPoolSelection extends FlowModal {
7266
7268
  constructor(fetchResult, confirm) {
7267
7269
  super();
7268
7270
  this.fetchResult = fetchResult;
@@ -7280,7 +7282,7 @@ const initialState = {
7280
7282
  disabledParents: [],
7281
7283
  groupSelectionObj: null
7282
7284
  };
7283
- class ShowPathSelection extends FlowModal$1 {
7285
+ class ShowPathSelection extends FlowModal {
7284
7286
  constructor(fetchResult, confirm) {
7285
7287
  super();
7286
7288
  this.fetchResult = fetchResult;
@@ -7315,15 +7317,15 @@ class ShowPathSelection extends FlowModal$1 {
7315
7317
  }
7316
7318
  }
7317
7319
 
7318
- let ShowSignSelection$1 = class ShowSignSelection extends FlowModal$1 {
7320
+ class ShowSignSelection extends FlowModal {
7319
7321
  constructor(fetchResult, confirm) {
7320
7322
  super();
7321
7323
  this.fetchResult = fetchResult;
7322
7324
  this.confirm = confirm;
7323
7325
  }
7324
- };
7326
+ }
7325
7327
 
7326
- class ShowConfirmMessage extends FlowModal$1 {
7328
+ class ShowConfirmMessage extends FlowModal {
7327
7329
  constructor(fetchResult, confirm) {
7328
7330
  super();
7329
7331
  this.fetchResult = fetchResult;
@@ -7331,17 +7333,18 @@ class ShowConfirmMessage extends FlowModal$1 {
7331
7333
  }
7332
7334
  }
7333
7335
 
7334
- let ShowSign$1 = class ShowSign extends FlowModal$1 {
7336
+ class ShowSign extends FlowModal {
7335
7337
  constructor(fetchResult, confirm) {
7336
7338
  super();
7337
7339
  this.fetchResult = fetchResult;
7338
7340
  this.confirm = confirm;
7339
7341
  }
7340
- };
7342
+ }
7341
7343
 
7342
7344
  function buildPoolSelection(execution, status, poolForm) {
7343
7345
  return new ShowPoolSelection(poolForm, async (result) => {
7344
7346
  if (result.confirmed) {
7347
+ const unLock = execution.lock();
7345
7348
  const confirmPoolResult = await axios.post(
7346
7349
  makeApiaUrl(execution, {
7347
7350
  action: "confirmPool",
@@ -7353,6 +7356,8 @@ function buildPoolSelection(execution, status, poolForm) {
7353
7356
  const parsedRes = parseXMLRequestResponse(
7354
7357
  confirmPoolResult
7355
7358
  );
7359
+ if (parsedRes)
7360
+ unLock();
7356
7361
  if (parsedRes?.actions?.action?.param[1] === "confirmOkOnClose" || parsedRes?.onClose === "confirmOkOnClose") {
7357
7362
  if (parsedRes?.load?.text?.content) {
7358
7363
  execution.notifications.add(
@@ -7364,6 +7369,14 @@ function buildPoolSelection(execution, status, poolForm) {
7364
7369
  }
7365
7370
  return { ...status, step: "CHECK_WIZARD" };
7366
7371
  } else {
7372
+ if (parsedRes?.sysMessages?.message) {
7373
+ execution.notifications.add(
7374
+ new MessageNotification({
7375
+ message: parsedRes?.sysMessages?.message?.text,
7376
+ type: "warning"
7377
+ })
7378
+ );
7379
+ }
7367
7380
  throw Error("Failed to confirm pool");
7368
7381
  }
7369
7382
  }
@@ -7429,7 +7442,7 @@ async function checkSign$1(execution, status) {
7429
7442
  );
7430
7443
  const mustShowSignModal = checkSignableFormsResponse?.data?.sign;
7431
7444
  if (mustShowSignModal) {
7432
- return new ShowSignSelection$1(
7445
+ return new ShowSignSelection(
7433
7446
  checkSignableFormsResponse?.data,
7434
7447
  async (result) => {
7435
7448
  if (result.confirmed && result.signed) {
@@ -7460,7 +7473,7 @@ async function sign$1(execution, status) {
7460
7473
  );
7461
7474
  const mustShowSignModal = signResponse?.data?.actions.action[1].param[1] === "showAppletModal";
7462
7475
  if (mustShowSignModal) {
7463
- return new ShowSign$1(signResponse?.data, async (result) => {
7476
+ return new ShowSign(signResponse?.data, async (result) => {
7464
7477
  if (result.confirmed) {
7465
7478
  return { ...status, step: "CONFIRM" };
7466
7479
  }
@@ -7555,7 +7568,18 @@ async function defaultConfirm$1(execution, status) {
7555
7568
  Captcha.reload();
7556
7569
  return {
7557
7570
  step: void 0,
7558
- finishedWithError: true
7571
+ finishedWithError: true,
7572
+ error: `Errors found: ${[
7573
+ ...arrayOrArray(confirmResponse?.data?.sysMessages?.message).map(
7574
+ (c) => c.text || c.label
7575
+ ),
7576
+ ...arrayOrArray(confirmResponse?.data?.sysExceptions?.exception).map(
7577
+ (c) => c.text || c.label
7578
+ ),
7579
+ ...arrayOrArray(confirmResponse?.data?.exceptions?.exception).map(
7580
+ (c) => c.text || c.label
7581
+ )
7582
+ ].filter(Boolean).join("\n")}`
7559
7583
  };
7560
7584
  }
7561
7585
  if (confirmResponse?.data?.onClose === "confirmOkOnClose") {
@@ -7683,7 +7707,7 @@ async function confirm(execution, status) {
7683
7707
  while (result.step) {
7684
7708
  const checker = checkers$1[result.step];
7685
7709
  const checkerResult = await checker(execution, result);
7686
- if (checkerResult instanceof FlowModal$1) {
7710
+ if (checkerResult instanceof FlowModal) {
7687
7711
  return checkerResult;
7688
7712
  }
7689
7713
  result = checkerResult;
@@ -7699,25 +7723,6 @@ async function confirm(execution, status) {
7699
7723
  return true;
7700
7724
  }
7701
7725
 
7702
- class FlowModal {
7703
- }
7704
-
7705
- class ShowSignSelection extends FlowModal {
7706
- constructor(fetchResult, confirm) {
7707
- super();
7708
- this.fetchResult = fetchResult;
7709
- this.confirm = confirm;
7710
- }
7711
- }
7712
-
7713
- class ShowSign extends FlowModal {
7714
- constructor(fetchResult, confirm) {
7715
- super();
7716
- this.fetchResult = fetchResult;
7717
- this.confirm = confirm;
7718
- }
7719
- }
7720
-
7721
7726
  async function checkSign(execution, status) {
7722
7727
  const checkSignableFormsResponse = await post(
7723
7728
  execution,
@@ -7766,7 +7771,7 @@ async function sign(execution, status) {
7766
7771
  }
7767
7772
  }
7768
7773
  );
7769
- const mustShowSignModal = signResponse?.data?.actions.action[1].param[1].text === "showAppletModal";
7774
+ const mustShowSignModal = signResponse?.data?.actions.action[1].param[1] === "showAppletModal";
7770
7775
  if (mustShowSignModal) {
7771
7776
  return new ShowSign(signResponse?.data, async (result) => {
7772
7777
  if (result.confirmed) {
@@ -7876,7 +7881,17 @@ const checkers = {
7876
7881
  async function confirmEntity(execution, status) {
7877
7882
  let result = status;
7878
7883
  while (result.step) {
7879
- const checker = checkers[result.step];
7884
+ const step = result.step;
7885
+ const checker = checkers[step];
7886
+ if (!checker) {
7887
+ execution.notifications.add(
7888
+ new MessageNotification({
7889
+ message: `Invalid confirm step: ${String(result.step)}`,
7890
+ type: "error"
7891
+ })
7892
+ );
7893
+ return false;
7894
+ }
7880
7895
  const checkerResult = await checker(execution, result);
7881
7896
  if (checkerResult instanceof FlowModal) {
7882
7897
  return checkerResult;
@@ -8007,6 +8022,17 @@ class Execution extends EventEmitter$1 {
8007
8022
  this._pendingPromises.delete(promise);
8008
8023
  });
8009
8024
  }
8025
+ getErrorsList() {
8026
+ const entityErrors = [];
8027
+ this.forms.E.forEach((form) => {
8028
+ entityErrors.push(...form.getErrorsList());
8029
+ });
8030
+ const processErrors = [];
8031
+ this.forms.P.forEach((form) => {
8032
+ processErrors.push(...form.getErrorsList());
8033
+ });
8034
+ return [...entityErrors, ...processErrors];
8035
+ }
8010
8036
  getAllForms() {
8011
8037
  return [...this.forms.E.values(), ...this.forms.P.values()];
8012
8038
  }
@@ -8082,6 +8108,7 @@ class Execution extends EventEmitter$1 {
8082
8108
  (c) => this.notifications.add(
8083
8109
  new MessageNotification({
8084
8110
  message: c.text,
8111
+ title: c.title,
8085
8112
  type: parseNotificationType(c.type)
8086
8113
  })
8087
8114
  )
@@ -8232,7 +8259,7 @@ class Execution extends EventEmitter$1 {
8232
8259
  step: "CHECK_LOCK"
8233
8260
  }
8234
8261
  );
8235
- if (result instanceof FlowModal$1) {
8262
+ if (result instanceof FlowModal) {
8236
8263
  return result;
8237
8264
  }
8238
8265
  return result;
@@ -8327,7 +8354,7 @@ class Execution extends EventEmitter$1 {
8327
8354
  }
8328
8355
  const mustShowSignModal = checkSignableFormsRes?.data?.sign;
8329
8356
  if (mustShowSignModal && !result?.signed) {
8330
- return new ShowSignSelection$1(
8357
+ return new ShowSignSelection(
8331
8358
  checkSignableFormsRes?.data,
8332
8359
  async () => {
8333
8360
  return "";
@@ -8474,5 +8501,5 @@ class Execution extends EventEmitter$1 {
8474
8501
  }
8475
8502
  }
8476
8503
 
8477
- export { ActionsController, AdditionalCell, ApiaAttribute, ApiaField, ApiaFieldWithAttribute, ApiaForm, ApiaFunctions, BouncingEmitter, Button, ButtonField, Captcha, CaptchaField, CheckField, Checkbox, CustomComponent, GridField as DataGridField, Editor, EditorField, EventEmitter, Execution, ExecutionState, Field, FieldWithAttribute, File, FileUploaderField, FlowModal$1 as FlowModal, Form, FormsUploader, Grid, GridCell, GridField, GridPaginated, HeaderCell, Hidden, HiddenField, IProperty, Image, ImageField, Input, InputField, InvalidSessionException, Label, Link, LinkField, MessageNotification, ModalInput, ModalInputField, Multiple, MultipleField, Notifications, Password, PasswordField, Radio, RadioField, SchedulerField, Select, SelectField, ShowConfirmMessage, ShowPathSelection, ShowPoolSelection, ShowSign$1 as ShowSign, ShowSignSelection$1 as ShowSignSelection, StatefulEmitter, StatusNotification, AreaField as TextAreaField, TextField, Textarea, Title, TranslatableField, Translation, Tree, TreeField, UploaderApi, createNewField, deepEqual, get, getFocusIdentifier, getLabel, isHtmlResponse, isJsonResponse, isXmlResponse, makeApiaUrl, parseFakeJSON$1 as parseFakeJSON, parseSuccessfulResponse, parseXml, post, shallowEqual };
8504
+ export { ActionsController, AdditionalCell, ApiaAttribute, ApiaField, ApiaFieldWithAttribute, ApiaForm, ApiaFunctions, BouncingEmitter, Button, ButtonField, Captcha, CaptchaField, CheckField, Checkbox, CustomComponent, GridField as DataGridField, Editor, EditorField, EventEmitter, Execution, ExecutionState, Field, FieldWithAttribute, File, FileUploaderField, FlowModal, Form, FormsUploader, Grid, GridCell, GridField, GridPaginated, HeaderCell, Hidden, HiddenField, IProperty, Image, ImageField, Input, InputField, InvalidSessionException, Label, Link, LinkField, MessageNotification, ModalInput, ModalInputField, Multiple, MultipleField, Notifications, Password, PasswordField, Radio, RadioField, SchedulerField, Select, SelectField, ShowConfirmMessage, ShowPathSelection, ShowPoolSelection, ShowSign, ShowSignSelection, StatefulEmitter, StatusNotification, AreaField as TextAreaField, TextField, Textarea, Title, TranslatableField, Translation, Tree, TreeField, UploaderApi, createNewField, deepEqual, get, getFocusIdentifier, getLabel, isHtmlResponse, isJsonResponse, isXmlResponse, makeApiaUrl, parseFakeJSON$1 as parseFakeJSON, parseSuccessfulResponse, parseXml, post, shallowEqual };
8478
8505
  //# sourceMappingURL=index.js.map