@apia/execution 4.0.47 → 4.0.58

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/LICENSE.md ADDED
@@ -0,0 +1,6 @@
1
+ All Rights Reserved.
2
+
3
+ Copyright (c) 2026 Statum
4
+
5
+ This software and associated documentation files are proprietary and confidential.
6
+ Unauthorized copying, distribution, modification, or use is strictly prohibited.
package/dist/index.d.ts CHANGED
@@ -308,8 +308,10 @@ type TApiaGridProperties = TApiaFieldCommonProperties & {
308
308
  type TApiaHiddenProperties = TApiaFieldCommonProperties & TApiaGroupableFieldProperties & TApiaFieldWithAttributeProperties & {};
309
309
  type TApiaImageProperties = TApiaFieldCommonProperties & TApiaGroupableFieldProperties & {
310
310
  imageUrl?: string;
311
+ url?: string;
311
312
  };
312
313
  type TApiaInputProperties = TApiaFieldCommonProperties & TApiaTranslatableFieldProperties & TApiaGroupableFieldProperties & TApiaFieldWithAttributeProperties & TApiaFieldSizableFieldProperties & {
314
+ autoComplete?: string;
313
315
  regExpMessage?: string;
314
316
  placeHolder?: string;
315
317
  autoFocus?: string;
@@ -358,6 +360,7 @@ type TApiaSelectProperties = TApiaFieldCommonProperties & TApiaGroupableFieldPro
358
360
  title?: string;
359
361
  };
360
362
  type TApiaTextareaProperties = TApiaFieldCommonProperties & TApiaTranslatableFieldProperties & TApiaFieldWithAttributeProperties & TApiaFieldSizableFieldProperties & {
363
+ autoComplete?: string;
361
364
  autoFocus?: string;
362
365
  placeHolder?: string;
363
366
  title?: string;
@@ -762,6 +765,7 @@ declare const FormConstants: Readonly<{
762
765
  PROPERTY_FORM_TAB: "frmTab";
763
766
  PROPERTY_FORM_DONT_FIRE: "frmDontFire";
764
767
  PROPERTY_FORM_READONLY: "readOnly";
768
+ PROPERTY_FORM_INVISIBLE: "frmInvisible";
765
769
  }>;
766
770
 
767
771
  interface IIProperty {
@@ -1048,6 +1052,7 @@ declare class ApiaForm implements IApiaForm {
1048
1052
  clearForm(clearReadonlyFields: boolean, deleteGridsRows: boolean): void;
1049
1053
  hideModal(): void;
1050
1054
  showAsModal(size?: TModalSize): void;
1055
+ renderComponent(componentName: string, el: HTMLElement): void;
1051
1056
  }
1052
1057
 
1053
1058
  declare abstract class ApiaField<Props extends typeof FieldConstants = typeof FieldConstants> implements IApiaField<Props> {
@@ -1105,6 +1110,7 @@ declare class SelectField extends ApiaFieldWithAttribute<string | number | (stri
1105
1110
  #private;
1106
1111
  constructor(execution: Execution, field: Select);
1107
1112
  getOptions(asObject: boolean): TOptionsMap$2 | TOptionsAsArray | null;
1113
+ getTextValue(value: string): any;
1108
1114
  addOption(optionValue: string | number, showValue: string, allowRepeatedValue: boolean): void;
1109
1115
  setOptions(optionsArray: PossibleValue[]): void;
1110
1116
  removeOption(optionValue: string | number): void;
@@ -1137,6 +1143,7 @@ declare class RadioField extends ApiaFieldWithAttribute {
1137
1143
  constructor(execution: Execution, field: Radio);
1138
1144
  getOptions(asObject: boolean): TOptionsMap$1 | PossibleValue[] | null;
1139
1145
  clearOptions(): void | null;
1146
+ getTextValue(value: string): any;
1140
1147
  addOption(radioValue: string | number, showValue: string, allowRepeatedValue: boolean): void;
1141
1148
  setOptions(options: PossibleValue[]): void;
1142
1149
  removeOption(radioValue: string | number): void;
@@ -1889,6 +1896,54 @@ declare class CustomComponent {
1889
1896
  setState<K extends keyof TCustomComponentState>(prop: K, value: TCustomComponentState[K]): void;
1890
1897
  }
1891
1898
 
1899
+ declare enum ExecutionState {
1900
+ RUNNING = 0,
1901
+ LOADING = 1,
1902
+ FINISHED = 2,
1903
+ RENDERING = 3,
1904
+ CONFIRMING = 4,
1905
+ FINISHED_WITH_ERROR = 5
1906
+ }
1907
+ type TOnClose = 'clearEvalPath' | 'confirmOkOnClose' | 'confirmOkOnCloseSplash' | 'confirmOkOnSaveSplash' | 'releaseOkOnClose' | null;
1908
+ type TErrMessage = {
1909
+ message: {
1910
+ text: string;
1911
+ label?: string;
1912
+ };
1913
+ };
1914
+ type TFetchTaskActionResponse = {
1915
+ onClose?: TOnClose;
1916
+ sysMessages?: TErrMessage;
1917
+ sysExceptions?: TErrMessage;
1918
+ type?: string;
1919
+ actions?: {
1920
+ action: {
1921
+ param: string[];
1922
+ toDo: string;
1923
+ };
1924
+ };
1925
+ load?: {
1926
+ canClose: boolean;
1927
+ type: string;
1928
+ text: {
1929
+ label: string;
1930
+ closeAll: boolean;
1931
+ addClass?: string;
1932
+ title?: string;
1933
+ };
1934
+ };
1935
+ text?: {
1936
+ title?: string;
1937
+ label?: string;
1938
+ };
1939
+ };
1940
+ type FieldError = {
1941
+ id: string;
1942
+ errorMessage: string;
1943
+ title: string;
1944
+ focus: string;
1945
+ };
1946
+
1892
1947
  declare class Form extends WithProperties<TApiaFormProperties> {
1893
1948
  execution: Execution;
1894
1949
  fields: TApiaFieldBaseDefinition<Record<string, any>>[];
@@ -1911,7 +1966,7 @@ declare class Form extends WithProperties<TApiaFormProperties> {
1911
1966
  definition: Omit<TApiaFieldBaseDefinition<Record<string, any>>, "properties">;
1912
1967
  }>[];
1913
1968
  get customComponents(): Map<string, CustomComponent>;
1914
- closeForm(): void;
1969
+ toggleFormCollapse(): Promise<void>;
1915
1970
  openForm(): void;
1916
1971
  getField(field: string, index?: number): Field<TApiaFieldCommonProperties, TApiaFieldBaseDefinition<TApiaFieldCommonProperties>, {
1917
1972
  definition: Omit<TApiaFieldBaseDefinition<TApiaFieldCommonProperties>, "properties">;
@@ -1953,6 +2008,7 @@ declare class Form extends WithProperties<TApiaFormProperties> {
1953
2008
  fireScriptEvent(eventName: TFormEventName): Promise<boolean>;
1954
2009
  validate(): Promise<true | Field>;
1955
2010
  getProperty<K extends keyof TApiaFormProperties>(propName: K | 'readOnly'): TApiaFormProperties[K];
2011
+ getErrorsList(): FieldError[];
1956
2012
  }
1957
2013
 
1958
2014
  type TTranslationState = {
@@ -2498,48 +2554,6 @@ declare abstract class FlowModal<T extends {
2498
2554
  abstract confirm(result: T): Promise<Status | FlowModal<any>>;
2499
2555
  }
2500
2556
 
2501
- declare enum ExecutionState {
2502
- RUNNING = 0,
2503
- LOADING = 1,
2504
- FINISHED = 2,
2505
- RENDERING = 3,
2506
- CONFIRMING = 4,
2507
- FINISHED_WITH_ERROR = 5
2508
- }
2509
- type TOnClose = 'clearEvalPath' | 'confirmOkOnClose' | 'confirmOkOnCloseSplash' | 'confirmOkOnSaveSplash' | 'releaseOkOnClose' | null;
2510
- type TErrMessage = {
2511
- message: {
2512
- text: string;
2513
- label?: string;
2514
- };
2515
- };
2516
- type TFetchTaskActionResponse = {
2517
- onClose?: TOnClose;
2518
- sysMessages?: TErrMessage;
2519
- sysExceptions?: TErrMessage;
2520
- type?: string;
2521
- actions?: {
2522
- action: {
2523
- param: string[];
2524
- toDo: string;
2525
- };
2526
- };
2527
- load?: {
2528
- canClose: boolean;
2529
- type: string;
2530
- text: {
2531
- label: string;
2532
- closeAll: boolean;
2533
- addClass?: string;
2534
- title?: string;
2535
- };
2536
- };
2537
- text?: {
2538
- title?: string;
2539
- label?: string;
2540
- };
2541
- };
2542
-
2543
2557
  type TCheckWizardResponse = {
2544
2558
  url: string;
2545
2559
  };
@@ -2688,6 +2702,11 @@ declare class Execution extends EventEmitter$1<{
2688
2702
  form: Form;
2689
2703
  size?: TModalSize;
2690
2704
  };
2705
+ renderComponent: {
2706
+ form: Form;
2707
+ componentName: string;
2708
+ el: HTMLElement;
2709
+ };
2691
2710
  }> {
2692
2711
  environment: TExecutionEnvironment;
2693
2712
  renderers?: TModalConfig['renderers'];
@@ -2697,6 +2716,7 @@ declare class Execution extends EventEmitter$1<{
2697
2716
  private observations;
2698
2717
  private executedOnLoadEvents;
2699
2718
  executionConfig: TExecutionConfig | null;
2719
+ lastFieldFocusedId: string | null;
2700
2720
  private _steps;
2701
2721
  private _currentStep;
2702
2722
  private _stepCount;
@@ -2718,6 +2738,7 @@ declare class Execution extends EventEmitter$1<{
2718
2738
  hasChangedAnything: boolean;
2719
2739
  };
2720
2740
  addPendingPromise(promise: Promise<boolean>): void;
2741
+ getErrorsList(): FieldError[];
2721
2742
  getAllForms(): Form[];
2722
2743
  private hasInitializedFormsTabs;
2723
2744
  initializeFormsTabs(frmParent: TFrmParent, cb: () => unknown): void;
@@ -3396,6 +3417,7 @@ declare const IProperty: {
3396
3417
  readonly PROPERTY_FORM_TAB: "frmTab";
3397
3418
  readonly PROPERTY_FORM_DONT_FIRE: "frmDontFire";
3398
3419
  readonly PROPERTY_FORM_READONLY: "readOnly";
3420
+ readonly PROPERTY_FORM_INVISIBLE: "frmInvisible";
3399
3421
  readonly TYPE_INPUT: "input";
3400
3422
  readonly TYPE_SELECT: "select";
3401
3423
  readonly TYPE_RADIO: "radio";
@@ -3678,5 +3700,7 @@ declare function getLabel(execution: Execution, label: string, replacers?: Parti
3678
3700
 
3679
3701
  declare function parseFakeJSON<T extends Record<string, unknown>>(str: string): T;
3680
3702
 
3681
- export { ActionsController, AdditionalCell, ApiaAttribute, ApiaField, ApiaFieldWithAttribute, ApiaForm, ApiaFunctions, BouncingEmitter, Button, ButtonField, Captcha, CaptchaField, CheckField, Checkbox, type ComponentEvent, CustomComponent, GridField as DataGridField, Editor, EditorField, EventEmitter, Execution, ExecutionState, Field, FieldWithAttribute, type FieldWithAttributeState, type FieldsMapping, File$1 as File, FileUploaderField, FlowModal, Form, FormsUploader, Grid, GridCell, GridField, GridPaginated, HeaderCell, Hidden, HiddenField, type IApiaField, type IApiaForm, type IApiaFunctions, type IIProperty, IProperty, type ISignatureData, Image, ImageField, Input, InputField, InvalidSessionException, Label, Link, LinkField, MessageNotification, ModalInput, ModalInputField, Multiple, MultipleField, Notifications, Password, PasswordField, type PossibleValue, Radio, RadioField, type RadioPossibleValue, SchedulerField, Select, SelectField, type SelectPossibleValue, ShowConfirmMessage, ShowPathSelection, ShowPoolSelection, ShowSign, ShowSignSelection, StatefulEmitter, type Status, StatusNotification, type TApiaButtonProperties, type TApiaCaptchaProperties, type TApiaCheckboxProperties, type TApiaEditorProperties, type TApiaFieldBaseDefinition, type TApiaFieldCommonProperties, type TApiaFieldDefinition, type TApiaFieldPossibleValue, type TApiaFieldSizableFieldProperties, type TApiaFieldType, type TApiaFieldValueType, type TApiaFieldWithAttributeBaseProps, type TApiaFieldWithAttributeProperties, type TApiaFileProperties, type TApiaForm, type TApiaFormProperties, type TApiaGridProperties, type TApiaGroupableFieldProperties, type TApiaHiddenProperties, type TApiaImageProperties, type TApiaInputProperties, type TApiaLabelProperties, type TApiaLinkProperties, type TApiaMultipleProperties, type TApiaPasswordProperties, type TApiaRadioProperties, type TApiaSchedulerProperties, type TApiaSelectProperties, type TApiaTextareaProperties, type TApiaTitleProperties, type TApiaTranslatableFieldProperties, type TApiaTreePossibleValue, type TApiaTreeProperties, type TApiaValuatedFieldProperties, type TCheckWizardResponse, type TCusCmpStateRequest, type TCustomComponentDefaultResponse, type TCustomComponentDefinition, type TExecutionConfig, type TFetchConfirmPathResponse, type TFieldEvent, type TFieldScriptEvent, type TFieldScriptEventParameters, type TFieldScriptEvents, type TFieldServerEvent, type TFieldServerEvents, type TFormEventName, type TFormScriptEvent, type TFormScriptEventParameters, type TFormScriptEvents, type TFrmParent, type TItemTreeObj, type TObservation, type TObservations, type TPathType, type TSignaturesData, AreaField as TextAreaField, TextField, Textarea, Title, TranslatableField, Translation, Tree, TreeField, UploaderApi, createNewField, deepEqual, get, getLabel, isHtmlResponse, isJsonResponse, isXmlResponse, makeApiaUrl, parseFakeJSON, parseSuccessfulResponse, parseXml, post, shallowEqual };
3703
+ declare function getFocusIdentifier(field: Field): string;
3704
+
3705
+ export { ActionsController, AdditionalCell, ApiaAttribute, ApiaField, ApiaFieldWithAttribute, ApiaForm, ApiaFunctions, BouncingEmitter, Button, ButtonField, Captcha, CaptchaField, CheckField, Checkbox, type ComponentEvent, CustomComponent, GridField as DataGridField, Editor, EditorField, EventEmitter, Execution, ExecutionState, Field, FieldWithAttribute, type FieldWithAttributeState, type FieldsMapping, File$1 as File, FileUploaderField, FlowModal, Form, FormsUploader, Grid, GridCell, GridField, GridPaginated, HeaderCell, Hidden, HiddenField, type IApiaField, type IApiaForm, type IApiaFunctions, type IIProperty, IProperty, type ISignatureData, Image, ImageField, Input, InputField, InvalidSessionException, Label, Link, LinkField, MessageNotification, ModalInput, ModalInputField, Multiple, MultipleField, Notifications, Password, PasswordField, type PossibleValue, Radio, RadioField, type RadioPossibleValue, SchedulerField, Select, SelectField, type SelectPossibleValue, ShowConfirmMessage, ShowPathSelection, ShowPoolSelection, ShowSign, ShowSignSelection, StatefulEmitter, type Status, StatusNotification, type TApiaButtonProperties, type TApiaCaptchaProperties, type TApiaCheckboxProperties, type TApiaEditorProperties, type TApiaFieldBaseDefinition, type TApiaFieldCommonProperties, type TApiaFieldDefinition, type TApiaFieldPossibleValue, type TApiaFieldSizableFieldProperties, type TApiaFieldType, type TApiaFieldValueType, type TApiaFieldWithAttributeBaseProps, type TApiaFieldWithAttributeProperties, type TApiaFileProperties, type TApiaForm, type TApiaFormProperties, type TApiaGridProperties, type TApiaGroupableFieldProperties, type TApiaHiddenProperties, type TApiaImageProperties, type TApiaInputProperties, type TApiaLabelProperties, type TApiaLinkProperties, type TApiaMultipleProperties, type TApiaPasswordProperties, type TApiaRadioProperties, type TApiaSchedulerProperties, type TApiaSelectProperties, type TApiaTextareaProperties, type TApiaTitleProperties, type TApiaTranslatableFieldProperties, type TApiaTreePossibleValue, type TApiaTreeProperties, type TApiaValuatedFieldProperties, type TCheckWizardResponse, type TCusCmpStateRequest, type TCustomComponentDefaultResponse, type TCustomComponentDefinition, type TExecutionConfig, type TFetchConfirmPathResponse, type TFieldEvent, type TFieldScriptEvent, type TFieldScriptEventParameters, type TFieldScriptEvents, type TFieldServerEvent, type TFieldServerEvents, type TFormEventName, type TFormScriptEvent, type TFormScriptEventParameters, type TFormScriptEvents, type TFrmParent, type TItemTreeObj, type TObservation, type TObservations, type TPathType, type TSignaturesData, AreaField as TextAreaField, TextField, Textarea, Title, TranslatableField, Translation, Tree, TreeField, UploaderApi, createNewField, deepEqual, get, getFocusIdentifier, getLabel, isHtmlResponse, isJsonResponse, isXmlResponse, makeApiaUrl, parseFakeJSON, parseSuccessfulResponse, parseXml, post, shallowEqual };
3682
3706
  //# sourceMappingURL=index.d.ts.map
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") {
@@ -1172,7 +1175,7 @@ const setAjaxFormResponse = async (execution, response) => {
1172
1175
  apiaForm.setProperty(IProperty$1.PROPERTY_FORM_HIDDEN, false);
1173
1176
  }
1174
1177
  if (form.c === "t" && String(apiaForm.getProperty(IProperty$1.PROPERTY_FORM_CLOSED)) !== "true") {
1175
- apiaForm.closeForm();
1178
+ apiaForm.toggleFormCollapse();
1176
1179
  } else if (form.c === "f" && String(apiaForm.getProperty(IProperty$1.PROPERTY_FORM_CLOSED)) === "true") {
1177
1180
  apiaForm.openForm();
1178
1181
  }
@@ -1193,6 +1196,11 @@ const asyncCreateNewField = async (execution, fld) => {
1193
1196
  return creator(execution, fld);
1194
1197
  };
1195
1198
 
1199
+ function getFocusIdentifier(field) {
1200
+ const name = field.properties.name || field.attribute?.name || field.definition.id;
1201
+ return `${field.getForm().definition.frmParent}_${field.getForm().definition.formName}_${name}${field.definition.index ? `_${field.definition.index}` : ""}`;
1202
+ }
1203
+
1196
1204
  var __defProp$n = Object.defineProperty;
1197
1205
  var __defNormalProp$n = (obj, key, value) => key in obj ? __defProp$n(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1198
1206
  var __publicField$n = (obj, key, value) => {
@@ -1395,6 +1403,9 @@ class Field extends WithProperties {
1395
1403
  }
1396
1404
  if (event) {
1397
1405
  const isAjax = event.isAjax;
1406
+ this.getForm().execution.lastFieldFocusedId = getFocusIdentifier(
1407
+ this
1408
+ );
1398
1409
  if (isAjax) {
1399
1410
  return this.fireAjaxServerEvent(event, params);
1400
1411
  } else {
@@ -3973,8 +3984,36 @@ class Input extends TranslatableField {
3973
3984
  const inFmt = getDateFormat(options?.format);
3974
3985
  const outFmt = getDateFormat();
3975
3986
  if (typeof newValue === "string") {
3976
- const d = dayjs(newValue.trim(), inFmt, true);
3977
- if (!d.isValid() && newValue.trim() !== "") {
3987
+ const trimmed = newValue.trim();
3988
+ if (/^\d+$/.test(trimmed)) {
3989
+ const digits = trimmed.length;
3990
+ let ms = Number(trimmed);
3991
+ if (digits === 10) {
3992
+ ms = ms * 1e3;
3993
+ }
3994
+ const d2 = dayjs(ms);
3995
+ if (!d2.isValid() && trimmed !== "") {
3996
+ this.state.validation.errorMessage = getLabel(
3997
+ this.getForm().execution,
3998
+ "msgInvalidDate"
3999
+ ).text;
4000
+ this.validDate = false;
4001
+ }
4002
+ return super.setValue(d2.isValid() ? d2.format(outFmt) : "", options);
4003
+ }
4004
+ const d = dayjs(trimmed, inFmt, true);
4005
+ if (!d.isValid() && trimmed !== "") {
4006
+ this.state.validation.errorMessage = getLabel(
4007
+ this.getForm().execution,
4008
+ "msgInvalidDate"
4009
+ ).text;
4010
+ this.validDate = false;
4011
+ }
4012
+ return super.setValue(d.isValid() ? d.format(outFmt) : "", options);
4013
+ }
4014
+ if (typeof newValue === "number") {
4015
+ const d = dayjs(newValue);
4016
+ if (!d.isValid()) {
3978
4017
  this.state.validation.errorMessage = getLabel(
3979
4018
  this.getForm().execution,
3980
4019
  "msgInvalidDate"
@@ -4518,7 +4557,8 @@ const FormConstants = Object.freeze({
4518
4557
  PROPERTY_FORM_CLOSED: "prpFrmClosed",
4519
4558
  PROPERTY_FORM_TAB: "frmTab",
4520
4559
  PROPERTY_FORM_DONT_FIRE: "frmDontFire",
4521
- PROPERTY_FORM_READONLY: "readOnly"
4560
+ PROPERTY_FORM_READONLY: "readOnly",
4561
+ PROPERTY_FORM_INVISIBLE: "frmInvisible"
4522
4562
  });
4523
4563
 
4524
4564
  const IProperty = {
@@ -4767,7 +4807,7 @@ var __accessCheck$f = (obj, member, msg) => {
4767
4807
  };
4768
4808
  var __privateGet$f = (obj, member, getter) => {
4769
4809
  __accessCheck$f(obj, member, "read from private field");
4770
- return member.get(obj);
4810
+ return getter ? getter.call(obj) : member.get(obj);
4771
4811
  };
4772
4812
  var __privateAdd$f = (obj, member, value) => {
4773
4813
  if (member.has(obj))
@@ -4799,6 +4839,9 @@ class SelectField extends ApiaFieldWithAttribute {
4799
4839
  }
4800
4840
  return null;
4801
4841
  }
4842
+ getTextValue(value) {
4843
+ return __privateGet$f(this, _field$b).getTextValue(value);
4844
+ }
4802
4845
  // adds a option to the select field
4803
4846
  addOption(optionValue, showValue, allowRepeatedValue) {
4804
4847
  let isValueRepeated = false;
@@ -4852,7 +4895,7 @@ class SelectField extends ApiaFieldWithAttribute {
4852
4895
  if (__privateGet$f(this, _field$b).definition.id) {
4853
4896
  return arrayOrArray(__privateGet$f(this, _field$b).properties.possibleValue).find(
4854
4897
  (c) => c.selected
4855
- )?.label ?? "Not option selected";
4898
+ )?.label ?? "";
4856
4899
  }
4857
4900
  return null;
4858
4901
  }
@@ -4960,7 +5003,7 @@ var __accessCheck$c = (obj, member, msg) => {
4960
5003
  };
4961
5004
  var __privateGet$c = (obj, member, getter) => {
4962
5005
  __accessCheck$c(obj, member, "read from private field");
4963
- return member.get(obj);
5006
+ return getter ? getter.call(obj) : member.get(obj);
4964
5007
  };
4965
5008
  var __privateAdd$c = (obj, member, value) => {
4966
5009
  if (member.has(obj))
@@ -4996,6 +5039,9 @@ class RadioField extends ApiaFieldWithAttribute {
4996
5039
  __privateGet$c(this, _field$8).properties.possibleValue = [];
4997
5040
  }
4998
5041
  }
5042
+ getTextValue(value) {
5043
+ return __privateGet$c(this, _field$8).getTextValue(value);
5044
+ }
4999
5045
  addOption(radioValue, showValue, allowRepeatedValue) {
5000
5046
  if (__privateGet$c(this, _field$8).definition.id) {
5001
5047
  const radioValues = arrayOrArray(__privateGet$c(this, _field$8).properties.possibleValue);
@@ -5766,6 +5812,13 @@ class ApiaForm {
5766
5812
  showAsModal(size = "finder") {
5767
5813
  __privateGet$3(this, _execution$1).emit("showFormAsModal", { form: __privateGet$3(this, _form), size });
5768
5814
  }
5815
+ renderComponent(componentName, el) {
5816
+ __privateGet$3(this, _execution$1).emit("renderComponent", {
5817
+ form: __privateGet$3(this, _form),
5818
+ componentName,
5819
+ el
5820
+ });
5821
+ }
5769
5822
  }
5770
5823
  _form = new WeakMap();
5771
5824
  _execution$1 = new WeakMap();
@@ -6440,8 +6493,19 @@ class Form extends WithProperties {
6440
6493
  get customComponents() {
6441
6494
  return this._customComponents;
6442
6495
  }
6443
- closeForm() {
6444
- this.properties.prpFrmClosed = true;
6496
+ async toggleFormCollapse() {
6497
+ this.properties.prpFrmClosed = !this.properties.prpFrmClosed;
6498
+ void post(
6499
+ this.execution,
6500
+ makeApiaUrl(this.execution, {
6501
+ ajaxUrl: "apia.execution.FormAction.run?",
6502
+ action: "closeForm",
6503
+ frmId: this.definition.id,
6504
+ frmParent: this.definition.frmParent,
6505
+ collapse: this.properties.prpFrmClosed,
6506
+ react: true
6507
+ })
6508
+ );
6445
6509
  }
6446
6510
  openForm() {
6447
6511
  this.properties.prpFrmClosed = false;
@@ -6705,6 +6769,23 @@ class Form extends WithProperties {
6705
6769
  }
6706
6770
  return super.getProperty(propName);
6707
6771
  }
6772
+ getErrorsList() {
6773
+ const errors = [];
6774
+ this.allFields.forEach((f) => {
6775
+ if (f instanceof FieldWithAttribute) {
6776
+ const fieldErrors = f.state.validation.errorMessage;
6777
+ if (fieldErrors) {
6778
+ errors.push({
6779
+ id: `${f.getForm().definition.frmParent}_${f.getForm().definition.id}_${f.definition.id}`,
6780
+ errorMessage: fieldErrors,
6781
+ title: f.attribute.title,
6782
+ focus: getFocusIdentifier(f)
6783
+ });
6784
+ }
6785
+ }
6786
+ });
6787
+ return errors;
6788
+ }
6708
6789
  }
6709
6790
 
6710
6791
  function decodeBase64ToUtf8(base64String) {
@@ -7205,10 +7286,10 @@ class Observations {
7205
7286
  }
7206
7287
  }
7207
7288
 
7208
- let FlowModal$1 = class FlowModal {
7209
- };
7289
+ class FlowModal {
7290
+ }
7210
7291
 
7211
- class ShowPoolSelection extends FlowModal$1 {
7292
+ class ShowPoolSelection extends FlowModal {
7212
7293
  constructor(fetchResult, confirm) {
7213
7294
  super();
7214
7295
  this.fetchResult = fetchResult;
@@ -7226,7 +7307,7 @@ const initialState = {
7226
7307
  disabledParents: [],
7227
7308
  groupSelectionObj: null
7228
7309
  };
7229
- class ShowPathSelection extends FlowModal$1 {
7310
+ class ShowPathSelection extends FlowModal {
7230
7311
  constructor(fetchResult, confirm) {
7231
7312
  super();
7232
7313
  this.fetchResult = fetchResult;
@@ -7261,15 +7342,15 @@ class ShowPathSelection extends FlowModal$1 {
7261
7342
  }
7262
7343
  }
7263
7344
 
7264
- let ShowSignSelection$1 = class ShowSignSelection extends FlowModal$1 {
7345
+ class ShowSignSelection extends FlowModal {
7265
7346
  constructor(fetchResult, confirm) {
7266
7347
  super();
7267
7348
  this.fetchResult = fetchResult;
7268
7349
  this.confirm = confirm;
7269
7350
  }
7270
- };
7351
+ }
7271
7352
 
7272
- class ShowConfirmMessage extends FlowModal$1 {
7353
+ class ShowConfirmMessage extends FlowModal {
7273
7354
  constructor(fetchResult, confirm) {
7274
7355
  super();
7275
7356
  this.fetchResult = fetchResult;
@@ -7277,17 +7358,18 @@ class ShowConfirmMessage extends FlowModal$1 {
7277
7358
  }
7278
7359
  }
7279
7360
 
7280
- let ShowSign$1 = class ShowSign extends FlowModal$1 {
7361
+ class ShowSign extends FlowModal {
7281
7362
  constructor(fetchResult, confirm) {
7282
7363
  super();
7283
7364
  this.fetchResult = fetchResult;
7284
7365
  this.confirm = confirm;
7285
7366
  }
7286
- };
7367
+ }
7287
7368
 
7288
7369
  function buildPoolSelection(execution, status, poolForm) {
7289
7370
  return new ShowPoolSelection(poolForm, async (result) => {
7290
7371
  if (result.confirmed) {
7372
+ const unLock = execution.lock();
7291
7373
  const confirmPoolResult = await axios.post(
7292
7374
  makeApiaUrl(execution, {
7293
7375
  action: "confirmPool",
@@ -7299,6 +7381,8 @@ function buildPoolSelection(execution, status, poolForm) {
7299
7381
  const parsedRes = parseXMLRequestResponse(
7300
7382
  confirmPoolResult
7301
7383
  );
7384
+ if (parsedRes)
7385
+ unLock();
7302
7386
  if (parsedRes?.actions?.action?.param[1] === "confirmOkOnClose" || parsedRes?.onClose === "confirmOkOnClose") {
7303
7387
  if (parsedRes?.load?.text?.content) {
7304
7388
  execution.notifications.add(
@@ -7310,6 +7394,14 @@ function buildPoolSelection(execution, status, poolForm) {
7310
7394
  }
7311
7395
  return { ...status, step: "CHECK_WIZARD" };
7312
7396
  } else {
7397
+ if (parsedRes?.sysMessages?.message) {
7398
+ execution.notifications.add(
7399
+ new MessageNotification({
7400
+ message: parsedRes?.sysMessages?.message?.text,
7401
+ type: "warning"
7402
+ })
7403
+ );
7404
+ }
7313
7405
  throw Error("Failed to confirm pool");
7314
7406
  }
7315
7407
  }
@@ -7375,7 +7467,7 @@ async function checkSign$1(execution, status) {
7375
7467
  );
7376
7468
  const mustShowSignModal = checkSignableFormsResponse?.data?.sign;
7377
7469
  if (mustShowSignModal) {
7378
- return new ShowSignSelection$1(
7470
+ return new ShowSignSelection(
7379
7471
  checkSignableFormsResponse?.data,
7380
7472
  async (result) => {
7381
7473
  if (result.confirmed && result.signed) {
@@ -7406,7 +7498,7 @@ async function sign$1(execution, status) {
7406
7498
  );
7407
7499
  const mustShowSignModal = signResponse?.data?.actions.action[1].param[1] === "showAppletModal";
7408
7500
  if (mustShowSignModal) {
7409
- return new ShowSign$1(signResponse?.data, async (result) => {
7501
+ return new ShowSign(signResponse?.data, async (result) => {
7410
7502
  if (result.confirmed) {
7411
7503
  return { ...status, step: "CONFIRM" };
7412
7504
  }
@@ -7501,7 +7593,18 @@ async function defaultConfirm$1(execution, status) {
7501
7593
  Captcha.reload();
7502
7594
  return {
7503
7595
  step: void 0,
7504
- finishedWithError: true
7596
+ finishedWithError: true,
7597
+ error: `Errors found: ${[
7598
+ ...arrayOrArray(confirmResponse?.data?.sysMessages?.message).map(
7599
+ (c) => c.text || c.label
7600
+ ),
7601
+ ...arrayOrArray(confirmResponse?.data?.sysExceptions?.exception).map(
7602
+ (c) => c.text || c.label
7603
+ ),
7604
+ ...arrayOrArray(confirmResponse?.data?.exceptions?.exception).map(
7605
+ (c) => c.text || c.label
7606
+ )
7607
+ ].filter(Boolean).join("\n")}`
7505
7608
  };
7506
7609
  }
7507
7610
  if (confirmResponse?.data?.onClose === "confirmOkOnClose") {
@@ -7629,7 +7732,7 @@ async function confirm(execution, status) {
7629
7732
  while (result.step) {
7630
7733
  const checker = checkers$1[result.step];
7631
7734
  const checkerResult = await checker(execution, result);
7632
- if (checkerResult instanceof FlowModal$1) {
7735
+ if (checkerResult instanceof FlowModal) {
7633
7736
  return checkerResult;
7634
7737
  }
7635
7738
  result = checkerResult;
@@ -7645,25 +7748,6 @@ async function confirm(execution, status) {
7645
7748
  return true;
7646
7749
  }
7647
7750
 
7648
- class FlowModal {
7649
- }
7650
-
7651
- class ShowSignSelection extends FlowModal {
7652
- constructor(fetchResult, confirm) {
7653
- super();
7654
- this.fetchResult = fetchResult;
7655
- this.confirm = confirm;
7656
- }
7657
- }
7658
-
7659
- class ShowSign extends FlowModal {
7660
- constructor(fetchResult, confirm) {
7661
- super();
7662
- this.fetchResult = fetchResult;
7663
- this.confirm = confirm;
7664
- }
7665
- }
7666
-
7667
7751
  async function checkSign(execution, status) {
7668
7752
  const checkSignableFormsResponse = await post(
7669
7753
  execution,
@@ -7712,7 +7796,7 @@ async function sign(execution, status) {
7712
7796
  }
7713
7797
  }
7714
7798
  );
7715
- const mustShowSignModal = signResponse?.data?.actions.action[1].param[1].text === "showAppletModal";
7799
+ const mustShowSignModal = signResponse?.data?.actions.action[1].param[1] === "showAppletModal";
7716
7800
  if (mustShowSignModal) {
7717
7801
  return new ShowSign(signResponse?.data, async (result) => {
7718
7802
  if (result.confirmed) {
@@ -7822,7 +7906,17 @@ const checkers = {
7822
7906
  async function confirmEntity(execution, status) {
7823
7907
  let result = status;
7824
7908
  while (result.step) {
7825
- const checker = checkers[result.step];
7909
+ const step = result.step;
7910
+ const checker = checkers[step];
7911
+ if (!checker) {
7912
+ execution.notifications.add(
7913
+ new MessageNotification({
7914
+ message: `Invalid confirm step: ${String(result.step)}`,
7915
+ type: "error"
7916
+ })
7917
+ );
7918
+ return false;
7919
+ }
7826
7920
  const checkerResult = await checker(execution, result);
7827
7921
  if (checkerResult instanceof FlowModal) {
7828
7922
  return checkerResult;
@@ -7846,6 +7940,27 @@ var __publicField = (obj, key, value) => {
7846
7940
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
7847
7941
  return value;
7848
7942
  };
7943
+ function parseNotificationType(str) {
7944
+ let type = "warning";
7945
+ switch (str) {
7946
+ case "1":
7947
+ type = "success";
7948
+ break;
7949
+ case "2":
7950
+ type = "warning";
7951
+ break;
7952
+ case "3":
7953
+ type = "error";
7954
+ break;
7955
+ case "4":
7956
+ type = "modal";
7957
+ break;
7958
+ case "5":
7959
+ type = "info";
7960
+ break;
7961
+ }
7962
+ return type;
7963
+ }
7849
7964
  const unescapeMarkup = (str) => {
7850
7965
  if (str !== void 0 && str.length > 0) {
7851
7966
  return str.replace(/&apos;/g, "'").replace(/&quot;/g, '"').replace(/&gt;/g, ">").replace(/&lt;/g, "<").replace(/&amp;/g, "&");
@@ -7863,6 +7978,7 @@ class Execution extends EventEmitter$1 {
7863
7978
  __publicField(this, "observations");
7864
7979
  __publicField(this, "executedOnLoadEvents", false);
7865
7980
  __publicField(this, "executionConfig", null);
7981
+ __publicField(this, "lastFieldFocusedId", null);
7866
7982
  __publicField(this, "_steps", []);
7867
7983
  __publicField(this, "_currentStep", 1);
7868
7984
  __publicField(this, "_stepCount", 1);
@@ -7931,6 +8047,17 @@ class Execution extends EventEmitter$1 {
7931
8047
  this._pendingPromises.delete(promise);
7932
8048
  });
7933
8049
  }
8050
+ getErrorsList() {
8051
+ const entityErrors = [];
8052
+ this.forms.E.forEach((form) => {
8053
+ entityErrors.push(...form.getErrorsList());
8054
+ });
8055
+ const processErrors = [];
8056
+ this.forms.P.forEach((form) => {
8057
+ processErrors.push(...form.getErrorsList());
8058
+ });
8059
+ return [...entityErrors, ...processErrors];
8060
+ }
7934
8061
  getAllForms() {
7935
8062
  return [...this.forms.E.values(), ...this.forms.P.values()];
7936
8063
  }
@@ -8006,7 +8133,7 @@ class Execution extends EventEmitter$1 {
8006
8133
  (c) => this.notifications.add(
8007
8134
  new MessageNotification({
8008
8135
  message: c.text,
8009
- type: "warning"
8136
+ type: parseNotificationType(c.type)
8010
8137
  })
8011
8138
  )
8012
8139
  );
@@ -8156,7 +8283,7 @@ class Execution extends EventEmitter$1 {
8156
8283
  step: "CHECK_LOCK"
8157
8284
  }
8158
8285
  );
8159
- if (result instanceof FlowModal$1) {
8286
+ if (result instanceof FlowModal) {
8160
8287
  return result;
8161
8288
  }
8162
8289
  return result;
@@ -8251,7 +8378,7 @@ class Execution extends EventEmitter$1 {
8251
8378
  }
8252
8379
  const mustShowSignModal = checkSignableFormsRes?.data?.sign;
8253
8380
  if (mustShowSignModal && !result?.signed) {
8254
- return new ShowSignSelection$1(
8381
+ return new ShowSignSelection(
8255
8382
  checkSignableFormsRes?.data,
8256
8383
  async () => {
8257
8384
  return "";
@@ -8398,5 +8525,5 @@ class Execution extends EventEmitter$1 {
8398
8525
  }
8399
8526
  }
8400
8527
 
8401
- 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, getLabel, isHtmlResponse, isJsonResponse, isXmlResponse, makeApiaUrl, parseFakeJSON$1 as parseFakeJSON, parseSuccessfulResponse, parseXml, post, shallowEqual };
8528
+ 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 };
8402
8529
  //# sourceMappingURL=index.js.map