@apia/util 4.0.43 → 4.0.44

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
@@ -1,6 +1,7 @@
1
1
  import * as React from 'react';
2
- import React__default, { SetStateAction, Dispatch, EffectCallback, MutableRefObject, DependencyList, FC, HTMLAttributes } from 'react';
2
+ import React__default, { SetStateAction, Dispatch, EffectCallback, MutableRefObject, DependencyList, FC, HTMLAttributes, ReactNode } from 'react';
3
3
  import { AxiosResponse } from 'axios';
4
+ import * as react_jsx_runtime from 'react/jsx-runtime';
4
5
 
5
6
  declare function animate(duration: number, callback: (progress: number) => unknown, onFinish?: () => unknown): () => void;
6
7
 
@@ -39,7 +40,7 @@ declare function uniqueId(prefix?: string): string;
39
40
 
40
41
  declare function apiaDateToStandarFormat(date: string): string;
41
42
 
42
- declare function dateToApiaFormat(date: string | Date): string;
43
+ declare function dateToApiaFormat(date: string | Date): string | undefined;
43
44
 
44
45
  type TDateFormat = 'DD/MM/YYYY' | 'MM/DD/YYYY' | 'YYYY/MM/DD';
45
46
 
@@ -50,6 +51,8 @@ declare global {
50
51
  }
51
52
  declare const getDateFormat: (format?: string) => TDateFormat;
52
53
 
