@apia/execution 4.0.98 → 4.0.102

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
@@ -1223,15 +1223,16 @@ declare class TextField extends ApiaField implements ITextField {
1223
1223
  declare class GridField extends ApiaField {
1224
1224
  #private;
1225
1225
  constructor(execution: Execution, field: Grid);
1226
- addRow(): Promise<IApiaField[]>;
1226
+ addRow(): GridField;
1227
+ addRowAndWait(): Promise<IApiaField[]>;
1227
1228
  clearGrid(): void;
1228
1229
  clearPage(): void;
1229
- clearRow(index: number): Promise<void>;
1230
+ clearRow(index: number): GridField;
1230
1231
  closeForm(): GridField;
1231
- deleteAllRows(): Promise<void>;
1232
- deleteGrid(): Promise<void>;
1232
+ deleteAllRows(): GridField;
1233
+ deleteGrid(): void;
1233
1234
  deletePage(): void;
1234
- deleteRow(index: number): Promise<void>;
1235
+ deleteRow(index: number): GridField;
1235
1236
  editRow(index: number): void;
1236
1237
  getSelectedIndexes(useAbsoluteIndex?: boolean): number[];
1237
1238
  getAllColumns(): (IApiaField<Readonly<{
@@ -1844,7 +1845,7 @@ declare class FileUploaderField extends ApiaFieldWithAttribute {
1844
1845
  constructor(execution: Execution, field: File$1);
1845
1846
  onChange(cb: (newValue: unknown) => unknown): void;
1846
1847
  setValue(): null;
1847
- downloadDocument(): Promise<void>;
1848
+ downloadDocument(): FileUploaderField;
1848
1849
  getValue(): string;
1849
1850
  }
1850
1851
 
@@ -1856,7 +1857,7 @@ declare class ModalInputField extends ApiaFieldWithAttribute {
1856
1857
  constructor(execution: Execution, field: ModalInput);
1857
1858
  getObjectValue(): any | null;
1858
1859
  setValue(v: any): void;
1859
- setValueFromInputWrite(value: string): Promise<void>;
1860
+ setValueFromInputWrite(value: string): ModalInputField;
1860
1861
  }
1861
1862
 
1862
1863
  type TCreateNewField = (execution: Execution, field: Field | FieldWithAttribute | CustomComponent) => IApiaField | null;
package/dist/index.js CHANGED
@@ -5609,27 +5609,34 @@ var __privateSet$6 = (obj, member, value, setter) => {
5609
5609
  member.set(obj, value);
5610
5610
  return value;
5611
5611
  };
5612
- var _execution$2, _field$2, _mutex;
5612
+ var __privateMethod = (obj, member, method) => {
5613
+ __accessCheck$6(obj, member, "access private method");
5614
+ return method;
5615
+ };
5616
+ var _execution$2, _field$2, _mutex, _pendingAction, _enqueueAction, enqueueAction_fn;
5613
5617
  class GridField extends ApiaField {
5614
5618
  constructor(execution, field) {
5615
5619
  super(execution, field);
5620
+ __privateAdd$6(this, _enqueueAction);
5616
5621
  __privateAdd$6(this, _execution$2, void 0);
5617
5622
  __privateAdd$6(this, _field$2, void 0);
5618
5623
  __privateAdd$6(this, _mutex, new Mutex());
5624
+ __privateAdd$6(this, _pendingAction, Promise.resolve());
5619
5625
  __privateSet$6(this, _execution$2, execution);
5620
5626
  __privateSet$6(this, _field$2, field);
5621
5627
  }
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();
5628
+ addRow() {
5629
+ __privateMethod(this, _enqueueAction, enqueueAction_fn).call(this, async () => {
5630
+ await this.addRowAndWait();
5631
+ });
5632
+ return this;
5633
+ }
5634
+ async addRowAndWait() {
5635
+ const result = await __privateGet$6(this, _field$2).addRow();
5636
+ if (result) {
5637
+ return this.getRow(__privateGet$6(this, _field$2).finalIndex);
5632
5638
  }
5639
+ return [];
5633
5640
  }
5634
5641
  clearGrid() {
5635
5642
  throw new Error("Method deprecated");
@@ -5637,9 +5644,8 @@ class GridField extends ApiaField {
5637
5644
  clearPage() {
5638
5645
  throw new Error("Method deprecated");
5639
5646
  }
5640
- async clearRow(index) {
5641
- try {
5642
- await __privateGet$6(this, _mutex).acquire();
5647
+ clearRow(index) {
5648
+ __privateMethod(this, _enqueueAction, enqueueAction_fn).call(this, async () => {
5643
5649
  const row = __privateGet$6(this, _field$2).getRowByFieldIndex(index);
5644
5650
  if (!row) {
5645
5651
  throw new Error(`Row ${index} not found`);
@@ -5648,35 +5654,30 @@ class GridField extends ApiaField {
5648
5654
  if (c instanceof FieldWithAttribute)
5649
5655
  c.state.value = "";
5650
5656
  });
5651
- } finally {
5652
- __privateGet$6(this, _mutex).release();
5653
- }
5657
+ });
5658
+ return this;
5654
5659
  }
5655
5660
  closeForm() {
5656
5661
  __privateGet$6(this, _field$2).closeEditionModal();
5657
5662
  return this;
5658
5663
  }
5659
- async deleteAllRows() {
5660
- try {
5661
- await __privateGet$6(this, _mutex).acquire();
5664
+ deleteAllRows() {
5665
+ __privateMethod(this, _enqueueAction, enqueueAction_fn).call(this, async () => {
5662
5666
  await __privateGet$6(this, _field$2).deleteAllRows();
5663
- } finally {
5664
- __privateGet$6(this, _mutex).release();
5665
- }
5667
+ });
5668
+ return this;
5666
5669
  }
5667
- async deleteGrid() {
5670
+ deleteGrid() {
5668
5671
  throw new Error("Method deprecated");
5669
5672
  }
5670
5673
  deletePage() {
5671
5674
  throw new Error("Method deprecated");
5672
5675
  }
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
- }
5676
+ deleteRow(index) {
5677
+ __privateMethod(this, _enqueueAction, enqueueAction_fn).call(this, async () => {
5678
+ await __privateGet$6(this, _field$2).deleteRows(index);
5679
+ });
5680
+ return this;
5680
5681
  }
5681
5682
  editRow(index) {
5682
5683
  getWindow(__privateGet$6(this, _execution$2)).dispatchEvent(
@@ -5763,6 +5764,20 @@ class GridField extends ApiaField {
5763
5764
  _execution$2 = new WeakMap();
5764
5765
  _field$2 = new WeakMap();
5765
5766
  _mutex = new WeakMap();
5767
+ _pendingAction = new WeakMap();
5768
+ _enqueueAction = new WeakSet();
5769
+ enqueueAction_fn = function(action) {
5770
+ __privateSet$6(this, _pendingAction, __privateGet$6(this, _pendingAction).then(async () => {
5771
+ await __privateGet$6(this, _mutex).acquire();
5772
+ try {
5773
+ return await action();
5774
+ } finally {
5775
+ __privateGet$6(this, _mutex).release();
5776
+ }
5777
+ }).catch((error) => {
5778
+ console.error(error);
5779
+ }));
5780
+ };
5766
5781
 
5767
5782
  class CaptchaField extends ApiaField {
5768
5783
  }
@@ -5811,8 +5826,11 @@ class FileUploaderField extends ApiaFieldWithAttribute {
5811
5826
  }
5812
5827
  return null;
5813
5828
  }
5814
- async downloadDocument() {
5815
- await __privateGet$5(this, _field$1).downloadDocument();
5829
+ downloadDocument() {
5830
+ void __privateGet$5(this, _field$1).downloadDocument().catch((error) => {
5831
+ console.error(error);
5832
+ });
5833
+ return this;
5816
5834
  }
5817
5835
  getValue() {
5818
5836
  return __privateGet$5(this, _field$1).uploader?.filesArray?.[0]?.docName ?? "";
@@ -5854,8 +5872,11 @@ class ModalInputField extends ApiaFieldWithAttribute {
5854
5872
  setValue(v) {
5855
5873
  __privateGet$4(this, _field).setValue(v);
5856
5874
  }
5857
- async setValueFromInputWrite(value) {
5858
- await __privateGet$4(this, _field).setValueFromInputWrite(value);
5875
+ setValueFromInputWrite(value) {
5876
+ void __privateGet$4(this, _field).setValueFromInputWrite(value).catch((error) => {
5877
+ console.error(error);
5878
+ });
5879
+ return this;
5859
5880
  }
5860
5881
  }
5861
5882
  _field = new WeakMap();