@apia/util 4.0.15 → 4.0.17

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
@@ -46,11 +46,32 @@ declare global {
46
46
  }
47
47
  declare const getDateFormat: () => TDateFormat;
48
48
 
49
+ declare global {
50
+ const VERSION: string;
51
+ const COMMITHASH: string;
52
+ const BRANCH: string;
53
+ const ENVIRONMENT: string;
54
+ const TIMESTAMP: string;
55
+ const PACKAGE_VERSION: string;
56
+ interface Window {
57
+ Globals: typeof globals;
58
+ }
59
+ }
60
+ declare const globals: {
61
+ getVersion(): {
62
+ version: string;
63
+ commit: string;
64
+ branch: string;
65
+ env: string;
66
+ timestamp: string;
67
+ package: string;
68
+ };
69
+ };
49
70
  /**
50
71
  * Indica si el debugDispatcher fue activado, lo que en muchos casos indica que
51
72
  * estamos en ambiente de desarrollo
52
73
  */
53
- declare function isDebugDispatcherEnabled(): any;
74
+ declare function isDebugDispatcherEnabled(): boolean;
54
75
  type TWindowDDispatch = (action: string, ...parameters: unknown[]) => void;
55
76
  type TDispatchCallback = (parameters: unknown[]) => unknown;