54
+ declare function dateFromApiaFormat(str: string): Date | null;
55
+
53
56
  declare global {
54
57
  const VERSION: string;
55
58
  const COMMITHASH: string;
@@ -773,18 +776,18 @@ type TApiaFilter = {
773
776
  isRange?: boolean;
774
777
  };
775
778
 
776
- interface TApiaAction {
779
+ interface T__LEGACY_SERVER__ApiaAction {
777
780
  toDo?: string;
778
781
  param: string | string[];
779
782
  }
780
- interface TApiaActions {
781
- action: TApiaAction | TApiaAction[];
783
+ interface T__LEGACY_SERVER__ApiaActions {
784
+ action: T__LEGACY_SERVER__ApiaAction | T__LEGACY_SERVER__ApiaAction[];
782
785
  }
783
- interface TApiaMessage {
786
+ interface T__LEGACY_SERVER__ApiaMessage {
784
787
  text: string;
785
788
  label?: string;
786
789
  }
787
- type TApiaComplexCell = {
790
+ type T__LEGACY_SERVER__ApiaComplexCell = {
788
791
  label: string;
789
792
  classToAdd?: string;
790
793
  isHTML?: boolean;
@@ -792,8 +795,8 @@ type TApiaComplexCell = {
792
795
  forceTitle?: string;
793
796
  [key: string]: unknown;
794
797
  };
795
- type TApiaCellDefinition = TApiaComplexCell | string;
796
- type TApiaRowDefinition = {
798
+ type T__LEGACY_SERVER__ApiaCellDefinition = T__LEGACY_SERVER__ApiaComplexCell | string;
799
+ type T__LEGACY_SERVER__ApiaRowDefinition = {
797
800
  'data-selected'?: boolean;
798
801
  selected?: boolean;
799
802
  dblclic: boolean;
@@ -806,11 +809,11 @@ type TApiaRowDefinition = {
806
809
  docLock?: boolean;
807
810
  uneditableTR?: boolean;
808
811
  isLocked?: boolean;
809
- cell: TApiaCellDefinition | TApiaCellDefinition[];
812
+ cell: T__LEGACY_SERVER__ApiaCellDefinition | T__LEGACY_SERVER__ApiaCellDefinition[];
810
813
  boldType?: boolean;
811
814
  'expired-doc': true;
812
815
  };
813
- type TApiaFunctionPageInfo = {
816
+ type T__LEGACY_SERVER__ApiaFunctionPageInfo = {
814
817
  amount: string;
815
818
  currentPage: string;
816
819
  hasMore: boolean;
@@ -822,30 +825,30 @@ type TApiaFunctionPageInfo = {
822
825
  orderType: 'desc' | '';
823
826
  orderCol: number;
824
827
  };
825
- type TApiaSystemMessageObj<Structure = Record<string, unknown>> = Structure & {
828
+ type T__LEGACY_SERVER__ApiaSystemMessageObj<Structure = Record<string, unknown>> = Structure & {
826
829
  onClose?: string;
827
830
  sysMessages?: {
828
- message: TApiaMessage | TApiaMessage[];
831
+ message: T__LEGACY_SERVER__ApiaMessage | T__LEGACY_SERVER__ApiaMessage[];
829
832
  };
830
833
  sysExceptions?: {
831
- exception: TApiaMessage | TApiaMessage[];
834
+ exception: T__LEGACY_SERVER__ApiaMessage | T__LEGACY_SERVER__ApiaMessage[];
832
835
  };
833
836
  exceptions?: {
834
- exception: TApiaMessage | TApiaMessage[];
837
+ exception: T__LEGACY_SERVER__ApiaMessage | T__LEGACY_SERVER__ApiaMessage[];
835
838
  };
836
- actions?: TApiaActions;
839
+ actions?: T__LEGACY_SERVER__ApiaActions;
837
840
  code?: unknown;
838
841
  load?: Structure;
839
842
  };
840
- type TApiaTableFunction = {
843
+ type T__LEGACY_SERVER__ApiaTableFunction = {
841
844
  result: {
842
- pageInfo: TApiaFunctionPageInfo;
845
+ pageInfo: T__LEGACY_SERVER__ApiaFunctionPageInfo;
843
846
  table?: {
844
- row: TApiaRowDefinition | TApiaRowDefinition[];
847
+ row: T__LEGACY_SERVER__ApiaRowDefinition | T__LEGACY_SERVER__ApiaRowDefinition[];
845
848
  };
846
849
  };
847
850
  };
848
- type TApiaFunction<T = TApiaTableFunction, HasMessages = true> = HasMessages extends true ? {
851
+ type T__LEGACY_SERVER__ApiaFunction<T = T__LEGACY_SERVER__ApiaTableFunction, HasMessages = true> = HasMessages extends true ? {
849
852
  function: {
850
853
  dropLastMessage?: boolean;
851
854
  name: string;
@@ -856,7 +859,7 @@ type TApiaFunction<T = TApiaTableFunction, HasMessages = true> = HasMessages ext
856
859
  name: string;
857
860
  } & T;
858
861
  };
859
- type TApiaLoadText = {
862
+ type T__LEGACY_SERVER__ApiaLoadText = {
860
863
  text: {
861
864
  closeAll: boolean;
862
865
  title: string;
@@ -864,27 +867,151 @@ type TApiaLoadText = {
864
867
  content: string;
865
868
  };
866
869
  };
867
- type TApiaLoad<T extends Record<string, unknown> = TApiaLoadForm> = {
870
+ type T__LEGACY_SERVER__ApiaLoad<T extends Record<string, unknown> = TApiaLoadForm> = {
868
871
  canClose: boolean;
869
872
  type: string;
870
873
  } & T;
871
- interface TMessage {
874
+ interface T__LEGACY_SERVER__Message {
872
875
  text: string;
873
876
  content?: string;
874
877
  title?: string;
878
+ stack?: string;
875
879
  type?: string;
876
880
  }
877
- interface TNotificationMessage {
881
+ interface T__LEGACY_SERVER__MessagesPayload {
878
882
  onClose?: string;
879
883
  sysMessages?: {
880
- message: TMessage | TMessage[];
884
+ message: T__LEGACY_SERVER__Message | T__LEGACY_SERVER__Message[];
881
885
  };
882
886
  sysExceptions?: {
883
- exception: TMessage | TMessage[];
887
+ exception: T__LEGACY_SERVER__Message | T__LEGACY_SERVER__Message[];
884
888
  };
885
889
  exceptions?: {
886
- exception: TMessage | TMessage[];
890
+ exception: T__LEGACY_SERVER__Message | T__LEGACY_SERVER__Message[];
887
891
  };
892
+ actions?: T__LEGACY_SERVER__ApiaActions;
893
+ }
894
+
895
+ type NotificationIcon = string;
896
+ type NotificationType = 'info' | 'error' | 'success' | 'warning';
897
+ type NotificationDefinition = {
898
+ icon?: NotificationIcon;
899
+ id?: string | number;
900
+ isOpen?: boolean;
901
+ message: string;
902
+ stackTrace?: string;
903
+ title?: string;
904
+ type?: NotificationType;
905
+ };
906
+
907
+ type TAttribute = {
908
+ name: string;
909
+ value: string;
910
+ };
911
+ type TOption = {
912
+ label: string;
913
+ value: string;
914
+ };
915
+ type TWithAttributes = {
916
+ attributes: Record<string, string>;
917
+ };
918
+ type TWithOptions = {
919
+ options: TOption | TOption[];
920
+ };
921
+ type TBehavior = TWithAttributes & {
922
+ allowEdition: boolean;
923
+ allowSelection: boolean;
924
+ isMultipleSelection: boolean;
925
+ hasDynamicStructure: boolean;
926
+ showAdditionalInfo: boolean;
927
+ };
928
+ type TSortType = 'ASC' | 'DESC' | 'NONE';
929
+ type TColumn = TWithAttributes & TWithStylesModifiers & {
930
+ className: string;
931
+ hideFromAccordion: boolean;
932
+ isHidden: boolean;
933
+ isHtml: boolean;
934
+ isSortable: boolean;
935
+ name: string;
936
+ showAsAdditional: boolean;
937
+ showInAccordionTitle: boolean;
938
+ sortType: TSortType;
939
+ title: string;
940
+ tooltip: string;
941
+ width: string;
942
+ };
943
+ type TFilter = TWithAttributes & TWithOptions & {
944
+ asAdditional: boolean;
945
+ name: string;
946
+ columnName: string;
947
+ isRequired: boolean;
948
+ initialValue: string;
949
+ runAutomatically: boolean;
950
+ title: string;
951
+ tooltip: string;
952
+ type: 'DATE' | 'INPUT' | 'COMBO' | 'DATERANGE' | 'SIZE' | 'SIZERANGE' | 'DATEHOUR' | 'DATEHOURRANGE';
953
+ };
954
+ type TLoadStructure = {
955
+ behavior: TBehavior;
956
+ columns: TColumn | TColumn[];
957
+ filters: TFilter | TFilter[];
958
+ rows?: TRow | TRow[];
959
+ };
960
+ type TStateIcon = 'ALERT' | 'DISALLOWED' | 'LOCKED' | 'PRIORITY_LOW' | 'PRIORITY_NORMAL' | 'PRIORITY_HIGH' | 'PRIORITY_URGENT';
961
+ type TWithAlignment = {
962
+ horizontalAlign?: 'Left' | 'Center' | 'Right' | 'Justify';
963
+ verticalAlign?: 'Top' | 'Middle' | 'Bottom';
964
+ };
965
+ type TWithStylesModifiers = {
966
+ background: string;
967
+ color: string;
968
+ isBold: boolean;
969
+ isHtml: boolean;
970
+ isLight: boolean;
971
+ };
972
+ type TCell = TWithAttributes & TWithStylesModifiers & TWithAlignment & {
973
+ className: string;
974
+ colspan: number;
975
+ renderer?: string;
976
+ text: string;
977
+ title: string;
978
+ };
979
+ type TActionBehavior = 'DO_NOTHING' | 'NAVIGATE_URL' | 'CALL_AJAX_URL' | 'RUN_ACTION' | 'OPEN_TAB' | 'FIRE_EVENT' | 'DOWNLOAD';
980
+ type TActionSource = 'CLICK' | 'DOUBLE_CLICK';
981
+ type TBasicAction = {
982
+ action: string;
983
+ actionBehavior: TActionBehavior;
984
+ actionSource: TActionSource;
985
+ additionalData: string;
986
+ text: string;
987
+ };
988
+ type TRow = TWithAttributes & TWithStylesModifiers & {
989
+ action: TBasicAction;
990
+ } & TWithAlignment & {
991
+ cells: TCell | TCell[];
992
+ className: string;
993
+ id: string;
994
+ isDisabled: boolean;
995
+ isHidden: boolean;
996
+ isSelected: boolean;
997
+ isSeparator: boolean;
998
+ states: TState | TState[];
999
+ title: string;
1000
+ };
1001
+ type TState = {
1002
+ color: string;
1003
+ tooltip: string;
1004
+ className: string;
1005
+ Icon: TStateIcon;
1006
+ };
1007
+ type TRefresh = {
1008
+ rows: TRow | TRow[];
1009
+ };
1010
+ interface IStatesSource {
1011
+ background: string;
1012
+ color: string;
1013
+ isBold: boolean;
1014
+ isLight: boolean;
888
1015
  }
889
1016
 
890
1017
  type TId = string | number;
@@ -1273,6 +1400,14 @@ declare function useImperativeComponentContext<Events extends TMap = TMap>(): {
1273
1400
  eventsStore: TEventsHandlers<Events>;
1274
1401
  };
1275
1402
 
1403
+ interface ILabelsContainer {
1404
+ labels: {
1405
+ [key: string]: {
1406
+ text: string;
1407
+ title: string;
1408
+ };
1409
+ };
1410
+ }
1276
1411
  /**
1277
1412
  * Dado un nombre de etiqueta, devuelve el texto que esa etiqueta contiene en
1278
1413
  * el idioma actual. En este momento, lo único que hace realmente esta función
@@ -1944,6 +2079,7 @@ declare class Semaphore {
1944
2079
  * @returns A promise that resolves when the permit has been acquired.
1945
2080
  */
1946
2081
  acquire(): Promise<void>;
2082
+ clear(): void;
1947
2083
  /**
1948
2084
  * Releases a previously acquired permit.
1949
2085
  *
@@ -1954,15 +2090,42 @@ declare class Semaphore {
1954
2090
 
1955
2091
  declare class Mutex extends Semaphore {
1956
2092
  constructor();
1957
- runExclusive(cb: () => unknown): Promise<void>;
2093
+ runExclusive<T>(cb: () => Promise<T>): Promise<T | undefined>;
1958
2094
  }
1959
2095
 
1960
2096
  type Task<T> = () => Promise<T>;
1961
2097
  declare class TasksQueue {
1962
2098
  private mutex;
1963
2099
  get isBusy(): boolean;
1964
- run<T>(task: Task<T>): Promise<T>;
2100
+ clear(): void;
2101
+ run<T>(task: Task<T>): Promise<T | undefined>;
2102
+ }
2103
+
2104
+ declare class Router {
2105
+ route: string;
2106
+ constructor();
2107
+ set(path: string): void;
2108
+ Context: ({ children }: {
2109
+ children: ReactNode;
2110
+ }) => react_jsx_runtime.JSX.Element;
2111
+ Route: (({ children, path }: {
2112
+ children: ReactNode;
2113
+ path: string;
2114
+ }) => react_jsx_runtime.JSX.Element | null) & {
2115
+ displayName: string;
2116
+ };
1965
2117
  }
1966
2118
 
1967
- 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 Task, TasksQueue, type ThrottleOptions, type UnSubscriber, Url, addBoundary, alignment, animate, apiaDateToStandarFormat, arrayOrArray, autoDisconnectMutationObserver, awaitTime, cantFocusSelector, cloneDeep, customEvents, dateToApiaFormat, debugDispatcher, decodeBase64ToUtf8, decodeHTMLEntities, decrypt, deepEqual, defaultGetNameFromResponse, disableChildrenFocus, downloadStringAsDoc, downloadUrl, enableChildrenFocus, encodeStrToBase64Utf8, encrypt, findOffsetRelativeToScrollParent, findScrollContainer, focus, focusSelector, formatMessage, freezeDeep, getDateFormat, getFocusSelector, getIndex, getJSObjFromXML, getLabel, getSpecificParent, getValueByPath, globalFocus, globals, isChild, isDebugDispatcherEnabled, isFocusable, isPropsConfigurationObject, isSetter, isTrue, makeImperativeComponent, makeSingleImperativeComponent, makeStatefulStore, noNaN, notificationsSelector, openAndReadFile, openAndReadFiles, parseAsSize, parseXMLRequestResponse, parseXmlAsync, persistentStorage, postNavigation, propsStore, screenLocker, scrollParentIntoElement, setValueByPath, shallowCompareArrays, shallowEqual, shortcutController, toBoolean, ucfirst, uniqueId, useCombinedRefs, useDebouncedCallback, useDebouncedState, useDomState, useImperativeComponentContext, useImperativeComponentEvents, useIntermediateValue, useLatest, useLocalStorage, useMatchScrollDirection, useMount, useMountTransition, usePanAndZoom, usePrevious, usePropsSelector, useShallowMemo, useStateRef, useSubscription, useUnmount, useUpdateEffect, useWhyUpdated };
2119
+ declare const RouterContext: React.Context<Router | null>;
2120
+ declare const RouteContext: React.Context<{
2121
+ path: string;
2122
+ params: Record<string, string>;
2123
+ } | null>;
2124
+ declare function useRouter(): Router;
2125
+ declare function useRoute(): {
2126
+ path: string;
2127
+ params: Record<string, string>;
2128
+ };
2129
+
2130
+ export { AudioRecorder, type AudioRecorderState, BasicStoredElement, BouncingEmitter, type Callback, ClassNameBuilder, type DebounceOptions, type DeepReadonly, type DownloadStringAsDocProps, EventEmitter, History, type ILabelsContainer, type IOnFocusConfiguration, type IParameter, type ISetBoundary, type IStatesSource, Locker, type Map, Mutex, type NotificationDefinition, type NotificationIcon, type NotificationType, PropsSelectorUndefinedObject, PropsStore, RouteContext, Router, RouterContext, ScrollLocker, Semaphore, StatefulEmitter, type StatefulStoreUpdateProps, type StatefulStoreUpdater, type TActionBehavior, type TActionSource, type TApiaFieldPropsObj, type TApiaFilter, type TApiaFilterOption, type TApiaFilterValue, type TApiaFormButton, type TApiaFormElement, type TApiaFormElementOption, type TApiaLoadForm, type TApiaMultiplePossibleValue, type TApiaPossibleValue, type TApiaRadioPossibleValue, type TApiaSelectPossibleValue, type TAttribute, type TBasicAction, type TBehavior, type TCallback, type TCell, type TColumn, type TDateFormat, type TDispatchCallback, type TDownloadUrlOptions, type TFieldEvent, type TFieldScriptEvent, type TFieldScriptEvents, type TFieldServerEvent, type TFieldServerEvents, type TFilter, type TFncParams, type TFocusRetriever, type THistoryCount, type THistoryStep, type THistoryStepChange, type TId, type TKey, type TLoadStructure, type TMap$1 as TMap, type TModify, type TOption, type TPropsComparator, type TPropsConfiguration, type TPropsSelector, type TRefresh, type TRequireOnlyOne, type TRow, type TShortcutBranch, type TSortType, type TState, type TStateIcon, type TUpdateFieldConfiguration, type TWithAlignment, type TWithAttributes, type TWithOptions, type TWithStylesModifiers, type T__LEGACY_SERVER__ApiaAction, type T__LEGACY_SERVER__ApiaActions, type T__LEGACY_SERVER__ApiaCellDefinition, type T__LEGACY_SERVER__ApiaComplexCell, type T__LEGACY_SERVER__ApiaFunction, type T__LEGACY_SERVER__ApiaFunctionPageInfo, type T__LEGACY_SERVER__ApiaLoad, type T__LEGACY_SERVER__ApiaLoadText, type T__LEGACY_SERVER__ApiaMessage, type T__LEGACY_SERVER__ApiaRowDefinition, type T__LEGACY_SERVER__ApiaSystemMessageObj, type T__LEGACY_SERVER__ApiaTableFunction, type T__LEGACY_SERVER__Message, type T__LEGACY_SERVER__MessagesPayload, type Task, TasksQueue, type ThrottleOptions, type UnSubscriber, Url, addBoundary, alignment, animate, apiaDateToStandarFormat, arrayOrArray, autoDisconnectMutationObserver, awaitTime, cantFocusSelector, cloneDeep, customEvents, dateFromApiaFormat, dateToApiaFormat, debugDispatcher, decodeBase64ToUtf8, decodeHTMLEntities, decrypt, deepEqual, defaultGetNameFromResponse, disableChildrenFocus, downloadStringAsDoc, downloadUrl, enableChildrenFocus, encodeStrToBase64Utf8, encrypt, findOffsetRelativeToScrollParent, findScrollContainer, focus, focusSelector, formatMessage, freezeDeep, getDateFormat, getFocusSelector, getIndex, getJSObjFromXML, getLabel, getSpecificParent, getValueByPath, globalFocus, globals, isChild, isDebugDispatcherEnabled, isFocusable, isPropsConfigurationObject, isSetter, isTrue, makeImperativeComponent, makeSingleImperativeComponent, makeStatefulStore, noNaN, notificationsSelector, openAndReadFile, openAndReadFiles, parseAsSize, parseXMLRequestResponse, parseXmlAsync, persistentStorage, postNavigation, propsStore, screenLocker, scrollParentIntoElement, setValueByPath, shallowCompareArrays, shallowEqual, shortcutController, toBoolean, ucfirst, uniqueId, useCombinedRefs, useDebouncedCallback, useDebouncedState, useDomState, useImperativeComponentContext, useImperativeComponentEvents, useIntermediateValue, useLatest, useLocalStorage, useMatchScrollDirection, useMount, useMountTransition, usePanAndZoom, usePrevious, usePropsSelector, useRoute, useRouter, useShallowMemo, useStateRef, useSubscription, useUnmount, useUpdateEffect, useWhyUpdated };
1968
2131
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -12,6 +12,7 @@ import clone from 'lodash-es/clone';
12
12
  import cloneDeep$1 from 'lodash-es/cloneDeep';
13
13
  import xml2js from 'xml2js';
14
14
  import { parseBooleans, parseNumbers } from 'xml2js/lib/processors';
15
+ import { observer } from 'mobx-react-lite';
15
16
 
16
17
  function getWindow() {
17
18
  return globalThis;
@@ -232,7 +233,18 @@ function apiaDateToStandarFormat(date) {
232
233
  }
233
234
 
234
235
  function dateToApiaFormat(date) {
235
- return dayjs(date).format(getDateFormat());
236
+ const parsed = dayjs(date);
237
+ if (!parsed.isValid()) {
238
+ return void 0;
239
+ }
240
+ return parsed.format(getDateFormat());
241
+ }
242
+
243
+ function dateFromApiaFormat(str) {
244
+ const newDate = dayjs(str, getDateFormat());
245
+ if (!newDate.isValid())
246
+ return null;
247
+ return newDate.toDate();
236
248
  }
237
249
 
238
250
  const globals = {
@@ -865,7 +877,7 @@ const focusSelector = [
865
877
  "[tabIndex]",
866
878
  '[role="button"]'
867
879
  ].map((current) => `${current}${cantFocusSelector}`).join(",");
868
- function getFocusSelector(not) {
880
+ function getFocusSelector(not = ":not(:disabled)") {
869
881
  return `input${not ?? ""},
870
882
  textarea${not ?? ""},
871
883
  select${not ?? ""},
@@ -1821,6 +1833,7 @@ class CancellablePromise extends Promise {
1821
1833
  this.cancel = cancel;
1822
1834
  }
1823
1835
  }
1836
+ const cancellingToken = Symbol();
1824
1837
  class Semaphore {
1825
1838
  /**
1826
1839
  * Creates a new instance of the Semaphore.
@@ -1853,16 +1866,23 @@ class Semaphore {
1853
1866
  return Promise.resolve();
1854
1867
  }
1855
1868
  let resolver = null;
1869
+ let rejecter = null;
1856
1870
  return new CancellablePromise(
1857
- (resolve) => {
1871
+ (resolve, reject) => {
1858
1872
  resolver = resolve;
1859
- this.queue.push(resolve);
1873
+ rejecter = reject;
1874
+ this.queue.push({ resolve, reject });
1860
1875
  },
1861
1876
  () => {
1862
- this.queue = this.queue.filter((c) => c !== resolver);
1877
+ this.queue = this.queue.filter((c) => c.resolve !== resolver);
1878
+ rejecter(cancellingToken);
1863
1879
  }
1864
1880
  );
1865
1881
  }
1882
+ clear() {
1883
+ this.queue.forEach((c) => c.reject());
1884
+ this.queue.splice(0);
1885
+ }
1866
1886
  /**
1867
1887
  * Releases a previously acquired permit.
1868
1888
  *
@@ -1870,7 +1890,7 @@ class Semaphore {
1870
1890
  */
1871
1891
  release() {
1872
1892
  this.current = Math.max(0, this.current - 1);
1873
- this.queue.shift()?.();
1893
+ this.queue.shift()?.resolve();
1874
1894
  }
1875
1895
  }
1876
1896
 
@@ -1879,9 +1899,16 @@ class Mutex extends Semaphore {
1879
1899
  super(1);
1880
1900
  }
1881
1901
  async runExclusive(cb) {
1882
- await this.acquire();
1883
- await cb();
1884
- this.release();
1902
+ try {
1903
+ await this.acquire();
1904
+ const result = await cb();
1905
+ this.release();
1906
+ return result;
1907
+ } catch (t) {
1908
+ if (t !== cancellingToken) {
1909
+ throw t;
1910
+ }
1911
+ }
1885
1912
  }
1886
1913
  }
1887
1914
 
@@ -1892,13 +1919,13 @@ class TasksQueue {
1892
1919
  get isBusy() {
1893
1920
  return this.mutex.isBusy;
1894
1921
  }
1922
+ clear() {
1923
+ this.mutex.clear();
1924
+ }
1895
1925
  async run(task) {
1896
- await this.mutex.acquire();
1897
- try {
1926
+ return await this.mutex.runExclusive(async () => {
1898
1927
  return await task();
1899
- } finally {
1900
- this.mutex.release();
1901
- }
1928
+ });
1902
1929
  }
1903
1930
  }
1904
1931
 
@@ -2490,8 +2517,8 @@ function getLabel(name, replaceTokens, outerWindow) {
2490
2517
  const actualWindow = outerWindow ?? window;
2491
2518
  const label = {
2492
2519
  ...actualWindow.labels[name] ?? {
2493
- text: `Not preloaded: ${name}`,
2494
- title: `Not preloaded: ${name}`
2520
+ text: `${name}`,
2521
+ title: `${name}`
2495
2522
  }
2496
2523
  };
2497
2524
  if (replaceTokens?.text !== void 0)
@@ -2529,16 +2556,26 @@ function setValueByPath(obj, path, value) {
2529
2556
  const originalClonedObject = clone(obj ?? {});
2530
2557
  let currentObj = originalClonedObject;
2531
2558
  for (let i = 0; i < steps.length - 1; i++) {
2532
- if (!currentObj[steps[i]])
2533
- currentObj[steps[i]] = {};
2534
- if (typeof currentObj[steps[i]] === "object") {
2535
- currentObj = currentObj[steps[i]];
2559
+ let key = steps[i];
2560
+ const match = key.match(/([^[]+)\[(\d+)\]/);
2561
+ if (match) {
2562
+ const varName = match[1];
2563
+ const index = Number.parseInt(match[2]);
2564
+ if (!currentObj[varName])
2565
+ currentObj[varName] = [];
2566
+ currentObj = currentObj[varName];
2567
+ key = index;
2568
+ }
2569
+ if (!currentObj[key])
2570
+ currentObj[key] = {};
2571
+ if (typeof currentObj[key] === "object") {
2572
+ currentObj = currentObj[key];
2536
2573
  } else {
2537
2574
  console.info({
2538
2575
  originalObject: obj,
2539
2576
  originalPath: path,
2540
2577
  currentObj,
2541
- currentStep: steps[i]
2578
+ currentStep: key
2542
2579
  });
2543
2580
  throw new Error(
2544
2581
  `The provided path ${path} cannot be applied due to it is not an object's path.`
@@ -3066,5 +3103,61 @@ const postNavigation = (url, data) => {
3066
3103
  form.submit();
3067
3104
  };
3068
3105
 
3069
- export { AudioRecorder, BasicStoredElement, BouncingEmitter, ClassNameBuilder, EventEmitter, History, Locker, Mutex, PropsSelectorUndefinedObject, PropsStore, ScrollLocker, Semaphore, StatefulEmitter, TasksQueue, Url, addBoundary, alignment, animate, apiaDateToStandarFormat, arrayOrArray, autoDisconnectMutationObserver, awaitTime, cantFocusSelector, cloneDeep, customEvents, dateToApiaFormat, debugDispatcher, decodeBase64ToUtf8, decodeHTMLEntities, decrypt, deepEqual, defaultGetNameFromResponse, disableChildrenFocus, downloadStringAsDoc, downloadUrl, enableChildrenFocus, encodeStrToBase64Utf8, encrypt, findOffsetRelativeToScrollParent, findScrollContainer, focus, focusSelector, formatMessage, freezeDeep, getDateFormat, getFocusSelector, getIndex, getJSObjFromXML, getLabel, getSpecificParent, getValueByPath, globalFocus, globals, isChild, isDebugDispatcherEnabled, isFocusable, isPropsConfigurationObject, isSetter, isTrue, makeImperativeComponent, makeSingleImperativeComponent, makeStatefulStore, noNaN, notificationsSelector, openAndReadFile, openAndReadFiles, parseAsSize, parseXMLRequestResponse, parseXmlAsync, persistentStorage, postNavigation, propsStore, screenLocker, scrollParentIntoElement, setValueByPath, shallowCompareArrays, shallowEqual, shortcutController, toBoolean, ucfirst, uniqueId, useCombinedRefs, useDebouncedCallback, useDebouncedState, useDomState, useImperativeComponentContext, useImperativeComponentEvents, useIntermediateValue, useLatest, useLocalStorage, useMatchScrollDirection, useMount, useMountTransition, usePanAndZoom, usePrevious, usePropsSelector, useShallowMemo, useStateRef, useSubscription, useUnmount, useUpdateEffect, useWhyUpdated };
3106
+ const RouterContext = createContext(null);
3107
+ const RouteContext = createContext(null);
3108
+ function useRouter() {
3109
+ return useContext(RouterContext);
3110
+ }
3111
+ function useRoute() {
3112
+ return useContext(RouteContext);
3113
+ }
3114
+
3115
+ function parseRoute(route, path) {
3116
+ const keys = [];
3117
+ const escaped = route.replace(/([.+*?=^!:${}()[\]|/\\])/g, "\\$1");
3118
+ const pattern = escaped.replace(/\\:([a-zA-Z0-9_]+)/g, (_, key) => {
3119
+ keys.push(key);
3120
+ return "([^/]+)";
3121
+ });
3122
+ const regex = new RegExp(`^${pattern}\\/?$`);
3123
+ const match = path.match(regex);
3124
+ if (!match)
3125
+ return null;
3126
+ const result = {};
3127
+ keys.forEach((key, i) => {
3128
+ result[key] = decodeURIComponent(match[i + 1]);
3129
+ });
3130
+ return result;
3131
+ }
3132
+
3133
+ class Router {
3134
+ constructor() {
3135
+ this.route = "";
3136
+ this.Context = ({ children }) => /* @__PURE__ */ jsx(RouterContext.Provider, { value: this, children });
3137
+ this.Route = observer(
3138
+ ({ children, path }) => {
3139
+ const res = parseRoute(path, this.route);
3140
+ if (!res) {
3141
+ return null;
3142
+ }
3143
+ return /* @__PURE__ */ jsx(
3144
+ RouteContext.Provider,
3145
+ {
3146
+ value: {
3147
+ params: res,
3148
+ path
3149
+ },
3150
+ children
3151
+ }
3152
+ );
3153
+ }
3154
+ );
3155
+ makeAutoObservable(this);
3156
+ }
3157
+ set(path) {
3158
+ this.route = path;
3159
+ }
3160
+ }
3161
+
3162
+ export { AudioRecorder, BasicStoredElement, BouncingEmitter, ClassNameBuilder, EventEmitter, History, Locker, Mutex, PropsSelectorUndefinedObject, PropsStore, RouteContext, Router, RouterContext, ScrollLocker, Semaphore, StatefulEmitter, TasksQueue, Url, addBoundary, alignment, animate, apiaDateToStandarFormat, arrayOrArray, autoDisconnectMutationObserver, awaitTime, cantFocusSelector, cloneDeep, customEvents, dateFromApiaFormat, dateToApiaFormat, debugDispatcher, decodeBase64ToUtf8, decodeHTMLEntities, decrypt, deepEqual, defaultGetNameFromResponse, disableChildrenFocus, downloadStringAsDoc, downloadUrl, enableChildrenFocus, encodeStrToBase64Utf8, encrypt, findOffsetRelativeToScrollParent, findScrollContainer, focus, focusSelector, formatMessage, freezeDeep, getDateFormat, getFocusSelector, getIndex, getJSObjFromXML, getLabel, getSpecificParent, getValueByPath, globalFocus, globals, isChild, isDebugDispatcherEnabled, isFocusable, isPropsConfigurationObject, isSetter, isTrue, makeImperativeComponent, makeSingleImperativeComponent, makeStatefulStore, noNaN, notificationsSelector, openAndReadFile, openAndReadFiles, parseAsSize, parseXMLRequestResponse, parseXmlAsync, persistentStorage, postNavigation, propsStore, screenLocker, scrollParentIntoElement, setValueByPath, shallowCompareArrays, shallowEqual, shortcutController, toBoolean, ucfirst, uniqueId, useCombinedRefs, useDebouncedCallback, useDebouncedState, useDomState, useImperativeComponentContext, useImperativeComponentEvents, useIntermediateValue, useLatest, useLocalStorage, useMatchScrollDirection, useMount, useMountTransition, usePanAndZoom, usePrevious, usePropsSelector, useRoute, useRouter, useShallowMemo, useStateRef, useSubscription, useUnmount, useUpdateEffect, useWhyUpdated };
3070
3163
  //# sourceMappingURL=index.js.map