@apia/execution 4.0.17 → 4.0.19

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 CHANGED
@@ -207,6 +207,7 @@ type TApiaFieldCommonProperties = {
207
207
  name?: string;
208
208
  noPrint?: boolean;
209
209
  readonly?: boolean;
210
+ readOnly?: boolean;
210
211
  rowspan?: number;
211
212
  title?: string;
212
213
  tooltip?: string;
@@ -637,11 +638,11 @@ type TApiaForm = {
637
638
  signableForm: boolean;
638
639
  };
639
640
 
640
- type Comparator<T> = (a: T, b: T) => boolean;
641
- declare const shallowEqual: Comparator<any>;
641
+ type Comparator$1<T> = (a: T, b: T) => boolean;
642
+ declare const shallowEqual: Comparator$1<any>;
642
643
 
643
644
  type SetValueOptions = Partial<{
644
- comparator: Comparator<any>;
645
+ comparator: Comparator$1<any>;
645
646
  synchronize: boolean;
646
647
  }>;
647
648
  type FireEventParameters = Record<string, unknown>;
@@ -782,7 +783,7 @@ declare class Form extends WithProperties<TApiaFormProperties> {
782
783
  state: {
783
784
  isMarkedToSign: boolean;
784
785
  };
785
- protected customComponents: Map<string, CustomComponent>;
786
+ protected _customComponents: Map<string, CustomComponent>;
786
787
  protected fieldsById: Map<string, Field<Record<string, any>, TApiaFieldBaseDefinition<Record<string, any>>, {
787
788
  definition: Omit<TApiaFieldBaseDefinition<Record<string, any>>, 'properties'>;
788
789
  }>>;
@@ -794,12 +795,12 @@ declare class Form extends WithProperties<TApiaFormProperties> {
794
795
  protected fieldsGroups: Map<string, Grid>;
795
796
  definition: TApiaForm;
796
797
  constructor(definition: TApiaForm);
797
- closeForm(): void;
798
- openForm(): void;
799
- getAllFields(): Field<Record<string, any>, TApiaFieldBaseDefinition<Record<string, any>>, {
798
+ get allFields(): Field<Record<string, any>, TApiaFieldBaseDefinition<Record<string, any>>, {
800
799
  definition: Omit<TApiaFieldBaseDefinition<Record<string, any>>, "properties">;
801
800
  }>[];
802
- getCustomComponents(): CustomComponent[];
801
+ get customComponents(): Map<string, CustomComponent>;
802
+ closeForm(): void;
803
+ openForm(): void;
803
804
  getField(field: string, index?: number): Field<TApiaFieldCommonProperties, TApiaFieldBaseDefinition<TApiaFieldCommonProperties>, {
804
805
  definition: Omit<TApiaFieldBaseDefinition<TApiaFieldCommonProperties>, "properties">;
805
806
  }> | Field<Record<string, any>, TApiaFieldBaseDefinition<Record<string, any>>, {
@@ -1552,7 +1553,7 @@ declare class File$1 extends TranslatableField<TApiaFileProperties> {
1552
1553
  init(form: Form): Promise<void>;
1553
1554
  validate(): Promise<boolean>;
1554
1555
  setValue(_newValue: any, _options?: Partial<{
1555
- comparator: Comparator<any>;
1556
+ comparator: Comparator$1<any>;
1556
1557
  synchronize: boolean;
1557
1558
  }> | undefined): Promise<boolean>;
1558
1559
  }
@@ -1798,7 +1799,7 @@ declare class ModalInput extends FieldWithAttribute<TApiaInputProperties, ModalI
1798
1799
  constructor({ value, ...definition }: TApiaModalInputDefinition);
1799
1800
  fireEvent(eventName: InputEvents): Promise<boolean>;
1800
1801
  setValue(newValue: Required<ModalInputValue>, options?: Partial<{
1801
- comparator: Comparator<any>;
1802
+ comparator: Comparator$1<any>;
1802
1803
  synchronize: boolean;
1803
1804
  }> | undefined): Promise<boolean>;
1804
1805
  setValueFromModalSelection(rowId: string): Promise<void>;
@@ -2410,6 +2411,9 @@ declare class Notifications {
2410
2411
  }, K>) => UnSubscriber;
2411
2412
  }
2412
2413
 
2414
+ type Comparator<T> = (a: T, b: T) => boolean;
2415
+ declare const deepEqual: Comparator<any>;
2416
+
2413
2417
  /**
2414
2418
  * @public
2415
2419
  *
@@ -3001,5 +3005,5 @@ declare class PasswordField extends ApiaField {
3001
3005
  constructor(field: Password);
3002
3006
  }
3003
3007
 
3004
- export { ActionsController, AdditionalCell, ApiaAttribute, ApiaFieldWithAttribute, 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 IButton, type IIProperty, type IPoolsPermissions, IProperty, type ISignatureData, type IUsersPermissions, Image, ImageField, Input, InputField, InvalidSessionException, Label, Link, LinkField, MessageNotification, ModalInput, Multiple, MultipleField, Notifications, Password, PasswordField, type PossibleValue, Radio, RadioField, type RadioPossibleValue, Select, SelectField, type SelectPossibleValue, ShowConfirmMessage, ShowPathSelection, ShowPoolSelection, ShowSign, ShowSignSelection, StatefulEmitter, type Status, StatusNotification, type TActionButtons, type TAjaxUploadFileStatus, type TAjaxUploadStart, type TApiaButtonProperties, type TApiaCaptchaProperties, type TApiaCheckboxProperties, type TApiaDocumentDefinition, 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 TApiaSelectProperties, type TApiaTextareaProperties, type TApiaTitleProperties, type TApiaTranslatableFieldProperties, type TApiaTreePossibleValue, type TApiaTreeProperties, type TApiaValuatedFieldProperties, type TConfirmDropModal, type TCusCmpStateRequest, type TCustomComponentDefaultResponse, type TCustomComponentDefinition, type TDocInfo, type TDocType, type TDocumentDownloadHistory, type TDocumentInformation, type TDocumentMetadata, type TDocumentPermission, type TDocumentVersion, type TExecutionConfig, type TFieldEvent, type TFieldScriptEvent, type TFieldScriptEventParameters, type TFieldScriptEvents, type TFieldServerEvent, type TFieldServerEvents, type TFileUploaded, type TFormEventName, type TFormScriptEvent, type TFormScriptEventParameters, type TFormScriptEvents, type TFrmParent, type TModalConfig, type TObservation, type TObservations, type TOnUploadProgress, type TOpenModal, type TProcessDroppedFiles, type TRequireOnlyOne, type TSaveDroppedFilesConf, type TSignaturesData, type TUploadModalOpener, type TUploaderFileInfo, type TUploaderLoadCurrentFunction, type TUploaderLoadCurrentFunctionMessages, AreaField as TextAreaField, TextField, Textarea, Title, TranslatableField, Translation, Tree, TreeField, UploaderApi, UploaderModalController, type UploaderModalState, type UploaderState, get, getLabel, isHtmlResponse, isJsonResponse, isXmlResponse, makeApiaUrl, parseFileDefinition, parseSuccessfulResponse, parseXml, post, returnExactlyTheSame, shallowEqual };
3008
+ export { ActionsController, AdditionalCell, ApiaAttribute, ApiaFieldWithAttribute, 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 IButton, type IIProperty, type IPoolsPermissions, IProperty, type ISignatureData, type IUsersPermissions, Image, ImageField, Input, InputField, InvalidSessionException, Label, Link, LinkField, MessageNotification, ModalInput, Multiple, MultipleField, Notifications, Password, PasswordField, type PossibleValue, Radio, RadioField, type RadioPossibleValue, Select, SelectField, type SelectPossibleValue, ShowConfirmMessage, ShowPathSelection, ShowPoolSelection, ShowSign, ShowSignSelection, StatefulEmitter, type Status, StatusNotification, type TActionButtons, type TAjaxUploadFileStatus, type TAjaxUploadStart, type TApiaButtonProperties, type TApiaCaptchaProperties, type TApiaCheckboxProperties, type TApiaDocumentDefinition, 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 TApiaSelectProperties, type TApiaTextareaProperties, type TApiaTitleProperties, type TApiaTranslatableFieldProperties, type TApiaTreePossibleValue, type TApiaTreeProperties, type TApiaValuatedFieldProperties, type TConfirmDropModal, type TCusCmpStateRequest, type TCustomComponentDefaultResponse, type TCustomComponentDefinition, type TDocInfo, type TDocType, type TDocumentDownloadHistory, type TDocumentInformation, type TDocumentMetadata, type TDocumentPermission, type TDocumentVersion, type TExecutionConfig, type TFieldEvent, type TFieldScriptEvent, type TFieldScriptEventParameters, type TFieldScriptEvents, type TFieldServerEvent, type TFieldServerEvents, type TFileUploaded, type TFormEventName, type TFormScriptEvent, type TFormScriptEventParameters, type TFormScriptEvents, type TFrmParent, type TModalConfig, type TObservation, type TObservations, type TOnUploadProgress, type TOpenModal, type TProcessDroppedFiles, type TRequireOnlyOne, type TSaveDroppedFilesConf, type TSignaturesData, type TUploadModalOpener, type TUploaderFileInfo, type TUploaderLoadCurrentFunction, type TUploaderLoadCurrentFunctionMessages, AreaField as TextAreaField, TextField, Textarea, Title, TranslatableField, Translation, Tree, TreeField, UploaderApi, UploaderModalController, type UploaderModalState, type UploaderState, deepEqual, get, getLabel, isHtmlResponse, isJsonResponse, isXmlResponse, makeApiaUrl, parseFileDefinition, parseSuccessfulResponse, parseXml, post, returnExactlyTheSame, shallowEqual };
3005
3009
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -7,6 +7,42 @@ import { Cell, TableController, Row, FocusControllerPlugin } from '@apia/table2'
7
7
  import { makeApiaUrl as makeApiaUrl$1, ApiaApi } from '@apia/api';
8
8
  import axios from 'axios';
9
9
 
10
+ const deepEqual = (a, b) => {
11
+ if (Object.is(a, b))
12
+ return true;
13
+ if (!Object.is(a, b) && typeof a !== typeof b) {
14
+ return false;
15
+ }
16
+ if (typeof a === "object") {
17
+ if (Array.isArray(a)) {
18
+ if (!Array.isArray(b) || a.length !== b.length) {
19
+ return false;
20
+ }
21
+ for (let i = 0; i < a.length; i++) {
22
+ if (!deepEqual(a[i], b[i])) {
23
+ return false;
24
+ }
25
+ }
26
+ return true;
27
+ } else if (a && b) {
28
+ for (const [key, value] of Object.entries(a)) {
29
+ if (!deepEqual(value, b[key])) {
30
+ return false;
31
+ }
32
+ }
33
+ for (const [key, value] of Object.entries(b)) {
34
+ if (!deepEqual(value, a[key])) {
35
+ return false;
36
+ }
37
+ }
38
+ return true;
39
+ } else if (a && !b || !a && b) {
40
+ return false;
41
+ }
42
+ }
43
+ return a === b;
44
+ };
45
+
10
46
  var __defProp$q = Object.defineProperty;
11
47
  var __defNormalProp$q = (obj, key, value) => key in obj ? __defProp$q(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12
48
  var __publicField$q = (obj, key, value) => {
@@ -1244,6 +1280,7 @@ let Field$1 = class Field extends WithProperties {
1244
1280
  window.location.assign(
1245
1281
  await makeApiaUrl({
1246
1282
  ...p,
1283
+ currentTab: getCurrentTabsString(),
1247
1284
  stringifyOptions: { arrayFormat: "repeat" }
1248
1285
  })
1249
1286
  );
@@ -1251,6 +1288,7 @@ let Field$1 = class Field extends WithProperties {
1251
1288
  window.location.assign(
1252
1289
  await makeApiaUrl({
1253
1290
  ...p,
1291
+ currentTab: getCurrentTabsString(),
1254
1292
  stringifyOptions: { arrayFormat: "repeat" }
1255
1293
  })
1256
1294
  );
@@ -4020,10 +4058,10 @@ class CustomComponent {
4020
4058
  }
4021
4059
  }
4022
4060
  getStringValue(attName) {
4023
- return this._state.attributes[attName].join();
4061
+ return this._state.attributes[attName]?.join();
4024
4062
  }
4025
4063
  getValue(attName, index = 0) {
4026
- return this._state.attributes[attName][index];
4064
+ return this._state.attributes[attName]?.[index];
4027
4065
  }
4028
4066
  async setValue(attName, value, index) {
4029
4067
  this._state.isLoading = true;
@@ -4086,7 +4124,7 @@ let Form$1 = class Form extends WithProperties {
4086
4124
  super(props);
4087
4125
  __publicField$b(this, "fields");
4088
4126
  __publicField$b(this, "state", { isMarkedToSign: false });
4089
- __publicField$b(this, "customComponents", /* @__PURE__ */ new Map());
4127
+ __publicField$b(this, "_customComponents", /* @__PURE__ */ new Map());
4090
4128
  __publicField$b(this, "fieldsById", /* @__PURE__ */ new Map());
4091
4129
  __publicField$b(this, "fieldsByName", /* @__PURE__ */ new Map());
4092
4130
  __publicField$b(this, "fieldsByAttributeId", /* @__PURE__ */ new Map());
@@ -4098,7 +4136,9 @@ let Form$1 = class Form extends WithProperties {
4098
4136
  __publicField$b(this, "cucCmpByAttName", /* @__PURE__ */ new Map());
4099
4137
  __publicField$b(this, "mustRenderFields", []);
4100
4138
  makeObservable(this, {
4101
- state: observable
4139
+ state: observable,
4140
+ allFields: computed,
4141
+ customComponents: computed
4102
4142
  });
4103
4143
  this.definition = definition;
4104
4144
  this.fields = arrayOrArray(definition.field).sort((a, b) => {
@@ -4114,18 +4154,18 @@ let Form$1 = class Form extends WithProperties {
4114
4154
  });
4115
4155
  this.state.isMarkedToSign = this.definition.markedToSign;
4116
4156
  }
4157
+ get allFields() {
4158
+ return [...this.fieldsById.values()];
4159
+ }
4160
+ get customComponents() {
4161
+ return this._customComponents;
4162
+ }
4117
4163
  closeForm() {
4118
4164
  this.properties.prpFrmClosed = true;
4119
4165
  }
4120
4166
  openForm() {
4121
4167
  this.properties.prpFrmClosed = false;
4122
4168
  }
4123
- getAllFields() {
4124
- return [...this.fieldsById.values()];
4125
- }
4126
- getCustomComponents() {
4127
- return [...this.customComponents.values()];
4128
- }
4129
4169
  getField(field, index) {
4130
4170
  const found = this.getFieldById(field) || this.getFieldByName(field) || this.getFieldByAttributeId(field) || this.getFieldByAttributeName(field);
4131
4171
  if (found) {
@@ -4188,7 +4228,7 @@ let Form$1 = class Form extends WithProperties {
4188
4228
  return void 0;
4189
4229
  }
4190
4230
  getHiddenFields() {
4191
- return this.getAllFields().filter((c) => c.getProperty("visibilityHidden"));
4231
+ return this.allFields.filter((c) => c.getProperty("visibilityHidden"));
4192
4232
  }
4193
4233
  async markFormToSign() {
4194
4234
  void post(
@@ -4254,7 +4294,7 @@ let Form$1 = class Form extends WithProperties {
4254
4294
  for await (const customComponent of cusFields) {
4255
4295
  const cc = new CustomComponent(customComponent);
4256
4296
  await cc.init(this);
4257
- this.customComponents.set(customComponent.id, cc);
4297
+ this._customComponents.set(customComponent.id, cc);
4258
4298
  arrayOrArray(customComponent.state.state.attribute).forEach((a) => {
4259
4299
  this.cucCmpByAttId.set(Number.parseInt(String(a.attId)), cc);
4260
4300
  this.cucCmpByAttName.set(a.attName, cc);
@@ -4302,7 +4342,7 @@ let Form$1 = class Form extends WithProperties {
4302
4342
  async validate() {
4303
4343
  let isValid = true;
4304
4344
  let firstInvalid = null;
4305
- for await (const field of this.getAllFields()) {
4345
+ for await (const field of this.allFields) {
4306
4346
  if (field instanceof Grid) {
4307
4347
  const result = await field.validate();
4308
4348
  if (result !== true && !firstInvalid) {
@@ -6178,7 +6218,7 @@ class AssistantController {
6178
6218
  const formsMap = {};
6179
6219
  const windowForms = Execution.instance.getAllForms();
6180
6220
  windowForms.map((f) => {
6181
- f.getAllFields().map((fi) => {
6221
+ f.allFields.map((fi) => {
6182
6222
  const actualFi = fi;
6183
6223
  const actualName = actualFi?.getProperty("name") || actualFi.getProperty("ariaLabel") || actualFi.getProperty("title");
6184
6224
  if (actualName) {
@@ -8359,5 +8399,5 @@ class StatusNotification extends Notification {
8359
8399
  }
8360
8400
  }
8361
8401
 
8362
- export { ActionsController, AdditionalCell, ApiaAttribute, ApiaFieldWithAttribute, ApiaFunctions, BouncingEmitter, Button, ButtonField, Captcha, CaptchaField, CheckField, Checkbox, CustomComponent, GridField as DataGridField, Editor, EditorField, EventEmitter, Execution, ExecutionState, Field$1 as Field, FieldWithAttribute, File, FileUploaderField, FlowModal, Form$1 as Form, FormsUploader, Grid, GridCell, GridField, GridPaginated, HeaderCell, Hidden, HiddenField, IProperty, Image, ImageField, Input, InputField, InvalidSessionException, Label, Link, LinkField, MessageNotification, ModalInput, Multiple, MultipleField, Notifications, Password, PasswordField, Radio, RadioField, Select, SelectField, ShowConfirmMessage, ShowPathSelection, ShowPoolSelection, ShowSign, ShowSignSelection, StatefulEmitter, StatusNotification, AreaField as TextAreaField, TextField, Textarea, Title, TranslatableField, Translation, Tree, TreeField, UploaderApi, UploaderModalController, get, getLabel, isHtmlResponse, isJsonResponse, isXmlResponse, makeApiaUrl, parseFileDefinition, parseSuccessfulResponse, parseXml, post, returnExactlyTheSame, shallowEqual };
8402
+ export { ActionsController, AdditionalCell, ApiaAttribute, ApiaFieldWithAttribute, ApiaFunctions, BouncingEmitter, Button, ButtonField, Captcha, CaptchaField, CheckField, Checkbox, CustomComponent, GridField as DataGridField, Editor, EditorField, EventEmitter, Execution, ExecutionState, Field$1 as Field, FieldWithAttribute, File, FileUploaderField, FlowModal, Form$1 as Form, FormsUploader, Grid, GridCell, GridField, GridPaginated, HeaderCell, Hidden, HiddenField, IProperty, Image, ImageField, Input, InputField, InvalidSessionException, Label, Link, LinkField, MessageNotification, ModalInput, Multiple, MultipleField, Notifications, Password, PasswordField, Radio, RadioField, Select, SelectField, ShowConfirmMessage, ShowPathSelection, ShowPoolSelection, ShowSign, ShowSignSelection, StatefulEmitter, StatusNotification, AreaField as TextAreaField, TextField, Textarea, Title, TranslatableField, Translation, Tree, TreeField, UploaderApi, UploaderModalController, deepEqual, get, getLabel, isHtmlResponse, isJsonResponse, isXmlResponse, makeApiaUrl, parseFileDefinition, parseSuccessfulResponse, parseXml, post, returnExactlyTheSame, shallowEqual };
8363
8403
  //# sourceMappingURL=index.js.map