@apia/execution 4.0.29 → 4.0.30

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
@@ -1187,7 +1187,7 @@ async function getApiaFunctions(execution) {
1187
1187
  }
1188
1188
  return af;
1189
1189
  }
1190
- let Field$1 = class Field extends WithProperties {
1190
+ class Field extends WithProperties {
1191
1191
  constructor({ properties, ...definition }) {
1192
1192
  super();
1193
1193
  __publicField$n(this, "form", {});
@@ -1391,10 +1391,10 @@ let Field$1 = class Field extends WithProperties {
1391
1391
  this.definition.index
1392
1392
  );
1393
1393
  }
1394
- };
1394
+ }
1395
1395
  _hasInited$1 = new WeakMap();
1396
1396
 
1397
- class Button extends Field$1 {
1397
+ class Button extends Field {
1398
1398
  fireEvent(eventName) {
1399
1399
  return super.fireEvent(eventName);
1400
1400
  }
@@ -1406,7 +1406,7 @@ var __publicField$m = (obj, key, value) => {
1406
1406
  __defNormalProp$m(obj, typeof key !== "symbol" ? key + "" : key, value);
1407
1407
  return value;
1408
1408
  };
1409
- const _Captcha = class _Captcha extends Field$1 {
1409
+ const _Captcha = class _Captcha extends Field {
1410
1410
  constructor(definition) {
1411
1411
  super(definition);
1412
1412
  __publicField$m(this, "id", "");
@@ -1567,7 +1567,7 @@ class Attribute {
1567
1567
  this.valueType = valueType;
1568
1568
  }
1569
1569
  }
1570
- class FieldWithAttribute extends Field$1 {
1570
+ class FieldWithAttribute extends Field {
1571
1571
  constructor({
1572
1572
  attId,
1573
1573
  attName,
@@ -4185,7 +4185,7 @@ async function inlineTimeout(cb, _t) {
4185
4185
  setTimeout(cb, _t);
4186
4186
  return Promise.resolve(true);
4187
4187
  }
4188
- class Grid extends Field$1 {
4188
+ class Grid extends Field {
4189
4189
  constructor({ properties, field, ...definition }) {
4190
4190
  super({
4191
4191
  ...definition,
@@ -4768,7 +4768,7 @@ class Grid extends Field$1 {
4768
4768
  for await (const row of this.tableController.body.rows) {
4769
4769
  for await (const cell of row.cells) {
4770
4770
  const field = cell.getState("properties")?.field;
4771
- if (field instanceof Field$1) {
4771
+ if (field instanceof Field) {
4772
4772
  const result = await field.validate();
4773
4773
  if (!result && isValid && !firstInvalid) {
4774
4774
  isValid = false;
@@ -5204,7 +5204,7 @@ class GridPaginated extends Grid {
5204
5204
  }
5205
5205
  }
5206
5206
 
5207
- class Image extends Field$1 {
5207
+ class Image extends Field {
5208
5208
  }
5209
5209
 
5210
5210
  class Input extends TranslatableField {
@@ -5257,10 +5257,10 @@ class Input extends TranslatableField {
5257
5257
  }
5258
5258
  }
5259
5259
 
5260
- class Label extends Field$1 {
5260
+ class Label extends Field {
5261
5261
  }
5262
5262
 
5263
- class Link extends Field$1 {
5263
+ class Link extends Field {
5264
5264
  }
5265
5265
 
5266
5266
  class Multiple extends FieldWithAttribute {
@@ -5348,7 +5348,7 @@ class Textarea extends TranslatableField {
5348
5348
  }
5349
5349
  }
5350
5350
 
5351
- class Title extends Field$1 {
5351
+ class Title extends Field {
5352
5352
  }
5353
5353
 
5354
5354
  var __defProp$a = Object.defineProperty;
@@ -5465,7 +5465,7 @@ var __publicField$9 = (obj, key, value) => {
5465
5465
  __defNormalProp$9(obj, key + "" , value);
5466
5466
  return value;
5467
5467
  };
5468
- class SchedulerField extends Field$1 {
5468
+ class SchedulerField extends Field {
5469
5469
  constructor(definition) {
5470
5470
  super(definition);
5471
5471
  __publicField$9(this, "_schedController");
@@ -5558,7 +5558,7 @@ class SchedulerField extends Field$1 {
5558
5558
  }
5559
5559
  }
5560
5560
 
5561
- const Field = {
5561
+ const FieldConstants = Object.freeze({
5562
5562
  // field types
5563
5563
  TYPE_INPUT: "input",
5564
5564
  TYPE_SELECT: "select",
@@ -5578,16 +5578,6 @@ const Field = {
5578
5578
  TYPE_EDITOR: "editor",
5579
5579
  TYPE_TREE: "tree",
5580
5580
  TYPE_CAPTCHA: "captcha",
5581
- // field functions
5582
- FUNC_CLICK: "onclick",
5583
- FUNC_CHANGE: "onchange",
5584
- FUNC_MODAL_RETURN: "onmodalreturn",
5585
- FUNC_ROW_ADD: "onrowadd",
5586
- FUNC_ROW_DELETE: "onrowdelete",
5587
- FUNC_ROW_SORT: "onrowsort",
5588
- FUNC_COL_SELECT: "oncolselect",
5589
- // Attribute w/ props json for fields
5590
- FIELD_PROPERTIES: "properties",
5591
5581
  // Field properties
5592
5582
  PROPERTY_NAME: "name",
5593
5583
  PROPERTY_SIZE: "size",
@@ -5691,27 +5681,20 @@ const Field = {
5691
5681
  PROPERTY_INPUT_TYPE: "inputType",
5692
5682
  PROPERTY_PLACE_HOLDER: "placeHolder",
5693
5683
  PROPERTY_TITLE: "title"
5694
- };
5684
+ });
5695
5685
 
5696
- const Form$1 = {
5697
- FUNC_LOAD: "onload",
5698
- FUNC_RELOAD: "onreload",
5699
- PROPERTY_FORM_INVISIBLE: "frmInvisible",
5686
+ const FormConstants = Object.freeze({
5700
5687
  PROPERTY_FORM_HIDDEN: "frmHidden",
5688
+ PROPERTY_FORM_HIGHLIGHT: "frmHighlight",
5701
5689
  PROPERTY_FORM_CLOSED: "prpFrmClosed",
5702
5690
  PROPERTY_FORM_TAB: "frmTab",
5703
- PROPERTY_FORM_HIGHLIGHT: "frmHighlight",
5704
5691
  PROPERTY_FORM_DONT_FIRE: "frmDontFire",
5705
- PROPERTY_FORM_READONLY: "readOnly",
5706
- SIGNABLE_FORM: "signableForm",
5707
- MARKED_TO_SIGN: "markedToSign",
5708
- REQUIRED_SIGN: "requiredSignableForm",
5709
- LANGUAGES: "langs"
5710
- };
5692
+ PROPERTY_FORM_READONLY: "readOnly"
5693
+ });
5711
5694
 
5712
5695
  const IProperty = {
5713
- ...Field,
5714
- ...Form$1
5696
+ ...FieldConstants,
5697
+ ...FormConstants
5715
5698
  };
5716
5699
 
5717
5700
  class ButtonsAction {
@@ -5839,11 +5822,12 @@ var __privateSet$h = (obj, member, value, setter) => {
5839
5822
  member.set(obj, value);
5840
5823
  return value;
5841
5824
  };
5842
- var _field$e;
5825
+ var _execution$2, _field$e;
5843
5826
  class ApiaField {
5844
5827
  constructor(execution, field) {
5845
- this.execution = execution;
5828
+ __privateAdd$h(this, _execution$2, void 0);
5846
5829
  __privateAdd$h(this, _field$e, void 0);
5830
+ __privateSet$h(this, _execution$2, execution);
5847
5831
  __privateSet$h(this, _field$e, field);
5848
5832
  }
5849
5833
  get fldType() {
@@ -5853,7 +5837,7 @@ class ApiaField {
5853
5837
  return __privateGet$h(this, _field$e).definition.id;
5854
5838
  }
5855
5839
  get form() {
5856
- return new ApiaForm(this.execution, __privateGet$h(this, _field$e).getForm());
5840
+ return new ApiaForm(__privateGet$h(this, _execution$2), __privateGet$h(this, _field$e).getForm());
5857
5841
  }
5858
5842
  get index() {
5859
5843
  return __privateGet$h(this, _field$e).definition.index || 0;
@@ -5871,6 +5855,7 @@ class ApiaField {
5871
5855
  return !!__privateGet$h(this, _field$e).properties.inGrid;
5872
5856
  }
5873
5857
  }
5858
+ _execution$2 = new WeakMap();
5874
5859
  _field$e = new WeakMap();
5875
5860
 
5876
5861
  var __accessCheck$g = (obj, member, msg) => {
@@ -5959,7 +5944,6 @@ _attribute = new WeakMap();
5959
5944
  class ApiaFieldWithAttribute extends ApiaField {
5960
5945
  constructor(execution, field) {
5961
5946
  super(execution, field);
5962
- this.execution = execution;
5963
5947
  __privateAdd$f(this, _field$c, void 0);
5964
5948
  __privateSet$f(this, _field$c, field);
5965
5949
  }
@@ -6568,58 +6552,58 @@ const createNewField = (execution, field) => {
6568
6552
  return new ModalInputField(execution, field);
6569
6553
  }
6570
6554
  switch (fieldType) {
6571
- case Field.TYPE_INPUT:
6555
+ case FieldConstants.TYPE_INPUT:
6572
6556
  newField = new InputField(execution, field);
6573
6557
  break;
6574
- case Field.TYPE_PASSWORD:
6558
+ case FieldConstants.TYPE_PASSWORD:
6575
6559
  newField = new PasswordField(execution, field);
6576
6560
  break;
6577
- case Field.TYPE_SELECT:
6561
+ case FieldConstants.TYPE_SELECT:
6578
6562
  newField = new SelectField(execution, field);
6579
6563
  break;
6580
- case Field.TYPE_RADIO:
6564
+ case FieldConstants.TYPE_RADIO:
6581
6565
  newField = new RadioField(execution, field);
6582
6566
  break;
6583
- case Field.TYPE_CHECK:
6567
+ case FieldConstants.TYPE_CHECK:
6584
6568
  newField = new CheckField(execution, field);
6585
6569
  break;
6586
- case Field.TYPE_BUTTON:
6570
+ case FieldConstants.TYPE_BUTTON:
6587
6571
  newField = new ButtonField(execution, field);
6588
6572
  break;
6589
- case Field.TYPE_MULTIPLE:
6573
+ case FieldConstants.TYPE_MULTIPLE:
6590
6574
  newField = new MultipleField(execution, field);
6591
6575
  break;
6592
- case Field.TYPE_HIDDEN:
6576
+ case FieldConstants.TYPE_HIDDEN:
6593
6577
  newField = new HiddenField(execution, field);
6594
6578
  break;
6595
- case Field.TYPE_AREA:
6579
+ case FieldConstants.TYPE_AREA:
6596
6580
  newField = new AreaField(execution, field);
6597
6581
  break;
6598
- case Field.TYPE_GRID:
6582
+ case FieldConstants.TYPE_GRID:
6599
6583
  newField = new GridField(execution, field);
6600
6584
  break;
6601
- case Field.TYPE_IMAGE:
6585
+ case FieldConstants.TYPE_IMAGE:
6602
6586
  newField = new ImageField(execution, field);
6603
6587
  break;
6604
- case Field.TYPE_HREF:
6588
+ case FieldConstants.TYPE_HREF:
6605
6589
  newField = new LinkField(execution, field);
6606
6590
  break;
6607
- case Field.TYPE_LABEL:
6591
+ case FieldConstants.TYPE_LABEL:
6608
6592
  newField = new TextField(execution, field);
6609
6593
  break;
6610
- case Field.TYPE_TITLE:
6594
+ case FieldConstants.TYPE_TITLE:
6611
6595
  newField = new TextField(execution, field);
6612
6596
  break;
6613
- case Field.TYPE_FILE:
6597
+ case FieldConstants.TYPE_FILE:
6614
6598
  newField = new FileUploaderField(execution, field);
6615
6599
  break;
6616
- case Field.TYPE_CAPTCHA:
6600
+ case FieldConstants.TYPE_CAPTCHA:
6617
6601
  newField = new CaptchaField(execution, field);
6618
6602
  break;
6619
- case Field.TYPE_TREE:
6603
+ case FieldConstants.TYPE_TREE:
6620
6604
  newField = new TreeField(execution, field);
6621
6605
  break;
6622
- case Field.TYPE_EDITOR:
6606
+ case FieldConstants.TYPE_EDITOR:
6623
6607
  newField = new EditorField(execution, field);
6624
6608
  break;
6625
6609
  }
@@ -6650,12 +6634,14 @@ var __privateSet$5 = (obj, member, value, setter) => {
6650
6634
  member.set(obj, value);
6651
6635
  return value;
6652
6636
  };
6653
- var _field$2, _mutex;
6637
+ var _execution$1, _field$2, _mutex;
6654
6638
  class GridField extends ApiaField {
6655
6639
  constructor(execution, field) {
6656
6640
  super(execution, field);
6641
+ __privateAdd$5(this, _execution$1, void 0);
6657
6642
  __privateAdd$5(this, _field$2, void 0);
6658
6643
  __privateAdd$5(this, _mutex, new Mutex());
6644
+ __privateSet$5(this, _execution$1, execution);
6659
6645
  __privateSet$5(this, _field$2, field);
6660
6646
  }
6661
6647
  async addRow() {
@@ -6718,7 +6704,7 @@ class GridField extends ApiaField {
6718
6704
  }
6719
6705
  }
6720
6706
  editRow(index) {
6721
- getWindow(this.execution).dispatchEvent(
6707
+ getWindow(__privateGet$5(this, _execution$1)).dispatchEvent(
6722
6708
  new CustomEvent("openGridEdition", {
6723
6709
  detail: { index, grid: __privateGet$5(this, _field$2) }
6724
6710
  })
@@ -6794,6 +6780,7 @@ class GridField extends ApiaField {
6794
6780
  __privateGet$5(this, _field$2).toggleEditFormButton(rowIndex, isShown);
6795
6781
  }
6796
6782
  }
6783
+ _execution$1 = new WeakMap();
6797
6784
  _field$2 = new WeakMap();
6798
6785
  _mutex = new WeakMap();
6799
6786
 
@@ -6905,12 +6892,13 @@ var __privateSet$2 = (obj, member, value, setter) => {
6905
6892
  member.set(obj, value);
6906
6893
  return value;
6907
6894
  };
6908
- var _form;
6895
+ var _form, _execution;
6909
6896
  class ApiaForm {
6910
6897
  constructor(execution, form) {
6911
- this.execution = execution;
6912
6898
  __privateAdd$2(this, _form, void 0);
6899
+ __privateAdd$2(this, _execution, void 0);
6913
6900
  __privateSet$2(this, _form, form);
6901
+ __privateSet$2(this, _execution, execution);
6914
6902
  }
6915
6903
  getFrmParent() {
6916
6904
  return __privateGet$2(this, _form).definition.frmParent;
@@ -6934,6 +6922,9 @@ class ApiaForm {
6934
6922
  return __privateGet$2(this, _form).getProperty(name);
6935
6923
  }
6936
6924
  setProperty(name, value) {
6925
+ if (name === "readOnly") {
6926
+ throw new Error("Cannot update readonly property on forms");
6927
+ }
6937
6928
  __privateGet$2(this, _form).setProperty(name, value);
6938
6929
  }
6939
6930
  getCustomComponent(attName) {
@@ -6942,22 +6933,22 @@ class ApiaForm {
6942
6933
  getField(fld, index) {
6943
6934
  const field = __privateGet$2(this, _form).getField(fld, index);
6944
6935
  if (field) {
6945
- return createNewField(this.execution, field);
6936
+ return createNewField(__privateGet$2(this, _execution), field);
6946
6937
  }
6947
6938
  return void 0;
6948
6939
  }
6949
6940
  getFieldById(fldId) {
6950
6941
  const field = __privateGet$2(this, _form).getFieldById(fldId);
6951
6942
  if (field) {
6952
- return createNewField(this.execution, field);
6943
+ return createNewField(__privateGet$2(this, _execution), field);
6953
6944
  }
6954
6945
  return void 0;
6955
6946
  }
6956
6947
  getFieldColumn(name) {
6957
- return arrayOrArray(__privateGet$2(this, _form).getFieldByName(name)).map((c) => createNewField(this.execution, c)).filter((f) => Boolean(f));
6948
+ return arrayOrArray(__privateGet$2(this, _form).getFieldByName(name)).map((c) => createNewField(__privateGet$2(this, _execution), c)).filter((f) => Boolean(f));
6958
6949
  }
6959
6950
  getAllFields() {
6960
- return __privateGet$2(this, _form).allFields.map((c) => createNewField(this.execution, c)).filter((f) => Boolean(f));
6951
+ return __privateGet$2(this, _form).allFields.map((c) => createNewField(__privateGet$2(this, _execution), c)).filter((f) => Boolean(f));
6961
6952
  }
6962
6953
  clearForm(clearReadonlyFields, deleteGridsRows) {
6963
6954
  this.getAllFields().forEach((c) => {
@@ -6973,6 +6964,7 @@ class ApiaForm {
6973
6964
  }
6974
6965
  }
6975
6966
  _form = new WeakMap();
6967
+ _execution = new WeakMap();
6976
6968
 
6977
6969
  const OptionButton = {
6978
6970
  BTN_VIEW_DOCS: 100,
@@ -7267,6 +7259,9 @@ class CustomComponent {
7267
7259
  getAdditional() {
7268
7260
  return this.state.additional;
7269
7261
  }
7262
+ getCurrentForm() {
7263
+ return new ApiaForm(this.execution, this.form);
7264
+ }
7270
7265
  async init(form) {
7271
7266
  if (__privateGet$1(this, _hasInited))
7272
7267
  throw new Error("Cannot init field twice");
@@ -7902,6 +7897,9 @@ class Form extends WithProperties {
7902
7897
  async validate() {
7903
7898
  let isValid = true;
7904
7899
  let firstInvalid = null;
7900
+ if (this.properties.frmHidden) {
7901
+ return true;
7902
+ }
7905
7903
  for await (const field of this.allFields) {
7906
7904
  if (field.definition.fieldType === "grid") {
7907
7905
  const result = await field.validate();
@@ -7911,7 +7909,7 @@ class Form extends WithProperties {
7911
7909
  } else {
7912
7910
  isValid = isValid && result === true;
7913
7911
  }
7914
- } else if (field instanceof Field$1) {
7912
+ } else if (field instanceof Field) {
7915
7913
  isValid = await field.validate() && isValid;
7916
7914
  if (!isValid && !firstInvalid) {
7917
7915
  firstInvalid = field;
@@ -7920,6 +7918,12 @@ class Form extends WithProperties {
7920
7918
  }
7921
7919
  return isValid || firstInvalid;
7922
7920
  }
7921
+ getProperty(propName) {
7922
+ if (propName === "readOnly") {
7923
+ return this.definition.readOnly || this.definition.readonly;
7924
+ }
7925
+ return super.getProperty(propName);
7926
+ }
7923
7927
  }
7924
7928
 
7925
7929
  function decodeBase64ToUtf8(base64String) {
@@ -9431,5 +9435,5 @@ class Execution extends EventEmitter$1 {
9431
9435
  }
9432
9436
  }
9433
9437
 
9434
- 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$1 as 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, UploaderModalController, createNewField, deepEqual, get, getLabel, isHtmlResponse, isJsonResponse, isOneClickUploadEnabled, isXmlResponse, makeApiaUrl, parseFakeJSON$1 as parseFakeJSON, parseFileDefinition, parseSuccessfulResponse, parseXml, post, returnExactlyTheSame, shallowEqual };
9438
+ 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, UploaderModalController, createNewField, deepEqual, get, getLabel, isHtmlResponse, isJsonResponse, isOneClickUploadEnabled, isXmlResponse, makeApiaUrl, parseFakeJSON$1 as parseFakeJSON, parseFileDefinition, parseSuccessfulResponse, parseXml, post, returnExactlyTheSame, shallowEqual };
9435
9439
  //# sourceMappingURL=index.js.map