@apia/execution 4.0.99 → 4.0.103

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
@@ -175,6 +175,8 @@ type TApiaFieldWithAttributeBaseProps<T extends Record<any, any>> = TApiaFieldBa
175
175
  attId: string;
176
176
  attName: string;
177
177
  attLabel: string;
178
+ attDescription?: string;
179
+ attDesc?: string;
178
180
  qry_show_value?: any;
179
181
  value: any;
180
182
  valueType: TApiaFieldValueType;
@@ -620,14 +622,15 @@ declare class Attribute {
620
622
  readonly id: string;
621
623
  readonly name: string;
622
624
  readonly title: string;
625
+ readonly description: string;
623
626
  readonly valueType: TApiaFieldValueType;
624
- constructor(id: string, name: string, title: string, valueType: TApiaFieldValueType);
627
+ constructor(id: string, name: string, title: string, description: string, valueType: TApiaFieldValueType);
625
628
  }
626
629
  declare abstract class FieldWithAttribute<FieldProps extends TApiaFieldWithAttributeProperties = TApiaFieldWithAttributeProperties, ValueType = any, FieldDefinition extends TApiaFieldWithAttributeBaseProps<FieldProps> = TApiaFieldWithAttributeBaseProps<FieldProps>> extends Field<FieldProps, FieldDefinition, FieldWithAttributeState<FieldDefinition, FieldProps, ValueType>> {
627
630
  #private;
628
631
  protected lastSynchronizationValue: ValueType | null;
629
632
  readonly attribute: Attribute;
630
- constructor({ attId, attName, attLabel, valueType, value, ...definition }: TApiaFieldWithAttributeBaseProps<FieldProps>);
633
+ constructor({ attId, attName, attLabel, attDescription, attDesc, valueType, value, ...definition }: TApiaFieldWithAttributeBaseProps<FieldProps>);
631
634
  fireEvent(eventName: string, options?: TFireEventOptions): Promise<boolean>;
632
635
  protected getInitialValue({ value, }: TApiaFieldWithAttributeBaseProps<FieldProps>): Promise<ValueType>;
633
636
  getValidationState(): FieldValidationState;
@@ -1223,15 +1226,16 @@ declare class TextField extends ApiaField implements ITextField {
1223
1226
  declare class GridField extends ApiaField {
1224
1227
  #private;
1225
1228
  constructor(execution: Execution, field: Grid);
1226
- addRow(): Promise<IApiaField[]>;
1229
+ addRow(): GridField;
1230
+ addRowAndWait(): Promise<IApiaField[]>;
1227
1231
  clearGrid(): void;
1228
1232
  clearPage(): void;
1229
- clearRow(index: number): Promise<void>;
1233
+ clearRow(index: number): GridField;
1230
1234
  closeForm(): GridField;
1231
- deleteAllRows(): Promise<void>;
1232
- deleteGrid(): Promise<void>;
1235
+ deleteAllRows(): GridField;
1236
+ deleteGrid(): void;
1233
1237
  deletePage(): void;
1234
- deleteRow(index: number): Promise<void>;
1238
+ deleteRow(index: number): GridField;
1235
1239
  editRow(index: number): void;
1236
1240
  getSelectedIndexes(useAbsoluteIndex?: boolean): number[];
1237
1241
  getAllColumns(): (IApiaField<Readonly<{
@@ -1844,7 +1848,7 @@ declare class FileUploaderField extends ApiaFieldWithAttribute {
1844
1848
  constructor(execution: Execution, field: File$1);
1845
1849
  onChange(cb: (newValue: unknown) => unknown): void;
1846
1850
  setValue(): null;
1847
- downloadDocument(): Promise<void>;
1851
+ downloadDocument(): FileUploaderField;
1848
1852
  getValue(): string;
1849
1853
  }
1850
1854
 
@@ -1856,7 +1860,7 @@ declare class ModalInputField extends ApiaFieldWithAttribute {
1856
1860
  constructor(execution: Execution, field: ModalInput);
1857
1861
  getObjectValue(): any | null;
1858
1862
  setValue(v: any): void;
1859
- setValueFromInputWrite(value: string): Promise<void>;
1863
+ setValueFromInputWrite(value: string): ModalInputField;
1860
1864
  }
1861
1865
 
1862
1866
  type TCreateNewField = (execution: Execution, field: Field | FieldWithAttribute | CustomComponent) => IApiaField | null;
package/dist/index.js CHANGED
@@ -1643,10 +1643,11 @@ var __privateSet$k = (obj, member, value, setter) => {
1643
1643
  };
1644
1644
  var _lastOnChangeValue;
1645
1645
  class Attribute {
1646
- constructor(id, name, title, valueType) {
1646
+ constructor(id, name, title, description, valueType) {
1647
1647
  this.id = id;
1648
1648
  this.name = name;
1649
1649
  this.title = title;
1650
+ this.description = description;
1650
1651
  this.valueType = valueType;
1651
1652
  }
1652
1653
  }
@@ -1655,6 +1656,8 @@ class FieldWithAttribute extends Field {
1655
1656
  attId,
1656
1657
  attName,
1657
1658
  attLabel,
1659
+ attDescription,
1660
+ attDesc,
1658
1661
  valueType,
1659
1662
  value,
1660
1663
  ...definition
@@ -1663,7 +1666,13 @@ class FieldWithAttribute extends Field {
1663
1666
  __privateAdd$k(this, _lastOnChangeValue, null);
1664
1667
  __publicField$l(this, "lastSynchronizationValue", null);
1665
1668
  __publicField$l(this, "attribute");
1666
- this.attribute = new Attribute(attId, attName, attLabel, valueType);
1669
+ this.attribute = new Attribute(
1670
+ attId,
1671
+ attName,
1672
+ attLabel,
1673
+ attDescription ?? attDesc ?? definition.properties.tooltip ?? "",
1674
+ valueType
1675
+ );
1667
1676
  this.state.value = value;
1668
1677
  this.state.validation = {
1669
1678
  dirty: false,
@@ -1840,6 +1849,7 @@ class FieldWithAttribute extends Field {
1840
1849
  attId: this.attribute.id,
1841
1850
  attName: this.attribute.name,
1842
1851
  attLabel: this.attribute.title,
1852
+ attDescription: this.attribute.description,
1843
1853
  valueType: this.attribute.valueType,
1844
1854
  value: this.state.value
1845
1855
  });
@@ -5609,27 +5619,34 @@ var __privateSet$6 = (obj, member, value, setter) => {
5609
5619
  member.set(obj, value);
5610
5620
  return value;
5611
5621
  };
5612
- var _execution$2, _field$2, _mutex;
5622
+ var __privateMethod = (obj, member, method) => {
5623
+ __accessCheck$6(obj, member, "access private method");
5624
+ return method;
5625
+ };
5626
+ var _execution$2, _field$2, _mutex, _pendingAction, _enqueueAction, enqueueAction_fn;
5613
5627
  class GridField extends ApiaField {
5614
5628
  constructor(execution, field) {
5615
5629
  super(execution, field);
5630
+ __privateAdd$6(this, _enqueueAction);
5616
5631
  __privateAdd$6(this, _execution$2, void 0);
5617
5632
  __privateAdd$6(this, _field$2, void 0);
5618
5633
  __privateAdd$6(this, _mutex, new Mutex());
5634
+ __privateAdd$6(this, _pendingAction, Promise.resolve());
5619
5635
  __privateSet$6(this, _execution$2, execution);
5620
5636
  __privateSet$6(this, _field$2, field);
5621
5637
  }
5622
- async addRow() {
5623
- try {
5624
- await __privateGet$6(this, _mutex).acquire();
5625
- const result = await __privateGet$6(this, _field$2).addRow();
5626
- if (result) {
5627
- return this.getRow(__privateGet$6(this, _field$2).finalIndex);
5628
- }
5629
- return [];
5630
- } finally {
5631
- __privateGet$6(this, _mutex).release();
5638
+ addRow() {
5639
+ __privateMethod(this, _enqueueAction, enqueueAction_fn).call(this, async () => {
5640
+ await this.addRowAndWait();
5641
+ });
5642
+ return this;
5643
+ }
5644
+ async addRowAndWait() {
5645
+ const result = await __privateGet$6(this, _field$2).addRow();
5646
+ if (result) {
5647
+ return this.getRow(__privateGet$6(this, _field$2).finalIndex);
5632
5648
  }
5649
+ return [];
5633
5650
  }
5634
5651
  clearGrid() {
5635
5652
  throw new Error("Method deprecated");
@@ -5637,9 +5654,8 @@ class GridField extends ApiaField {
5637
5654
  clearPage() {
5638
5655
  throw new Error("Method deprecated");
5639
5656
  }
5640
- async clearRow(index) {
5641
- try {
5642
- await __privateGet$6(this, _mutex).acquire();
5657
+ clearRow(index) {
5658
+ __privateMethod(this, _enqueueAction, enqueueAction_fn).call(this, async () => {
5643
5659
  const row = __privateGet$6(this, _field$2).getRowByFieldIndex(index);
5644
5660
  if (!row) {
5645
5661
  throw new Error(`Row ${index} not found`);
@@ -5648,35 +5664,30 @@ class GridField extends ApiaField {
5648
5664
  if (c instanceof FieldWithAttribute)
5649
5665
  c.state.value = "";
5650
5666
  });
5651
- } finally {
5652
- __privateGet$6(this, _mutex).release();
5653
- }
5667
+ });
5668
+ return this;
5654
5669
  }
5655
5670
  closeForm() {
5656
5671
  __privateGet$6(this, _field$2).closeEditionModal();
5657
5672
  return this;
5658
5673
  }
5659
- async deleteAllRows() {
5660
- try {
5661
- await __privateGet$6(this, _mutex).acquire();
5674
+ deleteAllRows() {
5675
+ __privateMethod(this, _enqueueAction, enqueueAction_fn).call(this, async () => {
5662
5676
  await __privateGet$6(this, _field$2).deleteAllRows();
5663
- } finally {
5664
- __privateGet$6(this, _mutex).release();
5665
- }
5677
+ });
5678
+ return this;
5666
5679
  }
5667
- async deleteGrid() {
5680
+ deleteGrid() {
5668
5681
  throw new Error("Method deprecated");
5669
5682
  }
5670
5683
  deletePage() {
5671
5684
  throw new Error("Method deprecated");
5672
5685
  }
5673
- async deleteRow(index) {
5674
- try {
5675
- await __privateGet$6(this, _mutex).acquire();
5676
- __privateGet$6(this, _field$2).deleteRows(index);
5677
- } finally {
5678
- __privateGet$6(this, _mutex).release();
5679
- }
5686
+ deleteRow(index) {
5687
+ __privateMethod(this, _enqueueAction, enqueueAction_fn).call(this, async () => {
5688
+ await __privateGet$6(this, _field$2).deleteRows(index);
5689
+ });
5690
+ return this;
5680
5691
  }
5681
5692
  editRow(index) {
5682
5693
  getWindow(__privateGet$6(this, _execution$2)).dispatchEvent(
@@ -5763,6 +5774,20 @@ class GridField extends ApiaField {
5763
5774
  _execution$2 = new WeakMap();
5764
5775
  _field$2 = new WeakMap();
5765
5776
  _mutex = new WeakMap();
5777
+ _pendingAction = new WeakMap();
5778
+ _enqueueAction = new WeakSet();
5779
+ enqueueAction_fn = function(action) {
5780
+ __privateSet$6(this, _pendingAction, __privateGet$6(this, _pendingAction).then(async () => {
5781
+ await __privateGet$6(this, _mutex).acquire();
5782
+ try {
5783
+ return await action();
5784
+ } finally {
5785
+ __privateGet$6(this, _mutex).release();
5786
+ }
5787
+ }).catch((error) => {
5788
+ console.error(error);
5789
+ }));
5790
+ };
5766
5791
 
5767
5792
  class CaptchaField extends ApiaField {
5768
5793
  }
@@ -5811,8 +5836,11 @@ class FileUploaderField extends ApiaFieldWithAttribute {
5811
5836
  }
5812
5837
  return null;
5813
5838
  }
5814
- async downloadDocument() {
5815
- await __privateGet$5(this, _field$1).downloadDocument();
5839
+ downloadDocument() {
5840
+ void __privateGet$5(this, _field$1).downloadDocument().catch((error) => {
5841
+ console.error(error);
5842
+ });
5843
+ return this;
5816
5844
  }
5817
5845
  getValue() {
5818
5846
  return __privateGet$5(this, _field$1).uploader?.filesArray?.[0]?.docName ?? "";
@@ -5854,8 +5882,11 @@ class ModalInputField extends ApiaFieldWithAttribute {
5854
5882
  setValue(v) {
5855
5883
  __privateGet$4(this, _field).setValue(v);
5856
5884
  }
5857
- async setValueFromInputWrite(value) {
5858
- await __privateGet$4(this, _field).setValueFromInputWrite(value);
5885
+ setValueFromInputWrite(value) {
5886
+ void __privateGet$4(this, _field).setValueFromInputWrite(value).catch((error) => {
5887
+ console.error(error);
5888
+ });
5889
+ return this;
5859
5890
  }
5860
5891
  }
5861
5892
  _field = new WeakMap();