@apia/util 4.0.19 → 4.0.20
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 +33 -23
- package/dist/index.js +122 -56
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -33,6 +33,8 @@ declare const decrypt: (salt: string, iv: string, passPhrase: string, cipherText
|
|
|
33
33
|
|
|
34
34
|
declare const encrypt: (salt: string, iv: string, passPhrase: string, plainText: string, keySize: number, iterationCount: number) => Promise<string>;
|
|
35
35
|
|
|
36
|
+
declare function uniqueId(prefix?: string): string;
|
|
37
|
+
|
|
36
38
|
declare function apiaDateToStandarFormat(date: string): string;
|
|
37
39
|
|
|
38
40
|
declare function dateToApiaFormat(date: string | Date): string;
|
|
@@ -44,7 +46,7 @@ declare global {
|
|
|
44
46
|
DATE_FORMAT: string;
|
|
45
47
|
}
|
|
46
48
|
}
|
|
47
|
-
declare const getDateFormat: () => TDateFormat;
|
|
49
|
+
declare const getDateFormat: (format?: string) => TDateFormat;
|
|
48
50
|
|
|
49
51
|
declare global {
|
|
50
52
|
const VERSION: string;
|
|
@@ -59,12 +61,12 @@ declare global {
|
|
|
59
61
|
}
|
|
60
62
|
declare const globals: {
|
|
61
63
|
getVersion(): {
|
|
62
|
-
version: string;
|
|
63
|
-
commit: string;
|
|
64
|
-
branch: string;
|
|
65
|
-
env: string;
|
|
66
|
-
timestamp: string;
|
|
67
|
-
package: string;
|
|
64
|
+
version: string | undefined;
|
|
65
|
+
commit: string | undefined;
|
|
66
|
+
branch: string | undefined;
|
|
67
|
+
env: string | undefined;
|
|
68
|
+
timestamp: string | undefined;
|
|
69
|
+
package: string | undefined;
|
|
68
70
|
};
|
|
69
71
|
};
|
|
70
72
|
/**
|
|
@@ -144,7 +146,7 @@ declare const shortcutController: {
|
|
|
144
146
|
console.log('Abctrl+cd'),
|
|
145
147
|
}, 'dev'); // Este shortcut solo se ejecuta en desarrollo
|
|
146
148
|
*/
|
|
147
|
-
on(keys: (string | TKey)[], callback: TCallback, category?:
|
|
149
|
+
on(keys: (string | TKey)[], callback: TCallback, category?: "dev", fireEvenFromInputs?: boolean): void;
|
|
148
150
|
};
|
|
149
151
|
|
|
150
152
|
type DownloadStringAsDocProps = {
|
|
@@ -986,7 +988,7 @@ declare const focus: {
|
|
|
986
988
|
focusOnReload: string | null;
|
|
987
989
|
restore(): void;
|
|
988
990
|
init(): void;
|
|
989
|
-
};
|
|
991
|
+
} | null;
|
|
990
992
|
|
|
991
993
|
/**
|
|
992
994
|
* The GlobalFocus helper keeps a list of the last focused elements and allows
|
|
@@ -1177,6 +1179,8 @@ declare function useShallowMemo<T>(creator: () => T, deps: unknown[]): T;
|
|
|
1177
1179
|
|
|
1178
1180
|
declare function useWhyUpdated(label: any, e: Record<string, any>): void;
|
|
1179
1181
|
|
|
1182
|
+
declare const useMountTransition: (isMounted: boolean, unmountDelay: number) => boolean;
|
|
1183
|
+
|
|
1180
1184
|
type TMethod<CR> = CR extends (state: any, ...args: infer Action) => any ? (id: TId, ...args: Action) => unknown : () => unknown;
|
|
1181
1185
|
type TMethods<State extends TMap, K extends any[] = any[]> = Record<string, (setState: TStateManager<State>, ...args: K) => void>;
|
|
1182
1186
|
type TMethodsMap<OriginalMethods extends TMethods<any>> = {
|
|
@@ -1234,24 +1238,20 @@ type TFireEvent<Events extends TMap> = <K extends keyof Events>(id: TId, ev: K,
|
|
|
1234
1238
|
methods
|
|
1235
1239
|
*/
|
|
1236
1240
|
declare function makeImperativeComponent<ComponentProps extends TMap, Events extends TMap = TMap>(): <State extends TMap, Methods extends TMethods<State>>({ Component, initialState, methods, }: {
|
|
1237
|
-
initialState?: State
|
|
1238
|
-
methods?: Methods
|
|
1239
|
-
Component: FC<Omit<ComponentProps,
|
|
1240
|
-
}) => [
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
FC<ComponentProps & {
|
|
1244
|
-
id: TId;
|
|
1245
|
-
}>
|
|
1246
|
-
];
|
|
1241
|
+
initialState?: State;
|
|
1242
|
+
methods?: Methods;
|
|
1243
|
+
Component: FC<Omit<ComponentProps, "id"> & State>;
|
|
1244
|
+
}) => [TMethodsMap<Methods>, TFireEvent<Events>, FC<ComponentProps & {
|
|
1245
|
+
id: TId;
|
|
1246
|
+
}>];
|
|
1247
1247
|
|
|
1248
1248
|
type TSingleMethodsMap<Methods extends TMethods<any>, MethodsMap extends TMethodsMap<Methods>> = {
|
|
1249
1249
|
[Name in keyof MethodsMap]: MethodsMap[Name] extends (id: TId, ...args: infer Action) => unknown ? (...args: Action) => unknown : never;
|
|
1250
1250
|
};
|
|
1251
1251
|
declare function makeSingleImperativeComponent<ComponentProps extends TMap, Events extends TMap = TMap>(): <State extends TMap, Methods extends TMethods<State>>({ initialState, methods, Component, }: {
|
|
1252
|
-
initialState?: State
|
|
1253
|
-
methods?: Methods
|
|
1254
|
-
Component: FC<Omit<ComponentProps,
|
|
1252
|
+
initialState?: State;
|
|
1253
|
+
methods?: Methods;
|
|
1254
|
+
Component: FC<Omit<ComponentProps, "id"> & State>;
|
|
1255
1255
|
}) => [TSingleMethodsMap<Methods, TMethodsMap<Methods>>, <K extends keyof Events>(ev: K, args: Events[K]) => void, FC<ComponentProps>];
|
|
1256
1256
|
|
|
1257
1257
|
declare const useImperativeComponentEvents: <Events extends TMap = TMap>(handlers: Partial<TEventsMap<Events>>) => string;
|
|
@@ -1626,6 +1626,8 @@ declare class ScrollLocker {
|
|
|
1626
1626
|
static unlock(): void;
|
|
1627
1627
|
}
|
|
1628
1628
|
|
|
1629
|
+
declare function isTrue(el: any): boolean;
|
|
1630
|
+
|
|
1629
1631
|
type StatefulStoreUnsuscriber = () => void;
|
|
1630
1632
|
type StatefulStoreUpdater<Props> = (currentProps: Props) => Props;
|
|
1631
1633
|
type StatefulStoreUpdateProps<Props> = StatefulStoreUpdater<Props> | Partial<Props>;
|
|
@@ -1906,6 +1908,8 @@ declare const parseXMLRequestResponse: (response: AxiosResponse<unknown, unknown
|
|
|
1906
1908
|
|
|
1907
1909
|
declare const postNavigation: (url: string, data: Record<string, any>) => void;
|
|
1908
1910
|
|
|
1911
|
+
declare function awaitTime(ms: number): Promise<void>;
|
|
1912
|
+
|
|
1909
1913
|
type CB = () => void;
|
|
1910
1914
|
/**
|
|
1911
1915
|
* A simple semaphore implementation to control concurrency.
|
|
@@ -1943,5 +1947,11 @@ declare class Mutex extends Semaphore {
|
|
|
1943
1947
|
runExclusive(cb: () => unknown): Promise<void>;
|
|
1944
1948
|
}
|
|
1945
1949
|
|
|
1946
|
-
|
|
1950
|
+
type Task<T> = () => Promise<T>;
|
|
1951
|
+
declare class TasksQueue {
|
|
1952
|
+
private mutex;
|
|
1953
|
+
run<T>(task: Task<T>): Promise<T>;
|
|
1954
|
+
}
|
|
1955
|
+
|
|
1956
|
+
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, 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, 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 };
|
|
1947
1957
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { makeAutoObservable, makeObservable, observable } 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';
|
|
5
|
-
import uniqueId from 'lodash-es/uniqueId';
|
|
5
|
+
import uniqueId$1 from 'lodash-es/uniqueId';
|
|
6
6
|
import isFunction from 'lodash-es/isFunction';
|
|
7
7
|
import dayjs from 'dayjs';
|
|
8
8
|
import customParseFormat from 'dayjs/plugin/customParseFormat';
|
|
@@ -13,6 +13,10 @@ import cloneDeep$1 from 'lodash-es/cloneDeep';
|
|
|
13
13
|
import xml2js from 'xml2js';
|
|
14
14
|
import { parseBooleans, parseNumbers } from 'xml2js/lib/processors';
|
|
15
15
|
|
|
16
|
+
function getWindow() {
|
|
17
|
+
return globalThis;
|
|
18
|
+
}
|
|
19
|
+
|
|
16
20
|
function addBoundary(definition, min, max, loop) {
|
|
17
21
|
const actualNumber = typeof definition === "number" ? definition : definition.number;
|
|
18
22
|
const actualMin = typeof definition === "number" ? min : definition.min;
|
|
@@ -64,13 +68,13 @@ function animate(duration, callback, onFinish) {
|
|
|
64
68
|
const progress = ellapsed / duration;
|
|
65
69
|
callback(addBoundary(progress, 0, 1));
|
|
66
70
|
if (progress < 1)
|
|
67
|
-
suscription =
|
|
71
|
+
suscription = getWindow().requestAnimationFrame(innerAnimate);
|
|
68
72
|
else
|
|
69
73
|
onFinish?.();
|
|
70
74
|
}
|
|
71
|
-
suscription =
|
|
75
|
+
suscription = getWindow().requestAnimationFrame(innerAnimate);
|
|
72
76
|
return () => {
|
|
73
|
-
|
|
77
|
+
getWindow().cancelAnimationFrame(suscription);
|
|
74
78
|
};
|
|
75
79
|
}
|
|
76
80
|
|
|
@@ -160,10 +164,18 @@ const encrypt = async (salt, iv, passPhrase, plainText, keySize, iterationCount)
|
|
|
160
164
|
return encrypted.ciphertext.toString(CryptoJS.enc.Base64);
|
|
161
165
|
};
|
|
162
166
|
|
|
167
|
+
const ids = {};
|
|
168
|
+
function uniqueId(prefix = "") {
|
|
169
|
+
if (!ids[prefix]) {
|
|
170
|
+
ids[prefix] = 0;
|
|
171
|
+
}
|
|
172
|
+
return `${prefix ? `${prefix}_` : ""}${ids[prefix]++}`;
|
|
173
|
+
}
|
|
174
|
+
|
|
163
175
|
dayjs.extend(customParseFormat);
|
|
164
176
|
const DEFAULT_DATE_FORMAT = "DD/MM/YYYY";
|
|
165
|
-
const getDateFormat = () => {
|
|
166
|
-
switch (
|
|
177
|
+
const getDateFormat = (format) => {
|
|
178
|
+
switch (format ?? getWindow().DATE_FORMAT) {
|
|
167
179
|
case "m/d/Y":
|
|
168
180
|
return "MM/DD/YYYY";
|
|
169
181
|
case "d/m/Y":
|
|
@@ -189,16 +201,18 @@ function dateToApiaFormat(date) {
|
|
|
189
201
|
const globals = {
|
|
190
202
|
getVersion() {
|
|
191
203
|
return {
|
|
192
|
-
version: VERSION,
|
|
193
|
-
commit: COMMITHASH,
|
|
194
|
-
branch: BRANCH,
|
|
195
|
-
env: ENVIRONMENT,
|
|
196
|
-
timestamp: TIMESTAMP,
|
|
197
|
-
package: PACKAGE_VERSION
|
|
204
|
+
version: typeof window !== "undefined" ? VERSION : void 0,
|
|
205
|
+
commit: typeof window !== "undefined" ? COMMITHASH : void 0,
|
|
206
|
+
branch: typeof window !== "undefined" ? BRANCH : void 0,
|
|
207
|
+
env: typeof window !== "undefined" ? ENVIRONMENT : void 0,
|
|
208
|
+
timestamp: typeof window !== "undefined" ? TIMESTAMP : void 0,
|
|
209
|
+
package: typeof window !== "undefined" ? PACKAGE_VERSION : void 0
|
|
198
210
|
};
|
|
199
211
|
}
|
|
200
212
|
};
|
|
201
|
-
window
|
|
213
|
+
if (typeof window !== "undefined") {
|
|
214
|
+
getWindow().Globals = globals;
|
|
215
|
+
}
|
|
202
216
|
function isDebugDispatcherEnabled() {
|
|
203
217
|
return globals.getVersion().env === "development";
|
|
204
218
|
}
|
|
@@ -265,8 +279,10 @@ const debugDispatcher = new class DDispatcher {
|
|
|
265
279
|
});
|
|
266
280
|
}
|
|
267
281
|
}();
|
|
268
|
-
window
|
|
269
|
-
|
|
282
|
+
if (typeof window !== "undefined") {
|
|
283
|
+
getWindow().dd = debugDispatcher;
|
|
284
|
+
getWindow().adt = debugDispatcher;
|
|
285
|
+
}
|
|
270
286
|
|
|
271
287
|
const shortcutController = new class ShortcutController {
|
|
272
288
|
constructor() {
|
|
@@ -281,32 +297,34 @@ const shortcutController = new class ShortcutController {
|
|
|
281
297
|
this.categories = {
|
|
282
298
|
dev: ["shift&D"]
|
|
283
299
|
};
|
|
284
|
-
document
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
(
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
ev.
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
current.callbacks
|
|
307
|
-
|
|
300
|
+
if (typeof document !== "undefined") {
|
|
301
|
+
document.addEventListener("keydown", (ev) => {
|
|
302
|
+
if (ev.key?.length !== 1 && ev.key !== "Escape")
|
|
303
|
+
return;
|
|
304
|
+
this.candidates = [
|
|
305
|
+
...this.candidates.reduce(
|
|
306
|
+
(accumulated, current) => [
|
|
307
|
+
...accumulated,
|
|
308
|
+
...current.children.filter(
|
|
309
|
+
(child) => child.key.key === ev.key && child.key.altKey === ev.altKey && child.key.ctrlKey === ev.ctrlKey && child.key.shiftKey === ev.shiftKey
|
|
310
|
+
)
|
|
311
|
+
],
|
|
312
|
+
[]
|
|
313
|
+
),
|
|
314
|
+
...this.shortcuts.children.filter(
|
|
315
|
+
(current) => current.key.key === ev.key && current.key.altKey === ev.altKey && current.key.ctrlKey === ev.ctrlKey && current.key.shiftKey === ev.shiftKey
|
|
316
|
+
)
|
|
317
|
+
];
|
|
318
|
+
this.candidates.forEach((current) => {
|
|
319
|
+
if (current.fireEvenFromInputs || !(!ev.key || ev.key.length > 1 || ["input", "textarea", "select"].includes(
|
|
320
|
+
ev.target.tagName?.toLowerCase()
|
|
321
|
+
))) {
|
|
322
|
+
if (current.callbacks)
|
|
323
|
+
current.callbacks.forEach((cb) => cb(ev));
|
|
324
|
+
}
|
|
325
|
+
});
|
|
308
326
|
});
|
|
309
|
-
}
|
|
327
|
+
}
|
|
310
328
|
debugDispatcher.on(
|
|
311
329
|
"shortcuts",
|
|
312
330
|
() => {
|
|
@@ -545,8 +563,8 @@ function autoDisconnectMutationObserver(element, callback, conf) {
|
|
|
545
563
|
|
|
546
564
|
const REGEXP_SCROLL_PARENT = /^(visible|hidden)/;
|
|
547
565
|
function findScrollContainer(el) {
|
|
548
|
-
const found = !(el instanceof HTMLElement) || typeof
|
|
549
|
-
|
|
566
|
+
const found = !(el instanceof HTMLElement) || typeof getWindow().getComputedStyle !== "function" ? null : el.scrollHeight >= el.clientHeight && !REGEXP_SCROLL_PARENT.test(
|
|
567
|
+
getWindow().getComputedStyle(el).overflowY || "visible"
|
|
550
568
|
) ? el : findScrollContainer(el.parentElement) || document;
|
|
551
569
|
if (found === document.body) {
|
|
552
570
|
return document.body.parentElement;
|
|
@@ -586,7 +604,7 @@ function scrollParentIntoElement(element, fixedOffsetTop = 0, tries = 2, timeout
|
|
|
586
604
|
scrollParent.scrollTop += bottomOverflow;
|
|
587
605
|
}
|
|
588
606
|
if (tries > 0) {
|
|
589
|
-
scrollIntervals[id] =
|
|
607
|
+
scrollIntervals[id] = getWindow().setTimeout(() => {
|
|
590
608
|
scrollParentIntoElement(element, fixedOffsetTop, tries - 1, timeout, id);
|
|
591
609
|
}, timeout);
|
|
592
610
|
}
|
|
@@ -597,14 +615,14 @@ const controller = {
|
|
|
597
615
|
};
|
|
598
616
|
makeObservable(controller, { direction: observable });
|
|
599
617
|
function initScrollController() {
|
|
600
|
-
if (controller.direction !== "")
|
|
618
|
+
if (typeof window === "undefined" || controller.direction !== "")
|
|
601
619
|
return;
|
|
602
620
|
controller.direction = "both";
|
|
603
621
|
function setShouldShow(direction) {
|
|
604
622
|
controller.direction = direction;
|
|
605
623
|
}
|
|
606
624
|
const resizeObserver = new ResizeObserver(() => {
|
|
607
|
-
if (document.documentElement.scrollHeight ===
|
|
625
|
+
if (document.documentElement.scrollHeight === getWindow().innerHeight)
|
|
608
626
|
controller.direction = "both";
|
|
609
627
|
});
|
|
610
628
|
resizeObserver.observe(document.documentElement);
|
|
@@ -777,7 +795,6 @@ const cantFocusSelector = [
|
|
|
777
795
|
"[disabled]",
|
|
778
796
|
'[tabIndex="-1"]',
|
|
779
797
|
'[aria-hidden="true"]',
|
|
780
|
-
"[readonly]",
|
|
781
798
|
"[data-focus-guard]",
|
|
782
799
|
".modal__closeButton"
|
|
783
800
|
].map((current) => `:not(${current})`).join("");
|
|
@@ -1142,6 +1159,22 @@ function useWhyUpdated(label, e) {
|
|
|
1142
1159
|
}
|
|
1143
1160
|
}
|
|
1144
1161
|
|
|
1162
|
+
const useMountTransition = (isMounted, unmountDelay) => {
|
|
1163
|
+
const [hasTransitionedIn, setHasTransitionedIn] = useState(false);
|
|
1164
|
+
useEffect(() => {
|
|
1165
|
+
let timeoutId;
|
|
1166
|
+
if (isMounted && !hasTransitionedIn) {
|
|
1167
|
+
setHasTransitionedIn(true);
|
|
1168
|
+
} else if (!isMounted && hasTransitionedIn) {
|
|
1169
|
+
timeoutId = setTimeout(() => setHasTransitionedIn(false), unmountDelay);
|
|
1170
|
+
}
|
|
1171
|
+
return () => {
|
|
1172
|
+
clearTimeout(timeoutId);
|
|
1173
|
+
};
|
|
1174
|
+
}, [unmountDelay, isMounted, hasTransitionedIn]);
|
|
1175
|
+
return hasTransitionedIn;
|
|
1176
|
+
};
|
|
1177
|
+
|
|
1145
1178
|
function isSetter(data) {
|
|
1146
1179
|
return typeof data === "function";
|
|
1147
1180
|
}
|
|
@@ -1677,7 +1710,9 @@ const persistentStorage = new Proxy(
|
|
|
1677
1710
|
}
|
|
1678
1711
|
}
|
|
1679
1712
|
);
|
|
1680
|
-
window
|
|
1713
|
+
if (typeof window !== "undefined") {
|
|
1714
|
+
getWindow().persistentStorage = persistentStorage;
|
|
1715
|
+
}
|
|
1681
1716
|
|
|
1682
1717
|
const localStorageController = new class LocalSctorageController extends EventEmitter {
|
|
1683
1718
|
}();
|
|
@@ -1714,6 +1749,12 @@ function useLocalStorage(prop, defaultValue) {
|
|
|
1714
1749
|
];
|
|
1715
1750
|
}
|
|
1716
1751
|
|
|
1752
|
+
function awaitTime(ms) {
|
|
1753
|
+
return new Promise((resolve) => {
|
|
1754
|
+
setTimeout(resolve, ms);
|
|
1755
|
+
});
|
|
1756
|
+
}
|
|
1757
|
+
|
|
1717
1758
|
class Semaphore {
|
|
1718
1759
|
/**
|
|
1719
1760
|
* Creates a new instance of the Semaphore.
|
|
@@ -1764,6 +1805,20 @@ class Mutex extends Semaphore {
|
|
|
1764
1805
|
}
|
|
1765
1806
|
}
|
|
1766
1807
|
|
|
1808
|
+
class TasksQueue {
|
|
1809
|
+
constructor() {
|
|
1810
|
+
this.mutex = new Mutex();
|
|
1811
|
+
}
|
|
1812
|
+
async run(task) {
|
|
1813
|
+
await this.mutex.acquire();
|
|
1814
|
+
try {
|
|
1815
|
+
return await task();
|
|
1816
|
+
} finally {
|
|
1817
|
+
this.mutex.release();
|
|
1818
|
+
}
|
|
1819
|
+
}
|
|
1820
|
+
}
|
|
1821
|
+
|
|
1767
1822
|
class Locker extends EventEmitter {
|
|
1768
1823
|
constructor() {
|
|
1769
1824
|
super();
|
|
@@ -1845,7 +1900,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
1845
1900
|
};
|
|
1846
1901
|
var _root, _props, _actualFocusQuery, _currentInstruction, _focusDelay, _focusRetries, _focusTimeout, _isIntervalRunning, _focusQuery, focusQuery_get, _checkInstruction, checkInstruction_fn, _doFocus, doFocus_fn, _resetInterval, resetInterval_fn, _runFocusInterval, runFocusInterval_fn, _a;
|
|
1847
1902
|
const notificationsSelector = ".notification";
|
|
1848
|
-
const focus = new (_a = class {
|
|
1903
|
+
const focus = typeof document !== "undefined" ? new (_a = class {
|
|
1849
1904
|
constructor(root, props) {
|
|
1850
1905
|
__privateAdd(this, _focusQuery);
|
|
1851
1906
|
__privateAdd(this, _checkInstruction);
|
|
@@ -1864,7 +1919,7 @@ const focus = new (_a = class {
|
|
|
1864
1919
|
this.focusOnReload = null;
|
|
1865
1920
|
__privateSet(this, _root, root);
|
|
1866
1921
|
__privateSet(this, _props, props);
|
|
1867
|
-
|
|
1922
|
+
getWindow().focusStatus = {};
|
|
1868
1923
|
globalFocus.onFocus(() => {
|
|
1869
1924
|
__privateMethod(this, _resetInterval, resetInterval_fn).call(this);
|
|
1870
1925
|
});
|
|
@@ -1956,9 +2011,7 @@ const focus = new (_a = class {
|
|
|
1956
2011
|
this.focusOnReload
|
|
1957
2012
|
);
|
|
1958
2013
|
const scrollTop = noNaN(
|
|
1959
|
-
window.CURRENT_TAB?.split(
|
|
1960
|
-
"~"
|
|
1961
|
-
)[1]
|
|
2014
|
+
window.CURRENT_TAB?.split("~")[1]
|
|
1962
2015
|
);
|
|
1963
2016
|
if (document.scrollingElement)
|
|
1964
2017
|
document.scrollingElement.scrollTop = scrollTop;
|
|
@@ -2096,7 +2149,7 @@ const focus = new (_a = class {
|
|
|
2096
2149
|
};
|
|
2097
2150
|
void resolvePromise();
|
|
2098
2151
|
});
|
|
2099
|
-
}, _a)(document.getElementById("root"));
|
|
2152
|
+
}, _a)(document.getElementById("root")) : null;
|
|
2100
2153
|
|
|
2101
2154
|
class History extends EventEmitter {
|
|
2102
2155
|
constructor(onCloseWindow, configuration) {
|
|
@@ -2287,7 +2340,7 @@ function makeSingleImperativeComponent() {
|
|
|
2287
2340
|
methods,
|
|
2288
2341
|
Component
|
|
2289
2342
|
}) {
|
|
2290
|
-
const id = uniqueId();
|
|
2343
|
+
const id = uniqueId$1();
|
|
2291
2344
|
const [actualMethods, originalFireEvent, ImperativeComponent] = makeImperativeComponent()({
|
|
2292
2345
|
initialState,
|
|
2293
2346
|
methods,
|
|
@@ -2312,7 +2365,7 @@ function useImperativeComponentContext() {
|
|
|
2312
2365
|
}
|
|
2313
2366
|
|
|
2314
2367
|
const useImperativeComponentEvents = (handlers) => {
|
|
2315
|
-
const uniqueHookId = useMemo(() => uniqueId("hook"), []);
|
|
2368
|
+
const uniqueHookId = useMemo(() => uniqueId$1("hook"), []);
|
|
2316
2369
|
const { id, eventsStore } = useImperativeComponentContext();
|
|
2317
2370
|
const hasRegistered = useRef(false);
|
|
2318
2371
|
const registerEvents = useCallback(() => {
|
|
@@ -2733,6 +2786,19 @@ function useDebouncedState(timeout, initialState) {
|
|
|
2733
2786
|
return [state, setState];
|
|
2734
2787
|
}
|
|
2735
2788
|
|
|
2789
|
+
function isTrue(el) {
|
|
2790
|
+
if (el === true) {
|
|
2791
|
+
return true;
|
|
2792
|
+
}
|
|
2793
|
+
if (["t", "true"].includes(String(el).toLowerCase())) {
|
|
2794
|
+
return true;
|
|
2795
|
+
}
|
|
2796
|
+
if (el === 1) {
|
|
2797
|
+
return true;
|
|
2798
|
+
}
|
|
2799
|
+
return false;
|
|
2800
|
+
}
|
|
2801
|
+
|
|
2736
2802
|
function alignment(a, b) {
|
|
2737
2803
|
const m = a.length;
|
|
2738
2804
|
const n = b.length;
|
|
@@ -2906,5 +2972,5 @@ const postNavigation = (url, data) => {
|
|
|
2906
2972
|
form.submit();
|
|
2907
2973
|
};
|
|
2908
2974
|
|
|
2909
|
-
export { AudioRecorder, BasicStoredElement, BouncingEmitter, ClassNameBuilder, EventEmitter, History, Locker, Mutex, PropsSelectorUndefinedObject, PropsStore, ScrollLocker, Semaphore, StatefulEmitter, 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 };
|
|
2975
|
+
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, 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, 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 };
|
|
2910
2976
|
//# sourceMappingURL=index.js.map
|