56
77
  interface IStoredCallback {
@@ -190,11 +211,18 @@ declare function findOffsetRelativeToScrollParent(element: HTMLElement, which?:
190
211
  declare function findScrollContainer(el: HTMLElement): HTMLElement | null;
191
212
 
192
213
  /**
193
- * Busca el padre con scroll visible y establece su scrollTop de acuerdo al offset del elemento pasado como argumento, de modo que éste aparezca visible dentro del padre mencionado.
214
+ * Mantiene visible `element` dentro de su contenedor con scroll,
215
+ * compensando un posible header fijo (`fixedOffsetTop`).
194
216
  *
195
- * @param fixedOffsetTop Establece un mínimo de distancia que debe mantener con el borde superior del contenedor con scroll. Se usa para compensar en las situaciones donde existen cabezales fijos.
217
+ * @param element Elemento a mostrar.
218
+ * @param fixedOffsetTop Espacio mínimo desde el top visible (ej: header fijo). Default 0.
219
+ * @param tries Cuántas reintentos en caso de layout changes. Default 2.
220
+ * @param timeout Retraso entre reintentos (ms). Default 100.
221
+ * @param scrollId Identificador opcional para agrupar timeouts.
196
222
  */
197
- declare function scrollParentIntoElement(element: HTMLElement, fixedOffsetTop?: number, tries?: number, timeout?: number, scrollId?: string | undefined): void;
223
+ declare function scrollParentIntoElement(element: HTMLElement, fixedOffsetTop?: number, tries?: number, timeout?: number, scrollId?: string): void;
224
+
225
+ declare function useMatchScrollDirection(direction: 'up' | 'down'): boolean;
198
226
 
199
227
  declare function usePanAndZoom<ContainerType extends HTMLElement = HTMLElement, ChildType extends HTMLElement | SVGElement = HTMLElement>(effectiveMargin?: {
200
228
  left: number;
@@ -242,6 +270,11 @@ declare const customEvents: {
242
270
  */
243
271
  hidePanel: string;
244
272
  showPanel: string;
273
+ /**
274
+ * Evento lanzado por formsEventsController sobre window
275
+ * cuando se termina de procesar los formularios de la tarea
276
+ */
277
+ formsReady: string;
245
278
  };
246
279
 
247
280
  /**
@@ -900,20 +933,20 @@ interface IFocusCheck {
900
933
  currentInstruction: number;
901
934
  }
902
935
  declare const focus: {
903
- "__#5@#root": HTMLElement;
904
- "__#5@#props": IFocusProps | undefined;
936
+ "__#4@#root": HTMLElement;
937
+ "__#4@#props": IFocusProps | undefined;
905
938
  afterNotificationFocus: IFocusQueryElement | undefined;
906
- "__#5@#actualFocusQuery": IFocusQueryElement[];
907
- "__#5@#currentInstruction": number;
908
- "__#5@#focusDelay": number;
909
- "__#5@#focusRetries": number;
910
- "__#5@#focusTimeout": number;
911
- "__#5@#isIntervalRunning": boolean;
912
- "__#5@#focusQuery": IFocusQueryElement[];
913
- "__#5@#checkInstruction"(focusCheck: IFocusCheck): boolean;
914
- "__#5@#doFocus"(HTMLElement: HTMLElement | TFocusRetriever, focusCheck: IFocusCheck, isLastTry: boolean, configuration?: IOnFocusConfiguration): Promise<false | HTMLElement | null>;
915
- "__#5@#resetInterval"(): void;
916
- "__#5@#runFocusInterval"(focusElement?: IFocusQueryElement, internalCall?: boolean): Promise<false | HTMLElement>;
939
+ "__#4@#actualFocusQuery": IFocusQueryElement[];
940
+ "__#4@#currentInstruction": number;
941
+ "__#4@#focusDelay": number;
942
+ "__#4@#focusRetries": number;
943
+ "__#4@#focusTimeout": number;
944
+ "__#4@#isIntervalRunning": boolean;
945
+ "__#4@#focusQuery": IFocusQueryElement[];
946
+ "__#4@#checkInstruction"(focusCheck: IFocusCheck): boolean;
947
+ "__#4@#doFocus"(HTMLElement: HTMLElement | TFocusRetriever, focusCheck: IFocusCheck, isLastTry: boolean, configuration?: IOnFocusConfiguration): Promise<false | HTMLElement | null>;
948
+ "__#4@#resetInterval"(): void;
949
+ "__#4@#runFocusInterval"(focusElement?: IFocusQueryElement, internalCall?: boolean): Promise<false | HTMLElement>;
917
950
  /**
918
951
  * Da la instrucción de colocar el foco en el elemento provisto como
919
952
  * parámetro una vez que todas las notificaciones se hayan cerrado. En caso
@@ -1573,61 +1606,25 @@ declare function useDomState<T extends HTMLAttributes<HTMLElement>>(initialDomPr
1573
1606
  */
1574
1607
  declare function useDebouncedState<T>(timeout: number, initialState?: T): [T | undefined, (state: SetStateAction<T>, immediate?: boolean) => unknown];
1575
1608
 
1576
- declare class ScreenLocker extends EventEmitter<{
1577
- forcedStateChange: {
1578
- hasReleasedFirstTime: boolean;
1579
- isForced: boolean;
1580
- };
1581
- lockStateChange: {
1582
- hasReleasedFirstTime: boolean;
1583
- isLocked: boolean;
1584
- lockName: string;
1585
- };
1609
+ declare class Locker extends EventEmitter<{
1586
1610
  releaseForFirstTime: null;
1587
- ready: null;
1588
1611
  }> {
1589
- #private;
1590
- get hasReleasedFirstTime(): boolean;
1591
- get isForced(): boolean;
1592
- /**
1593
- * Permite saber si un bloqueo determinado está activo o si la clase tiene
1594
- * forceLock activo.
1595
- */
1596
- isLocked(lockName?: string): boolean;
1612
+ private locks;
1613
+ private hasReleased;
1614
+ private mutex;
1597
1615
  constructor();
1598
- lock(lockName?: string): void;
1599
- unlock(lockName?: string): void;
1600
- force(): void;
1601
- releaseForced(): void;
1616
+ get isLocked(): boolean;
1617
+ lock(): void;
1618
+ unlock(): void;
1619
+ }
1620
+ declare const screenLocker: Locker;
1621
+
1622
+ declare class ScrollLocker {
1623
+ private static locks;
1624
+ private static evaluate;
1625
+ static lock(): void;
1626
+ static unlock(): void;
1602
1627
  }
1603
- /**
1604
- * Esta clase no implementa ninguna funcionalidad de bloqueo, sino solamente se
1605
- * encarga de la lógica y de los eventos.
1606
- *
1607
- * El concepto es que hay n niveles de bloqueo y además existe el bloqueo
1608
- * forzado. Cada uno de los niveles recibe un nombre, por defecto se realizan
1609
- * operaciones contra el bloque 'common' si no se pasa ninguno, pero
1610
- * podría utilizarse cualquier otro. Esto es así con el fin de implementar
1611
- * varios bloqueos en la misma clase, ejemplos: el bloqueo común, el bloqueo
1612
- * lineal de las tablas, bloque con pantalla blanca en el inicio de formularios,
1613
- * o cualquier otro que se desee. Para los bloqueos estándar se utilizan los
1614
- * métodos lock y unlock.
1615
- *
1616
- * El bloqueo forzado por otra parte es un estado general que se puede alterar
1617
- * mediante los métodos force y releaseForced. Cada vez que se bloquee o
1618
- * desbloquee la pantalla, se lanzará un evento lockStateChange sin lockName y
1619
- * con forced = true.
1620
- *
1621
- * Además, provee un evento para saber cuándo se desbloquea la pantalla
1622
- * efectivamente por primera vez para cada tipo de bloqueo. Es posible a su vez
1623
- * resetear la clase para que este evento sea lanzado nuevamente en el próximo
1624
- * desbloqueo mediante resetRefreshFirstTime.
1625
- *
1626
- * El evento releasForFirstTime se dispara únicamente para el bloqueo 'common'.
1627
- * Esto es así ya que sino podría dar lugar a confusión en situaciones donde no
1628
- * se controle el nombre del bloqueo.
1629
- */
1630
- declare const screenLocker: ScreenLocker;
1631
1628
 
1632
1629
  type StatefulStoreUnsuscriber = () => void;
1633
1630
  type StatefulStoreUpdater<Props> = (currentProps: Props) => Props;
@@ -1877,6 +1874,8 @@ declare class ClassNameBuilder {
1877
1874
  get(): string;
1878
1875
  }
1879
1876
 
1877
+ declare function decodeBase64ToUtf8(base64String: string): string;
1878
+
1880
1879
  /**
1881
1880
  * Toma un valor y devuelve true o false según las
1882
1881
  * siguientes condiciones:
@@ -1907,14 +1906,42 @@ declare const parseXMLRequestResponse: (response: AxiosResponse<unknown, unknown
1907
1906
 
1908
1907
  declare const postNavigation: (url: string, data: Record<string, any>) => void;
1909
1908
 
1910
- declare class Mutex {
1911
- locked: boolean;
1912
- queue: any[];
1909
+ type CB = () => void;
1910
+ /**
1911
+ * A simple semaphore implementation to control concurrency.
1912
+ * Limits the number of concurrent tasks that can run simultaneously.
1913
+ */
1914
+ declare class Semaphore {
1915
+ private concurrency;
1916
+ current: number;
1917
+ queue: CB[];
1918
+ /**
1919
+ * Creates a new instance of the Semaphore.
1920
+ *
1921
+ * @param concurrency - The maximum number of concurrent tasks allowed.
1922
+ */
1923
+ constructor(concurrency: number);
1924
+ /**
1925
+ * Acquires a permit to run a task.
1926
+ *
1927
+ * If the number of currently acquired permits is less than the concurrency limit,
1928
+ * the promise resolves immediately. Otherwise, it is queued until a permit is released.
1929
+ *
1930
+ * @returns A promise that resolves when the permit has been acquired.
1931
+ */
1932
+ acquire(): Promise<void>;
1933
+ /**
1934
+ * Releases a previously acquired permit.
1935
+ *
1936
+ * If there are queued tasks waiting for a permit, the next one is dequeued and allowed to proceed.
1937
+ */
1938
+ release(): void;
1939
+ }
1940
+
1941
+ declare class Mutex extends Semaphore {
1913
1942
  constructor();
1914
- lock(): Promise<void>;
1915
- unlock(): void;
1916
- runExclusive(fn: () => Promise<unknown>): Promise<unknown>;
1943
+ runExclusive(cb: () => unknown): Promise<void>;
1917
1944
  }
1918
1945
 
1919
- export { AudioRecorder, type AudioRecorderState, BasicStoredElement, BouncingEmitter, type Callback, ClassNameBuilder, type DebounceOptions, type DeepReadonly, type DownloadStringAsDocProps, EventEmitter, History, type IOnFocusConfiguration, type IParameter, type ISetBoundary, type Map, Mutex, PropsSelectorUndefinedObject, PropsStore, StatefulEmitter, type StatefulStoreUpdateProps, type StatefulStoreUpdater, type TApiaAction, type TApiaActions, type TApiaCellDefinition, type TApiaComplexCell, type TApiaFieldPropsObj, type TApiaFilter, type TApiaFilterOption, type TApiaFilterValue, type TApiaFormButton, type TApiaFormElement, type TApiaFormElementOption, type TApiaFunction, type TApiaFunctionPageInfo, type TApiaLoad, type TApiaLoadForm, type TApiaLoadText, type TApiaMessage, type TApiaMultiplePossibleValue, type TApiaPossibleValue, type TApiaRadioPossibleValue, type TApiaRowDefinition, type TApiaSelectPossibleValue, type TApiaSystemMessageObj, type TApiaTableFunction, type TCallback, type TDateFormat, type TDispatchCallback, type TDownloadUrlOptions, type TFieldEvent, type TFieldScriptEvent, type TFieldScriptEvents, type TFieldServerEvent, type TFieldServerEvents, type TFncParams, type TFocusRetriever, type THistoryCount, type THistoryStep, type THistoryStepChange, type TId, type TKey, type TMap$1 as TMap, type TMessage, type TModify, type TNotificationMessage, type TPropsComparator, type TPropsConfiguration, type TPropsSelector, type TRequireOnlyOne, type TShortcutBranch, type TUpdateFieldConfiguration, type ThrottleOptions, type UnSubscriber, Url, addBoundary, alignment, animate, apiaDateToStandarFormat, arrayOrArray, autoDisconnectMutationObserver, cantFocusSelector, cloneDeep, customEvents, dateToApiaFormat, debugDispatcher, decodeHTMLEntities, decrypt, defaultGetNameFromResponse, disableChildrenFocus, downloadStringAsDoc, downloadUrl, enableChildrenFocus, encrypt, findOffsetRelativeToScrollParent, findScrollContainer, focus, focusSelector, formatMessage, freezeDeep, getDateFormat, getFocusSelector, getIndex, getJSObjFromXML, getLabel, getSpecificParent, getValueByPath, globalFocus, isChild, isDebugDispatcherEnabled, isPropsConfigurationObject, isSetter, makeImperativeComponent, makeSingleImperativeComponent, makeStatefulStore, noNaN, notificationsSelector, openAndReadFile, openAndReadFiles, parseAsSize, parseXMLRequestResponse, parseXmlAsync, persistentStorage, postNavigation, propsStore, screenLocker, scrollParentIntoElement, setValueByPath, shallowCompareArrays, shallowEqual, shortcutController, toBoolean, ucfirst, useCombinedRefs, useDebouncedCallback, useDebouncedState, useDomState, useImperativeComponentContext, useImperativeComponentEvents, useIntermediateValue, useLatest, useLocalStorage, useMount, usePanAndZoom, usePrevious, usePropsSelector, useShallowMemo, useStateRef, useSubscription, useUnmount, useUpdateEffect, useWhyUpdated };
1946
+ export { AudioRecorder, type AudioRecorderState, BasicStoredElement, BouncingEmitter, type Callback, ClassNameBuilder, type DebounceOptions, type DeepReadonly, type DownloadStringAsDocProps, EventEmitter, History, type IOnFocusConfiguration, type IParameter, type ISetBoundary, Locker, type Map, Mutex, PropsSelectorUndefinedObject, PropsStore, ScrollLocker, Semaphore, StatefulEmitter, type StatefulStoreUpdateProps, type StatefulStoreUpdater, type TApiaAction, type TApiaActions, type TApiaCellDefinition, type TApiaComplexCell, type TApiaFieldPropsObj, type TApiaFilter, type TApiaFilterOption, type TApiaFilterValue, type TApiaFormButton, type TApiaFormElement, type TApiaFormElementOption, type TApiaFunction, type TApiaFunctionPageInfo, type TApiaLoad, type TApiaLoadForm, type TApiaLoadText, type TApiaMessage, type TApiaMultiplePossibleValue, type TApiaPossibleValue, type TApiaRadioPossibleValue, type TApiaRowDefinition, type TApiaSelectPossibleValue, type TApiaSystemMessageObj, type TApiaTableFunction, type TCallback, type TDateFormat, type TDispatchCallback, type TDownloadUrlOptions, type TFieldEvent, type TFieldScriptEvent, type TFieldScriptEvents, type TFieldServerEvent, type TFieldServerEvents, type TFncParams, type TFocusRetriever, type THistoryCount, type THistoryStep, type THistoryStepChange, type TId, type TKey, type TMap$1 as TMap, type TMessage, type TModify, type TNotificationMessage, type TPropsComparator, type TPropsConfiguration, type TPropsSelector, type TRequireOnlyOne, type TShortcutBranch, type TUpdateFieldConfiguration, type ThrottleOptions, type UnSubscriber, Url, addBoundary, alignment, animate, apiaDateToStandarFormat, arrayOrArray, autoDisconnectMutationObserver, cantFocusSelector, cloneDeep, customEvents, dateToApiaFormat, debugDispatcher, decodeBase64ToUtf8, decodeHTMLEntities, decrypt, defaultGetNameFromResponse, disableChildrenFocus, downloadStringAsDoc, downloadUrl, enableChildrenFocus, encrypt, findOffsetRelativeToScrollParent, findScrollContainer, focus, focusSelector, formatMessage, freezeDeep, getDateFormat, getFocusSelector, getIndex, getJSObjFromXML, getLabel, getSpecificParent, getValueByPath, globalFocus, globals, isChild, isDebugDispatcherEnabled, isPropsConfigurationObject, isSetter, makeImperativeComponent, makeSingleImperativeComponent, makeStatefulStore, noNaN, notificationsSelector, openAndReadFile, openAndReadFiles, parseAsSize, parseXMLRequestResponse, parseXmlAsync, persistentStorage, postNavigation, propsStore, screenLocker, scrollParentIntoElement, setValueByPath, shallowCompareArrays, shallowEqual, shortcutController, toBoolean, ucfirst, useCombinedRefs, useDebouncedCallback, useDebouncedState, useDomState, useImperativeComponentContext, useImperativeComponentEvents, useIntermediateValue, useLatest, useLocalStorage, useMatchScrollDirection, useMount, usePanAndZoom, usePrevious, usePropsSelector, useShallowMemo, useStateRef, useSubscription, useUnmount, useUpdateEffect, useWhyUpdated };
1920
1947
  //# sourceMappingURL=index.d.ts.map