@apia/util 4.0.60 → 4.0.63
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 +10 -1
- package/dist/index.js +49 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -177,6 +177,7 @@ declare function downloadUrl(url: string, getNameFromResponse?: (blob: AxiosResp
|
|
|
177
177
|
* @param fileName The name the file will have as default in the save dialog
|
|
178
178
|
*/
|
|
179
179
|
declare function downloadUrl(url: string, fileName: string | TDownloadUrlOptions): Promise<void>;
|
|
180
|
+
declare function downloadUrlWithoutCaching(downloadUrl: string, fileName?: string): Promise<void>;
|
|
180
181
|
|
|
181
182
|
declare function openAndReadFile(accept?: string): Promise<string | ArrayBuffer | null>;
|
|
182
183
|
type TReadFile = {
|
|
@@ -2047,12 +2048,20 @@ declare function encodeStrToBase64Utf8(str: string): string;
|
|
|
2047
2048
|
*/
|
|
2048
2049
|
declare function toBoolean(value: unknown): boolean;
|
|
2049
2050
|
|
|
2051
|
+
declare function makeDebouncedCallback<T extends any[]>(cb: (...args: T) => unknown, ms?: number): (...args: T) => void;
|
|
2052
|
+
|
|
2050
2053
|
declare const getJSObjFromXML: (xml: XMLDocument | string) => Record<string, unknown>;
|
|
2051
2054
|
declare const parseXmlAsync: <T>(xml: string) => Promise<T>;
|
|
2052
2055
|
declare const parseXMLRequestResponse: (response: AxiosResponse<unknown, unknown>) => Record<string, unknown>;
|
|
2053
2056
|
|
|
2054
2057
|
declare const postNavigation: (url: string, data: Record<string, any>) => void;
|
|
2055
2058
|
|
|
2059
|
+
type TAwaitConditionOptions = Partial<{
|
|
2060
|
+
delay: number;
|
|
2061
|
+
maxRetries: number;
|
|
2062
|
+
}>;
|
|
2063
|
+
declare function awaitCondition(condition: () => Promise<boolean> | boolean, props?: TAwaitConditionOptions): Promise<void>;
|
|
2064
|
+
|
|
2056
2065
|
declare function awaitTime(ms: number): Promise<void>;
|
|
2057
2066
|
|
|
2058
2067
|
/**
|
|
@@ -2101,5 +2110,5 @@ declare class TasksQueue {
|
|
|
2101
2110
|
run<T>(task: Task<T>): Promise<T | undefined>;
|
|
2102
2111
|
}
|
|
2103
2112
|
|
|
2104
|
-
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, ScrollLocker, Semaphore, StatefulEmitter, type StatefulStoreUpdateProps, type StatefulStoreUpdater, type TActionBehavior, type TActionSource, 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 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 TLabel, type TLoadStructure, type TMap$1 as TMap, type TMessage, type TModify, type TNotificationMessage, type TOption, type TPropsComparator, type TPropsConfiguration, type TPropsSelector, type TRefresh, type TRequireOnlyOne, type TRow, type TShortcutBranch, type TState, type TStateIcon, type TUpdateFieldConfiguration, type TWithAlignment, type TWithAttributes, type TWithOptions, type TWithStylesModifiers, 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, getLabelName, getLabelTooltip, 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 };
|
|
2113
|
+
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, ScrollLocker, Semaphore, StatefulEmitter, type StatefulStoreUpdateProps, type StatefulStoreUpdater, type TActionBehavior, type TActionSource, 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 TAttribute, type TAwaitConditionOptions, 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 TLabel, type TLoadStructure, type TMap$1 as TMap, type TMessage, type TModify, type TNotificationMessage, type TOption, type TPropsComparator, type TPropsConfiguration, type TPropsSelector, type TRefresh, type TRequireOnlyOne, type TRow, type TShortcutBranch, type TState, type TStateIcon, type TUpdateFieldConfiguration, type TWithAlignment, type TWithAttributes, type TWithOptions, type TWithStylesModifiers, type Task, TasksQueue, type ThrottleOptions, type UnSubscriber, Url, addBoundary, alignment, animate, apiaDateToStandarFormat, arrayOrArray, autoDisconnectMutationObserver, awaitCondition, awaitTime, cantFocusSelector, cloneDeep, customEvents, dateToApiaFormat, debugDispatcher, decodeBase64ToUtf8, decodeHTMLEntities, decrypt, deepEqual, defaultGetNameFromResponse, disableChildrenFocus, downloadStringAsDoc, downloadUrl, downloadUrlWithoutCaching, enableChildrenFocus, encodeStrToBase64Utf8, encrypt, findOffsetRelativeToScrollParent, findScrollContainer, focus, focusSelector, formatMessage, freezeDeep, getDateFormat, getFocusSelector, getIndex, getJSObjFromXML, getLabel, getLabelName, getLabelTooltip, getSpecificParent, getValueByPath, globalFocus, globals, isChild, isDebugDispatcherEnabled, isFocusable, isPropsConfigurationObject, isSetter, isTrue, makeDebouncedCallback, 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 };
|
|
2105
2114
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -498,6 +498,14 @@ async function downloadUrl(url, secondParameter = defaultGetNameFromResponse) {
|
|
|
498
498
|
FileSaver.saveAs(new Blob([blob.data]), actualFileName);
|
|
499
499
|
}
|
|
500
500
|
}
|
|
501
|
+
async function downloadUrlWithoutCaching(downloadUrl2, fileName) {
|
|
502
|
+
const link = document.createElement("a");
|
|
503
|
+
link.href = downloadUrl2;
|
|
504
|
+
link.setAttribute("download", fileName ?? "");
|
|
505
|
+
document.body.appendChild(link);
|
|
506
|
+
link.click();
|
|
507
|
+
document.body.removeChild(link);
|
|
508
|
+
}
|
|
501
509
|
|
|
502
510
|
function openAndReadFile(accept) {
|
|
503
511
|
return new Promise((resolve) => {
|
|
@@ -1809,6 +1817,36 @@ function useLocalStorage(prop, defaultValue) {
|
|
|
1809
1817
|
];
|
|
1810
1818
|
}
|
|
1811
1819
|
|
|
1820
|
+
function awaitCondition(condition, props) {
|
|
1821
|
+
const { delay, maxRetries } = Object.assign(
|
|
1822
|
+
{ delay: 50, maxRetries: 6 },
|
|
1823
|
+
props
|
|
1824
|
+
);
|
|
1825
|
+
let tries = 1;
|
|
1826
|
+
return new Promise((resolve, reject) => {
|
|
1827
|
+
(async () => {
|
|
1828
|
+
if (await condition()) {
|
|
1829
|
+
resolve();
|
|
1830
|
+
}
|
|
1831
|
+
const i = setInterval(async () => {
|
|
1832
|
+
try {
|
|
1833
|
+
if (await condition()) {
|
|
1834
|
+
resolve();
|
|
1835
|
+
}
|
|
1836
|
+
if (++tries >= maxRetries) {
|
|
1837
|
+
throw new Error(
|
|
1838
|
+
"Maximum number of attempts reached while waiting for the condition"
|
|
1839
|
+
);
|
|
1840
|
+
}
|
|
1841
|
+
} catch (_) {
|
|
1842
|
+
reject(_);
|
|
1843
|
+
clearInterval(i);
|
|
1844
|
+
}
|
|
1845
|
+
}, delay);
|
|
1846
|
+
})();
|
|
1847
|
+
});
|
|
1848
|
+
}
|
|
1849
|
+
|
|
1812
1850
|
function awaitTime(ms) {
|
|
1813
1851
|
return new Promise((resolve) => {
|
|
1814
1852
|
setTimeout(resolve, ms);
|
|
@@ -2979,6 +3017,16 @@ function toBoolean(value) {
|
|
|
2979
3017
|
return !!value;
|
|
2980
3018
|
}
|
|
2981
3019
|
|
|
3020
|
+
function makeDebouncedCallback(cb, ms = 50) {
|
|
3021
|
+
let timeout = -1;
|
|
3022
|
+
return (...args) => {
|
|
3023
|
+
clearTimeout(timeout);
|
|
3024
|
+
timeout = setTimeout(() => {
|
|
3025
|
+
cb(...args);
|
|
3026
|
+
}, ms);
|
|
3027
|
+
};
|
|
3028
|
+
}
|
|
3029
|
+
|
|
2982
3030
|
const processAjaxEventTagNames = (name) => {
|
|
2983
3031
|
return name;
|
|
2984
3032
|
};
|
|
@@ -3090,5 +3138,5 @@ const postNavigation = (url, data) => {
|
|
|
3090
3138
|
form.submit();
|
|
3091
3139
|
};
|
|
3092
3140
|
|
|
3093
|
-
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, getLabelName, getLabelTooltip, 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 };
|
|
3141
|
+
export { AudioRecorder, BasicStoredElement, BouncingEmitter, ClassNameBuilder, EventEmitter, History, Locker, Mutex, PropsSelectorUndefinedObject, PropsStore, ScrollLocker, Semaphore, StatefulEmitter, TasksQueue, Url, addBoundary, alignment, animate, apiaDateToStandarFormat, arrayOrArray, autoDisconnectMutationObserver, awaitCondition, awaitTime, cantFocusSelector, cloneDeep, customEvents, dateToApiaFormat, debugDispatcher, decodeBase64ToUtf8, decodeHTMLEntities, decrypt, deepEqual, defaultGetNameFromResponse, disableChildrenFocus, downloadStringAsDoc, downloadUrl, downloadUrlWithoutCaching, enableChildrenFocus, encodeStrToBase64Utf8, encrypt, findOffsetRelativeToScrollParent, findScrollContainer, focus, focusSelector, formatMessage, freezeDeep, getDateFormat, getFocusSelector, getIndex, getJSObjFromXML, getLabel, getLabelName, getLabelTooltip, getSpecificParent, getValueByPath, globalFocus, globals, isChild, isDebugDispatcherEnabled, isFocusable, isPropsConfigurationObject, isSetter, isTrue, makeDebouncedCallback, 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 };
|
|
3094
3142
|
//# sourceMappingURL=index.js.map
|