@apia/util 4.0.25 → 4.0.26

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
@@ -792,11 +792,13 @@ type TApiaRowDefinition = {
792
792
  selected?: boolean;
793
793
  dblclic: boolean;
794
794
  id: string;
795
+ unselectableTR?: boolean;
796
+ headName?: string;
795
797
  classToAdd?: string;
796
798
  rowSeparator?: boolean;
797
799
  suspended?: boolean;
798
- unselectableTR?: boolean;
799
- headName?: string;
800
+ docLock?: boolean;
801
+ uneditableTR?: boolean;
800
802
  isLocked?: boolean;
801
803
  cell: TApiaCellDefinition | TApiaCellDefinition[];
802
804
  boldType?: boolean;
@@ -1910,21 +1912,21 @@ declare const postNavigation: (url: string, data: Record<string, any>) => void;
1910
1912
 
1911
1913
  declare function awaitTime(ms: number): Promise<void>;
1912
1914
 
1913
- type CB = () => void;
1914
1915
  /**
1915
1916
  * A simple semaphore implementation to control concurrency.
1916
1917
  * Limits the number of concurrent tasks that can run simultaneously.
1917
1918
  */
1918
1919
  declare class Semaphore {
1919
1920
  private concurrency;
1920
- current: number;
1921
- queue: CB[];
1921
+ private current;
1922
+ private queue;
1922
1923
  /**
1923
1924
  * Creates a new instance of the Semaphore.
1924
1925
  *
1925
1926
  * @param concurrency - The maximum number of concurrent tasks allowed.
1926
1927
  */
1927
1928
  constructor(concurrency: number);
1929
+ get isBusy(): boolean;
1928
1930
  /**
1929
1931
  * Acquires a permit to run a task.
1930
1932
  *
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { makeAutoObservable, makeObservable, observable } from 'mobx';
1
+ import { makeAutoObservable, makeObservable, observable, computed } from 'mobx';
2
2
  import { jsx } from 'react/jsx-runtime';
3
3
  import * as React from 'react';
4
4
  import React__default, { useRef, useCallback, useState, useEffect, useMemo, createContext, useContext } from 'react';
@@ -1765,6 +1765,13 @@ class Semaphore {
1765
1765
  this.concurrency = concurrency;
1766
1766
  this.current = 0;
1767
1767
  this.queue = [];
1768
+ makeObservable(this, {
1769
+ current: observable,
1770
+ isBusy: computed
1771
+ });
1772
+ }
1773
+ get isBusy() {
1774
+ return this.current > 0;
1768
1775
  }
1769
1776
  /**
1770
1777
  * Acquires a permit to run a task.
@@ -1789,7 +1796,7 @@ class Semaphore {
1789
1796
  * If there are queued tasks waiting for a permit, the next one is dequeued and allowed to proceed.
1790
1797
  */
1791
1798
  release() {
1792
- this.current--;
1799
+ this.current = Math.max(0, this.current - 1);
1793
1800
  this.queue.shift()?.();
1794
1801
  }
1795
1802
  }