@apia/util 2.0.11 → 3.0.2
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 +1865 -68
- package/dist/index.js +2650 -62
- package/dist/index.js.map +1 -1
- package/package.json +4 -3
- package/dist/animate/index.d.ts +0 -4
- package/dist/animate/index.d.ts.map +0 -1
- package/dist/animate/index.js +0 -24
- package/dist/animate/index.js.map +0 -1
- package/dist/array/arrayOrArray.d.ts +0 -4
- package/dist/array/arrayOrArray.d.ts.map +0 -1
- package/dist/array/arrayOrArray.js +0 -8
- package/dist/array/arrayOrArray.js.map +0 -1
- package/dist/array/getIndex.d.ts +0 -14
- package/dist/array/getIndex.d.ts.map +0 -1
- package/dist/array/getIndex.js +0 -12
- package/dist/array/getIndex.js.map +0 -1
- package/dist/crypto/decrypt.d.ts +0 -4
- package/dist/crypto/decrypt.d.ts.map +0 -1
- package/dist/crypto/decrypt.js +0 -16
- package/dist/crypto/decrypt.js.map +0 -1
- package/dist/crypto/encrypt.d.ts +0 -4
- package/dist/crypto/encrypt.d.ts.map +0 -1
- package/dist/crypto/encrypt.js +0 -13
- package/dist/crypto/encrypt.js.map +0 -1
- package/dist/crypto/generateKey.js +0 -11
- package/dist/crypto/generateKey.js.map +0 -1
- package/dist/date/apiaDateToStandarFormat.d.ts +0 -4
- package/dist/date/apiaDateToStandarFormat.d.ts.map +0 -1
- package/dist/date/apiaDateToStandarFormat.js +0 -12
- package/dist/date/apiaDateToStandarFormat.js.map +0 -1
- package/dist/date/dateToApiaFormat.d.ts +0 -4
- package/dist/date/dateToApiaFormat.d.ts.map +0 -1
- package/dist/date/dateToApiaFormat.js +0 -9
- package/dist/date/dateToApiaFormat.js.map +0 -1
- package/dist/date/getDateFormat.d.ts +0 -11
- package/dist/date/getDateFormat.d.ts.map +0 -1
- package/dist/date/getDateFormat.js +0 -20
- package/dist/date/getDateFormat.js.map +0 -1
- package/dist/debug/debugDispatcher.d.ts +0 -36
- package/dist/debug/debugDispatcher.d.ts.map +0 -1
- package/dist/debug/debugDispatcher.js +0 -75
- package/dist/debug/debugDispatcher.js.map +0 -1
- package/dist/debug/shortcutController.d.ts +0 -57
- package/dist/debug/shortcutController.d.ts.map +0 -1
- package/dist/debug/shortcutController.js +0 -152
- package/dist/debug/shortcutController.js.map +0 -1
- package/dist/documents/downloadStringAsDoc.d.ts +0 -8
- package/dist/documents/downloadStringAsDoc.d.ts.map +0 -1
- package/dist/documents/downloadStringAsDoc.js +0 -12
- package/dist/documents/downloadStringAsDoc.js.map +0 -1
- package/dist/documents/downloadUrl.d.ts +0 -20
- package/dist/documents/downloadUrl.d.ts.map +0 -1
- package/dist/documents/downloadUrl.js +0 -18
- package/dist/documents/downloadUrl.js.map +0 -1
- package/dist/documents/openAndReadFile.d.ts +0 -4
- package/dist/documents/openAndReadFile.d.ts.map +0 -1
- package/dist/documents/openAndReadFile.js +0 -29
- package/dist/documents/openAndReadFile.js.map +0 -1
- package/dist/dom/autoDisconnectMutationObserver.d.ts +0 -17
- package/dist/dom/autoDisconnectMutationObserver.d.ts.map +0 -1
- package/dist/dom/autoDisconnectMutationObserver.js +0 -35
- package/dist/dom/autoDisconnectMutationObserver.js.map +0 -1
- package/dist/dom/customEvents.d.ts +0 -40
- package/dist/dom/customEvents.d.ts.map +0 -1
- package/dist/dom/customEvents.js +0 -34
- package/dist/dom/customEvents.js.map +0 -1
- package/dist/dom/enableChildrenFocus.d.ts +0 -18
- package/dist/dom/enableChildrenFocus.d.ts.map +0 -1
- package/dist/dom/enableChildrenFocus.js +0 -26
- package/dist/dom/enableChildrenFocus.js.map +0 -1
- package/dist/dom/findOffsetRelativeToScrollParent.d.ts +0 -7
- package/dist/dom/findOffsetRelativeToScrollParent.d.ts.map +0 -1
- package/dist/dom/findOffsetRelativeToScrollParent.js +0 -19
- package/dist/dom/findOffsetRelativeToScrollParent.js.map +0 -1
- package/dist/dom/findScrollContainer.d.ts +0 -8
- package/dist/dom/findScrollContainer.d.ts.map +0 -1
- package/dist/dom/findScrollContainer.js +0 -9
- package/dist/dom/findScrollContainer.js.map +0 -1
- package/dist/dom/getFocusSelector.d.ts +0 -25
- package/dist/dom/getFocusSelector.d.ts.map +0 -1
- package/dist/dom/getFocusSelector.js +0 -30
- package/dist/dom/getFocusSelector.js.map +0 -1
- package/dist/dom/getSpecificParent.d.ts +0 -23
- package/dist/dom/getSpecificParent.d.ts.map +0 -1
- package/dist/dom/getSpecificParent.js +0 -19
- package/dist/dom/getSpecificParent.js.map +0 -1
- package/dist/dom/isChild.d.ts +0 -13
- package/dist/dom/isChild.d.ts.map +0 -1
- package/dist/dom/isChild.js +0 -8
- package/dist/dom/isChild.js.map +0 -1
- package/dist/dom/scrollParentIntoElement.d.ts +0 -9
- package/dist/dom/scrollParentIntoElement.d.ts.map +0 -1
- package/dist/dom/scrollParentIntoElement.js +0 -24
- package/dist/dom/scrollParentIntoElement.js.map +0 -1
- package/dist/dom/url.d.ts +0 -18
- package/dist/dom/url.d.ts.map +0 -1
- package/dist/dom/url.js +0 -52
- package/dist/dom/url.js.map +0 -1
- package/dist/dom/usePanAndZoom.d.ts +0 -14
- package/dist/dom/usePanAndZoom.d.ts.map +0 -1
- package/dist/dom/usePanAndZoom.js +0 -111
- package/dist/dom/usePanAndZoom.js.map +0 -1
- package/dist/encoding/index.d.ts +0 -8
- package/dist/encoding/index.d.ts.map +0 -1
- package/dist/encoding/index.js +0 -12
- package/dist/encoding/index.js.map +0 -1
- package/dist/events/BouncingEmitter.d.ts +0 -67
- package/dist/events/BouncingEmitter.d.ts.map +0 -1
- package/dist/events/BouncingEmitter.js +0 -72
- package/dist/events/BouncingEmitter.js.map +0 -1
- package/dist/events/EventEmitter.d.ts +0 -47
- package/dist/events/EventEmitter.d.ts.map +0 -1
- package/dist/events/EventEmitter.js +0 -75
- package/dist/events/EventEmitter.js.map +0 -1
- package/dist/events/StatefulEmitter.d.ts +0 -44
- package/dist/events/StatefulEmitter.d.ts.map +0 -1
- package/dist/events/StatefulEmitter.js +0 -57
- package/dist/events/StatefulEmitter.js.map +0 -1
- package/dist/events/types.d.ts +0 -29
- package/dist/events/types.d.ts.map +0 -1
- package/dist/focus/focusController.d.ts +0 -108
- package/dist/focus/focusController.d.ts.map +0 -1
- package/dist/focus/focusController.js +0 -295
- package/dist/focus/focusController.js.map +0 -1
- package/dist/focus/globalFocus.d.ts +0 -24
- package/dist/focus/globalFocus.d.ts.map +0 -1
- package/dist/focus/globalFocus.js +0 -87
- package/dist/focus/globalFocus.js.map +0 -1
- package/dist/history/History.d.ts +0 -81
- package/dist/history/History.d.ts.map +0 -1
- package/dist/history/History.js +0 -122
- package/dist/history/History.js.map +0 -1
- package/dist/hooks/useCombinedRefs.d.ts +0 -18
- package/dist/hooks/useCombinedRefs.d.ts.map +0 -1
- package/dist/hooks/useCombinedRefs.js +0 -20
- package/dist/hooks/useCombinedRefs.js.map +0 -1
- package/dist/hooks/useDebouncedCallback.d.ts +0 -7
- package/dist/hooks/useDebouncedCallback.d.ts.map +0 -1
- package/dist/hooks/useDebouncedCallback.js +0 -21
- package/dist/hooks/useDebouncedCallback.js.map +0 -1
- package/dist/hooks/useLatest.d.ts +0 -13
- package/dist/hooks/useLatest.d.ts.map +0 -1
- package/dist/hooks/useLatest.js +0 -10
- package/dist/hooks/useLatest.js.map +0 -1
- package/dist/hooks/useMount.d.ts +0 -6
- package/dist/hooks/useMount.d.ts.map +0 -1
- package/dist/hooks/useMount.js +0 -14
- package/dist/hooks/useMount.js.map +0 -1
- package/dist/hooks/usePrevious.d.ts +0 -6
- package/dist/hooks/usePrevious.d.ts.map +0 -1
- package/dist/hooks/usePrevious.js +0 -12
- package/dist/hooks/usePrevious.js.map +0 -1
- package/dist/hooks/useShallowMemo.d.ts +0 -9
- package/dist/hooks/useShallowMemo.d.ts.map +0 -1
- package/dist/hooks/useShallowMemo.js +0 -42
- package/dist/hooks/useShallowMemo.js.map +0 -1
- package/dist/hooks/useStateRef.d.ts +0 -10
- package/dist/hooks/useStateRef.d.ts.map +0 -1
- package/dist/hooks/useStateRef.js +0 -11
- package/dist/hooks/useStateRef.js.map +0 -1
- package/dist/hooks/useSubscription.d.ts +0 -31
- package/dist/hooks/useSubscription.d.ts.map +0 -1
- package/dist/hooks/useSubscription.js +0 -21
- package/dist/hooks/useSubscription.js.map +0 -1
- package/dist/hooks/useUnmount.d.ts +0 -4
- package/dist/hooks/useUnmount.d.ts.map +0 -1
- package/dist/hooks/useUnmount.js +0 -10
- package/dist/hooks/useUnmount.js.map +0 -1
- package/dist/hooks/useUpdateEffect.d.ts +0 -10
- package/dist/hooks/useUpdateEffect.d.ts.map +0 -1
- package/dist/hooks/useUpdateEffect.js +0 -16
- package/dist/hooks/useUpdateEffect.js.map +0 -1
- package/dist/imperative/makeImperativeComponent.d.ts +0 -56
- package/dist/imperative/makeImperativeComponent.d.ts.map +0 -1
- package/dist/imperative/makeImperativeComponent.js +0 -43
- package/dist/imperative/makeImperativeComponent.js.map +0 -1
- package/dist/imperative/makeSingleImperativeComponent.d.ts +0 -15
- package/dist/imperative/makeSingleImperativeComponent.d.ts.map +0 -1
- package/dist/imperative/makeSingleImperativeComponent.js +0 -31
- package/dist/imperative/makeSingleImperativeComponent.js.map +0 -1
- package/dist/imperative/types.d.ts +0 -22
- package/dist/imperative/types.d.ts.map +0 -1
- package/dist/imperative/types.js +0 -8
- package/dist/imperative/types.js.map +0 -1
- package/dist/imperative/useImperativeComponentEvents.d.ts +0 -6
- package/dist/imperative/useImperativeComponentEvents.d.ts.map +0 -1
- package/dist/imperative/useImperativeComponentEvents.js +0 -35
- package/dist/imperative/useImperativeComponentEvents.js.map +0 -1
- package/dist/imperative/useImperativeIdentifierContext.d.ts +0 -14
- package/dist/imperative/useImperativeIdentifierContext.d.ts.map +0 -1
- package/dist/imperative/useImperativeIdentifierContext.js +0 -10
- package/dist/imperative/useImperativeIdentifierContext.js.map +0 -1
- package/dist/labels/formatMessage.d.ts +0 -19
- package/dist/labels/formatMessage.d.ts.map +0 -1
- package/dist/labels/formatMessage.js +0 -13
- package/dist/labels/formatMessage.js.map +0 -1
- package/dist/labels/getLabel.d.ts +0 -34
- package/dist/labels/getLabel.d.ts.map +0 -1
- package/dist/labels/getLabel.js +0 -18
- package/dist/labels/getLabel.js.map +0 -1
- package/dist/number/index.d.ts +0 -29
- package/dist/number/index.d.ts.map +0 -1
- package/dist/number/index.js +0 -43
- package/dist/number/index.js.map +0 -1
- package/dist/objects/getValueByPath.d.ts +0 -23
- package/dist/objects/getValueByPath.d.ts.map +0 -1
- package/dist/objects/getValueByPath.js +0 -19
- package/dist/objects/getValueByPath.js.map +0 -1
- package/dist/objects/setValueByPath.d.ts +0 -33
- package/dist/objects/setValueByPath.d.ts.map +0 -1
- package/dist/objects/setValueByPath.js +0 -35
- package/dist/objects/setValueByPath.js.map +0 -1
- package/dist/propsStore/propsStore.d.ts +0 -42
- package/dist/propsStore/propsStore.d.ts.map +0 -1
- package/dist/propsStore/propsStore.js +0 -157
- package/dist/propsStore/propsStore.js.map +0 -1
- package/dist/propsStore/types.d.ts +0 -24
- package/dist/propsStore/types.d.ts.map +0 -1
- package/dist/propsStore/usePropsSelector.d.ts +0 -67
- package/dist/propsStore/usePropsSelector.d.ts.map +0 -1
- package/dist/propsStore/usePropsSelector.js +0 -92
- package/dist/propsStore/usePropsSelector.js.map +0 -1
- package/dist/screenLock/screenLocker.d.ts +0 -60
- package/dist/screenLock/screenLocker.d.ts.map +0 -1
- package/dist/screenLock/screenLocker.js +0 -95
- package/dist/screenLock/screenLocker.js.map +0 -1
- package/dist/states/useDebouncedState.d.ts +0 -10
- package/dist/states/useDebouncedState.d.ts.map +0 -1
- package/dist/states/useDebouncedState.js +0 -22
- package/dist/states/useDebouncedState.js.map +0 -1
- package/dist/states/useDomState.d.ts +0 -86
- package/dist/states/useDomState.d.ts.map +0 -1
- package/dist/states/useDomState.js +0 -35
- package/dist/states/useDomState.js.map +0 -1
- package/dist/storage/StatefulStore.d.ts +0 -205
- package/dist/storage/StatefulStore.d.ts.map +0 -1
- package/dist/storage/StatefulStore.js +0 -301
- package/dist/storage/StatefulStore.js.map +0 -1
- package/dist/storage/persistentStorage.d.ts +0 -12
- package/dist/storage/persistentStorage.d.ts.map +0 -1
- package/dist/storage/persistentStorage.js +0 -28
- package/dist/storage/persistentStorage.js.map +0 -1
- package/dist/storage/useLocalStorage.d.ts +0 -7
- package/dist/storage/useLocalStorage.d.ts.map +0 -1
- package/dist/storage/useLocalStorage.js +0 -40
- package/dist/storage/useLocalStorage.js.map +0 -1
- package/dist/string/alignment.d.ts +0 -25
- package/dist/string/alignment.d.ts.map +0 -1
- package/dist/string/alignment.js +0 -26
- package/dist/string/alignment.js.map +0 -1
- package/dist/string/ucfirst.d.ts +0 -4
- package/dist/string/ucfirst.d.ts.map +0 -1
- package/dist/string/ucfirst.js +0 -6
- package/dist/string/ucfirst.js.map +0 -1
- package/dist/typeGuards/toBoolean.d.ts +0 -26
- package/dist/typeGuards/toBoolean.d.ts.map +0 -1
- package/dist/typeGuards/toBoolean.js +0 -11
- package/dist/typeGuards/toBoolean.js.map +0 -1
- package/dist/types/apia/common.d.ts +0 -114
- package/dist/types/apia/common.d.ts.map +0 -1
- package/dist/types/apia/date.d.ts +0 -4
- package/dist/types/apia/date.d.ts.map +0 -1
- package/dist/types/apia/forms.d.ts +0 -221
- package/dist/types/apia/forms.d.ts.map +0 -1
- package/dist/types/misc.d.ts +0 -9
- package/dist/types/misc.d.ts.map +0 -1
- package/dist/xml/parseXmlAsync.d.ts +0 -4
- package/dist/xml/parseXmlAsync.d.ts.map +0 -1
- package/dist/xml/parseXmlAsync.js +0 -58
- package/dist/xml/parseXmlAsync.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,69 +1,1866 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import React__default, { SetStateAction, Dispatch, EffectCallback, MutableRefObject, DependencyList, FC, HTMLAttributes } from 'react';
|
|
3
|
+
import { AxiosResponse } from 'axios';
|
|
4
|
+
|
|
5
|
+
declare function animate(duration: number, callback: (progress: number) => unknown, onFinish?: () => unknown): () => void;
|
|
6
|
+
|
|
7
|
+
declare function arrayOrArray<T>(o: T | T[] | undefined): T[];
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* This function gets an array of elements of any kind and an array of
|
|
11
|
+
* functions which will be called to test conditions and will return element
|
|
12
|
+
* whose index equals the matching condition's index
|
|
13
|
+
*
|
|
14
|
+
* @param arr An array of elements of any kind
|
|
15
|
+
* @param conditions An array of conditions, which will be tested in order to determine which index of the array will be returned
|
|
16
|
+
* @param defaultIndex The return value in case that no condition matches
|
|
17
|
+
* @returns An element of the array if any of the conditions matches or the defaultIndex otherwise.
|
|
18
|
+
*/
|
|
19
|
+
declare function getIndex<T = unknown>(arr: T[], conditions: (boolean | (() => boolean))[], defaultIndex?: number): T;
|
|
20
|
+
|
|
21
|
+
declare const decrypt: (salt: string, iv: string, passPhrase: string, cipherText: string, keySize: number, iterationCount: number) => Promise<string>;
|
|
22
|
+
|
|
23
|
+
declare const encrypt: (salt: string, iv: string, passPhrase: string, plainText: string, keySize: number, iterationCount: number) => Promise<string>;
|
|
24
|
+
|
|
25
|
+
declare function apiaDateToStandarFormat(date: string): string;
|
|
26
|
+
|
|
27
|
+
declare function dateToApiaFormat(date: string | Date): string;
|
|
28
|
+
|
|
29
|
+
type TDateFormat = 'DD/MM/YYYY' | 'MM/DD/YYYY' | 'YYYY/MM/DD';
|
|
30
|
+
|
|
31
|
+
declare global {
|
|
32
|
+
interface Window {
|
|
33
|
+
DATE_FORMAT: string;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
declare const getDateFormat: () => TDateFormat;
|
|
37
|
+
|
|
38
|
+
declare global {
|
|
39
|
+
const WP_DEVELOP_MODE: boolean;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Indica si el debugDispatcher fue activado, lo que en muchos casos indica que
|
|
43
|
+
* estamos en ambiente de desarrollo
|
|
44
|
+
*/
|
|
45
|
+
declare function isDebugDispatcherEnabled(): boolean;
|
|
46
|
+
type TWindowDDispatch = (action: string, ...parameters: unknown[]) => void;
|
|
47
|
+
type TDispatchCallback = (parameters: unknown[]) => unknown;
|
|
48
|
+
interface IStoredCallback {
|
|
49
|
+
(parameters: unknown[]): unknown;
|
|
50
|
+
help: () => void;
|
|
51
|
+
}
|
|
52
|
+
declare const debugDispatcher: {
|
|
53
|
+
callbacks: Record<string, IStoredCallback[]>;
|
|
54
|
+
actions: Record<string, () => void>;
|
|
55
|
+
on(action: string, cb: TDispatchCallback, help: string | React__default.ReactNode, onlyDevelop?: boolean): () => void;
|
|
56
|
+
off(action: string, cb: TDispatchCallback): void;
|
|
57
|
+
emit: TWindowDDispatch;
|
|
58
|
+
};
|
|
59
|
+
declare global {
|
|
60
|
+
interface Window {
|
|
61
|
+
adt: typeof debugDispatcher;
|
|
62
|
+
dd: typeof debugDispatcher & Record<string, () => unknown>;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
type TCallback = (ev: KeyboardEvent) => unknown;
|
|
67
|
+
type TKey = {
|
|
68
|
+
key: string;
|
|
69
|
+
altKey?: boolean;
|
|
70
|
+
ctrlKey?: boolean;
|
|
71
|
+
shiftKey?: boolean;
|
|
72
|
+
};
|
|
73
|
+
type TShortcutBranch = {
|
|
74
|
+
key: TKey;
|
|
75
|
+
children: TShortcutBranch[];
|
|
76
|
+
callbacks: TCallback[];
|
|
77
|
+
fireEvenFromInputs?: boolean;
|
|
78
|
+
};
|
|
79
|
+
declare const shortcutController: {
|
|
80
|
+
history: TKey[];
|
|
81
|
+
candidates: TShortcutBranch[];
|
|
82
|
+
shortcuts: TShortcutBranch;
|
|
83
|
+
shortcutsStrings: string[];
|
|
84
|
+
categories: {
|
|
85
|
+
dev: string[];
|
|
86
|
+
};
|
|
87
|
+
parseKeyToString(key: string | TKey): string;
|
|
88
|
+
parseKey(keyString: string): TKey;
|
|
89
|
+
/**
|
|
90
|
+
* Para setear un shorcut se puede pasar un string representativo con la
|
|
91
|
+
* forma:
|
|
92
|
+
*
|
|
93
|
+
* **alt**?&**ctrl**?&**shift**?&**(\w)**
|
|
94
|
+
*
|
|
95
|
+
* Donde: alt? ctrl? shift? implica que cualquiera de esas palabras pueden o
|
|
96
|
+
* no aparecer y (\w) es una letra, símbolo o número.
|
|
97
|
+
*
|
|
98
|
+
* Puede aparecer cualquier tecla de control o no, pero el símbolo o letra
|
|
99
|
+
* debe aparecer.
|
|
100
|
+
*
|
|
101
|
+
* @param category
|
|
102
|
+
* Agrega un prefijo de teclas que se deben presionar antes del shortcut para
|
|
103
|
+
* que funcione, de forma que por ejemplo, todos los shortcuts de la categoría
|
|
104
|
+
* dev serán ejecutados solamente si antes se presionó shift&D
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
*
|
|
108
|
+
shortcutController.on(['shift&A', 'b', 'ctrl&c', 'alt&d'], (ev) => {
|
|
109
|
+
ev.preventDefault();
|
|
110
|
+
console.log('Abctrl+cd'),
|
|
111
|
+
}); // Este shortcut se ejecuta en desarrollo y producción
|
|
112
|
+
|
|
113
|
+
shortcutController.on('unshortcut'.split(''), (ev) => {
|
|
114
|
+
ev.preventDefault();
|
|
115
|
+
console.log('Abctrl+cd'),
|
|
116
|
+
}, 'dev'); // Este shortcut solo se ejecuta en desarrollo
|
|
117
|
+
*/
|
|
118
|
+
on(keys: (string | TKey)[], callback: TCallback, category?: keyof typeof this.categories, fireEvenFromInputs?: boolean): void;
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
type DownloadStringAsDocProps = {
|
|
122
|
+
fileName?: string;
|
|
123
|
+
blobProps?: BlobPropertyBag;
|
|
124
|
+
};
|
|
125
|
+
declare function downloadStringAsDoc(content: string, options?: DownloadStringAsDocProps): Promise<void>;
|
|
126
|
+
|
|
127
|
+
declare function defaultGetNameFromResponse(blob: AxiosResponse): string;
|
|
128
|
+
/**
|
|
129
|
+
* This function gets an URL and a file name and performs a file download.
|
|
130
|
+
*
|
|
131
|
+
* @param url The url to fetch
|
|
132
|
+
* @param getNameFromResponse The name will be given by the 'content-disposition' prop in the headers
|
|
133
|
+
*/
|
|
134
|
+
declare function downloadUrl(url: string, getNameFromResponse?: (blob: AxiosResponse) => string): Promise<void>;
|
|
135
|
+
/**
|
|
136
|
+
* This function gets an URL and a file name and performs a file download.
|
|
137
|
+
*
|
|
138
|
+
* @param url The url to fetch
|
|
139
|
+
* @param fileName The name the file will have as default in the save dialog
|
|
140
|
+
*/
|
|
141
|
+
declare function downloadUrl(url: string, fileName: string): Promise<void>;
|
|
142
|
+
|
|
143
|
+
declare function openAndReadFile(): Promise<string | ArrayBuffer | null>;
|
|
144
|
+
|
|
145
|
+
interface IAutoDisconnectMutationObserverConf {
|
|
146
|
+
/** Por defecto es true */
|
|
147
|
+
runCallbackOnInit?: boolean;
|
|
148
|
+
/** Por defecto es 100 (ms) */
|
|
149
|
+
timeout?: number;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Crea un observer que va a desconectarse automáticamente luego de que pase
|
|
153
|
+
* una determinada cantidad de tiempo sin actividad en el elemento.
|
|
154
|
+
*
|
|
155
|
+
* Se usa especialmente para esperar que un componente termine de renderizar y
|
|
156
|
+
* aplicar cálculos a nivel de layout sobre él.
|
|
157
|
+
*/
|
|
158
|
+
declare function autoDisconnectMutationObserver(element: HTMLElement, callback: () => unknown, conf?: IAutoDisconnectMutationObserverConf): () => void;
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Esta función calcula el offset que existe entre un elemento y su padre más inmediato que tenga scroll visible
|
|
162
|
+
*/
|
|
163
|
+
declare function findOffsetRelativeToScrollParent(element: HTMLElement, which?: 'Left' | 'Top'): number;
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Encuentra el primer elemento padre del elemento provisto que tenga scroll
|
|
167
|
+
* activo.
|
|
168
|
+
*/
|
|
169
|
+
declare function findScrollContainer(el: HTMLElement): HTMLElement | null;
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* 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.
|
|
173
|
+
*
|
|
174
|
+
* @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.
|
|
175
|
+
*/
|
|
176
|
+
declare function scrollParentIntoElement(element: HTMLElement, fixedOffsetTop?: number, tries?: number, timeout?: number, scrollId?: string | undefined): void;
|
|
177
|
+
|
|
178
|
+
declare function usePanAndZoom<ContainerType extends HTMLElement = HTMLElement, ChildType extends HTMLElement | SVGElement = HTMLElement>(effectiveMargin?: {
|
|
179
|
+
left: number;
|
|
180
|
+
top: number;
|
|
181
|
+
right: number;
|
|
182
|
+
bottom: number;
|
|
183
|
+
}, blockZoom?: boolean): {
|
|
184
|
+
boxRef: React__default.RefObject<ContainerType>;
|
|
185
|
+
elementRef: React__default.RefObject<ChildType>;
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Existen algunos eventos que se disparan en la
|
|
190
|
+
* aplicación con la finalidad de desencadenar
|
|
191
|
+
* un comportamiento específico. Por ello se declaran
|
|
192
|
+
* las siguientes constantes.
|
|
193
|
+
*/
|
|
194
|
+
declare const customEvents: {
|
|
195
|
+
/**
|
|
196
|
+
* Indica que un elemento necesita recibir el foco,
|
|
197
|
+
* de esta forma, elementos que no se están mostrando
|
|
198
|
+
* en pantalla (por display:none por ejemplo), pueden
|
|
199
|
+
* indicar a sus ancestros que deben expandirse.
|
|
200
|
+
*/
|
|
201
|
+
focus: string;
|
|
202
|
+
/**
|
|
203
|
+
* Indica que debe cambiarse el título del modal
|
|
204
|
+
*/
|
|
205
|
+
iframeModalChangeTitle: string;
|
|
206
|
+
/**
|
|
207
|
+
* Indica que un iframe modal debe cerrarse
|
|
208
|
+
*/
|
|
209
|
+
iframeModalClose: string;
|
|
210
|
+
/**
|
|
211
|
+
* Indica que un iframe modal debe cerrarse
|
|
212
|
+
*/
|
|
213
|
+
iframeModalNotify: string;
|
|
214
|
+
/**
|
|
215
|
+
* Indica que un modal debe cerrarse
|
|
216
|
+
*/
|
|
217
|
+
modalClose: string;
|
|
218
|
+
/**
|
|
219
|
+
* Indica que el panel contenedor debe cerrarse porque
|
|
220
|
+
* está vacío
|
|
221
|
+
*/
|
|
222
|
+
hidePanel: string;
|
|
223
|
+
showPanel: string;
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Este selector pretende abarcar todos modificadores que en caso de estar
|
|
228
|
+
* presentes hacen que un elemento no sea focusable
|
|
229
|
+
*/
|
|
230
|
+
declare const cantFocusSelector: string;
|
|
231
|
+
/**
|
|
232
|
+
* Este selector pretende abarcar todos los elementos que sean focusables
|
|
233
|
+
*/
|
|
234
|
+
declare const focusSelector: string;
|
|
235
|
+
/**
|
|
236
|
+
* Genera un selector que permitirá seleccionar
|
|
237
|
+
* todos los elementos candidatos a recibir foco,
|
|
238
|
+
* que no cumplan con la condición not pasada
|
|
239
|
+
* como parámetro.
|
|
240
|
+
*
|
|
241
|
+
* @param not Un selector not css, indicando cuáles
|
|
242
|
+
* condiciones deben evitar el foco en un elemento.
|
|
243
|
+
*
|
|
244
|
+
* @returns Una cadena que representa un selector
|
|
245
|
+
* css.
|
|
246
|
+
*/
|
|
247
|
+
declare function getFocusSelector(not?: string): string;
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Searches for a specific parent of a element,
|
|
251
|
+
* using a callback function as the source of
|
|
252
|
+
* truth in order to determine which is the correct
|
|
253
|
+
* parent.
|
|
254
|
+
*
|
|
255
|
+
* @param element The element where the process
|
|
256
|
+
* starts.
|
|
257
|
+
*
|
|
258
|
+
* @param checkParent A callback that will be
|
|
259
|
+
* called for each of the ancestors of the element
|
|
260
|
+
* until the desired parent is found.
|
|
261
|
+
* This function should return **true when found**
|
|
262
|
+
* the desired parend was found, **null to cancel**
|
|
263
|
+
* the search or **false to continue searching**.
|
|
264
|
+
*
|
|
265
|
+
* @returns The specific parent or null in case
|
|
266
|
+
* the root parent element is raised.
|
|
267
|
+
*/
|
|
268
|
+
declare function getSpecificParent(element: HTMLElement | null, checkParent: (parent: HTMLElement) => boolean | null): HTMLElement | null;
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* Permite iterar desde un elemento hacia arriba en el
|
|
272
|
+
* DOM, utilizando una función de comparación para
|
|
273
|
+
* determinar si el elemento actual es el que estamos
|
|
274
|
+
* buscando.
|
|
275
|
+
*
|
|
276
|
+
* Si la función checkParent devuelve true, isChild
|
|
277
|
+
* devuelve true.
|
|
278
|
+
*/
|
|
279
|
+
declare function isChild(element: HTMLElement | null, checkParent: (parent: HTMLElement) => boolean | null): boolean;
|
|
280
|
+
|
|
281
|
+
interface IParameter {
|
|
282
|
+
name: string;
|
|
283
|
+
value: unknown;
|
|
284
|
+
allowMultiple?: boolean;
|
|
285
|
+
}
|
|
286
|
+
declare class Url {
|
|
287
|
+
#private;
|
|
288
|
+
defaultAllowMultiple: boolean;
|
|
289
|
+
base: string;
|
|
290
|
+
constructor(baseUrl: string, defaultAllowMultiple?: boolean);
|
|
291
|
+
addParameter(name: string, value: unknown, allowMultiple?: boolean): void;
|
|
292
|
+
addParameters(parameters: IParameter[]): void;
|
|
293
|
+
getParameter(name: string): string | string[];
|
|
294
|
+
toString(): string;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* Deshabilita la posibilidad de hacer foco en
|
|
299
|
+
* todos los descendientes de parent. Es
|
|
300
|
+
* especialmente útli cuando se ocultan elementos
|
|
301
|
+
* del DOM sin quitarlos, cuando por accesibilidad
|
|
302
|
+
* es importante que el foco no alcance a dichos
|
|
303
|
+
* métodos.
|
|
304
|
+
*/
|
|
305
|
+
declare function disableChildrenFocus(parent: HTMLElement): void;
|
|
306
|
+
/**
|
|
307
|
+
* Restaura el foco de los hijos de parent a los
|
|
308
|
+
* que previamente se les había quitado el foco
|
|
309
|
+
* con disableChildrenFocus.
|
|
310
|
+
*/
|
|
311
|
+
declare function enableChildrenFocus(parent: HTMLElement): void;
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* Toma una cadena de texto que puede tener caracteres de escape de HTML (por
|
|
315
|
+
* ejemplo á) y devuelve su correspondiente en texto plano.
|
|
316
|
+
*/
|
|
317
|
+
declare const decodeHTMLEntities: (str: string) => string | null;
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* @public
|
|
321
|
+
*
|
|
322
|
+
* A basic Record
|
|
323
|
+
* */
|
|
324
|
+
type Map = Record<string, unknown>;
|
|
325
|
+
/**
|
|
326
|
+
* @public
|
|
327
|
+
*
|
|
328
|
+
* This is the callback provided by the listener any time it wants to subscribe to an event.
|
|
329
|
+
*/
|
|
330
|
+
type Callback<Events extends Map, K extends keyof Events = keyof Events> = (data: Events[K]) => unknown;
|
|
331
|
+
/**
|
|
332
|
+
* @internal
|
|
333
|
+
*
|
|
334
|
+
* This is the emitter's callbacks storage
|
|
335
|
+
*/
|
|
336
|
+
type Callbacks<Events extends Map> = {
|
|
337
|
+
[K in keyof Events]: Callback<Events, K>[];
|
|
338
|
+
};
|
|
339
|
+
/**
|
|
340
|
+
* @public
|
|
341
|
+
*
|
|
342
|
+
* A method that unsubscribes the recently made subscription.
|
|
343
|
+
*/
|
|
344
|
+
type UnSubscriber = () => void;
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* @public
|
|
348
|
+
*
|
|
349
|
+
* The `EventEmitter` class is a generic utility for handling events. It allows subscribing to and emitting events.
|
|
350
|
+
* This class is generic and works with a `Map` where keys are event names and values are the types associated with those events.
|
|
351
|
+
*
|
|
352
|
+
* @typeParam Events - An extension of `Map` where the key is the event name and the value is the type of data associated with that event.
|
|
353
|
+
*/
|
|
354
|
+
declare class EventEmitter<Events extends Map> {
|
|
355
|
+
protected callbacks: Record<'on' | 'once', Callbacks<Events>>;
|
|
356
|
+
protected enabled: boolean;
|
|
357
|
+
protected debugMode: boolean;
|
|
358
|
+
debug(enable?: boolean): void;
|
|
359
|
+
/**
|
|
360
|
+
* Emits an event with the given data. Any listeners subscribed to this event will be invoked with the passed data.
|
|
361
|
+
*
|
|
362
|
+
* @param event - The event name to emit.
|
|
363
|
+
* @param data - The data associated with the event. Its type is dependent on the event name.
|
|
364
|
+
*/
|
|
365
|
+
emit<K extends keyof Events>(event: K, data: Events[K]): void;
|
|
366
|
+
/**
|
|
367
|
+
* Reflects the current emitter state. A disabled state indicates that the emitter wont call listeners until its functionality gets enabled again.
|
|
368
|
+
*/
|
|
369
|
+
get isEnabled(): boolean;
|
|
370
|
+
off<K extends keyof Events>(event: K, cb: Callback<Events, K>): void;
|
|
371
|
+
/**
|
|
372
|
+
* Subscribes a callback function to an event. The callback is invoked each time the event is emitted.
|
|
373
|
+
*
|
|
374
|
+
* @param event - The event name to listen to.
|
|
375
|
+
* @param cb - The callback function to be invoked when the event is emitted.
|
|
376
|
+
* @returns A function to unsubscribe the event listener.
|
|
377
|
+
*/
|
|
378
|
+
on<K extends keyof Events>(event: K, cb: Callback<Events, K>): UnSubscriber;
|
|
379
|
+
/**
|
|
380
|
+
* Subscribes a callback function to an event for a single occurrence. After the event is emitted once, the listener is automatically removed.
|
|
381
|
+
*
|
|
382
|
+
* @param event - The event name to listen to for a single occurrence.
|
|
383
|
+
* @param cb - The callback function to be invoked when the event is emitted.
|
|
384
|
+
* @returns A function to unsubscribe the event listener.
|
|
385
|
+
*/
|
|
386
|
+
once<K extends keyof Events>(event: K, cb: Callback<Events, K>): UnSubscriber;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
type Setter<T> = (prevState: T) => T;
|
|
390
|
+
type Selector<State, Selected> = (state: State) => Selected;
|
|
391
|
+
type Comparator<Selected> = (newSelection: Selected, previousSelection: Selected) => boolean;
|
|
392
|
+
declare function isSetter<T>(data: SetStateAction<T>): data is Setter<T>;
|
|
393
|
+
/**
|
|
394
|
+
* @private
|
|
395
|
+
*/
|
|
396
|
+
type EmitterState<Events extends Map> = {
|
|
397
|
+
[K in keyof Events]: Events[K];
|
|
398
|
+
};
|
|
399
|
+
/**
|
|
400
|
+
* Extends EventEmitter to manage and emit events with state persistence.
|
|
401
|
+
* This class allows emitting and listening to typed events while also keeping
|
|
402
|
+
* a state that can be accessed synchronously for each event.
|
|
403
|
+
*
|
|
404
|
+
* @param initialState - If given will be passed to subscriptions
|
|
405
|
+
*
|
|
406
|
+
* @template Events - A mapping of event names to their associated data types.
|
|
407
|
+
* @extends EventEmitter<Events>
|
|
408
|
+
*/
|
|
409
|
+
declare class StatefulEmitter<Events extends Map> extends EventEmitter<Events> {
|
|
410
|
+
protected state: EmitterState<Events>;
|
|
411
|
+
constructor(initialState?: Partial<Events>);
|
|
412
|
+
emit<K extends keyof Events>(event: K, data: Events[K]): void;
|
|
413
|
+
on<K extends keyof Events>(event: K, cb: Callback<Events, K>): UnSubscriber;
|
|
414
|
+
once<K extends keyof Events>(event: K, cb: Callback<Events, K>): UnSubscriber;
|
|
415
|
+
/**
|
|
416
|
+
* Retrieves the stored state for a given event
|
|
417
|
+
*/
|
|
418
|
+
getState<K extends keyof Events>(event: K): EmitterState<Events>[K];
|
|
419
|
+
/**
|
|
420
|
+
* Just an alias for emit, with the advantage that can be called with a callback as second parameter in which case behaves exactly as react's setState.
|
|
421
|
+
*/
|
|
422
|
+
setState<K extends keyof Events>(event: K, data: SetStateAction<Events[K]>): void;
|
|
423
|
+
/**
|
|
424
|
+
* Allows to consume an event stream as a real time updated state
|
|
425
|
+
*/
|
|
426
|
+
useState: <K extends keyof Events>(event: K) => EmitterState<Events>[K];
|
|
427
|
+
useStateSelector: <K extends keyof Events, Selected>(event: K, selector: Selector<Events[K], Selected>, comparator?: Comparator<Selected>) => Selected;
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
type BouncingMap<Events extends Map> = {
|
|
431
|
+
[K in keyof Events]: number;
|
|
432
|
+
};
|
|
433
|
+
declare const NullObject: unique symbol;
|
|
434
|
+
type ThrottlingMap<Events extends Map> = {
|
|
435
|
+
[K in keyof Events]: Events[K] | typeof NullObject;
|
|
436
|
+
};
|
|
437
|
+
type ThrottlingMarkers<Events extends Map> = {
|
|
438
|
+
[K in keyof Events]: boolean;
|
|
439
|
+
};
|
|
440
|
+
type DebounceOptions = Partial<{
|
|
441
|
+
timing: number;
|
|
442
|
+
}>;
|
|
443
|
+
type ThrottleOptions = Partial<{
|
|
444
|
+
emitOnStart?: boolean;
|
|
445
|
+
timing: number;
|
|
446
|
+
}>;
|
|
447
|
+
/**
|
|
448
|
+
* @public
|
|
449
|
+
*
|
|
450
|
+
* The BouncingEmitter class is an extension of EventEmitter which adds debouncing and throttling functionality.
|
|
451
|
+
*
|
|
452
|
+
* @typeParam — Events - An extension of Map where the key is the event name and the value is the type of data associated with that event.
|
|
453
|
+
*/
|
|
454
|
+
declare class BouncingEmitter<Events extends Map> extends StatefulEmitter<Events> {
|
|
455
|
+
protected bouncingTimeouts: BouncingMap<Events>;
|
|
456
|
+
protected defaultTiming: number;
|
|
457
|
+
/**
|
|
458
|
+
* Debounces a event emit with until there is no call to the emit methods by (timing)ms. Take the following event throttling, where each E is a call to this method and each character represents 20ms:
|
|
459
|
+
*
|
|
460
|
+
* E_E_E_E_E_E_E_E_E
|
|
461
|
+
*
|
|
462
|
+
* If timing is configured to 100ms, which is the default, the emission will occur as follows:
|
|
463
|
+
*
|
|
464
|
+
* _____________________E
|
|
465
|
+
*/
|
|
466
|
+
debounce<K extends keyof Events>(event: K, data: Events[K], configuration?: DebounceOptions): void;
|
|
467
|
+
/**
|
|
468
|
+
* Throttles a event emit with the warranty that the data will be emitted at most every (timing)ms. Take the following event throttling, where each E is a call to this method and each character represents 20ms:
|
|
469
|
+
*
|
|
470
|
+
* E_E_E_E_E_E_E_E_E
|
|
471
|
+
*
|
|
472
|
+
* If timing is configured to 100ms, which is the default, the emission will occur as follows:
|
|
473
|
+
*
|
|
474
|
+
* ____E____E____E______E
|
|
475
|
+
*
|
|
476
|
+
* @param configuration.emitOnStart - Emits an event on the first call to throttle when no pending throttle is stored. **If emitOnStart is true and an only call to throttle is made, it will emit an only event.**
|
|
477
|
+
*/
|
|
478
|
+
protected throttleData: ThrottlingMap<Events>;
|
|
479
|
+
protected throttleEmittedOnInit: ThrottlingMarkers<Events>;
|
|
480
|
+
throttle<K extends keyof Events>(event: K, data: Events[K], configuration?: ThrottleOptions): void;
|
|
481
|
+
/**
|
|
482
|
+
* This method is a mix between setState and debounce
|
|
483
|
+
*/
|
|
484
|
+
setStateDebounced<K extends keyof Events>(event: K, data: SetStateAction<Events[K]>, configuration?: DebounceOptions): void;
|
|
485
|
+
/**
|
|
486
|
+
* This method is a mix between setState and throttle
|
|
487
|
+
*/
|
|
488
|
+
setStateThrottled<K extends keyof Events>(event: K, data: SetStateAction<Events[K]>, configuration?: ThrottleOptions): void;
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
interface TFncParams {
|
|
492
|
+
type: 'V' | 'P' | 'E';
|
|
493
|
+
value?: string;
|
|
494
|
+
attId?: number;
|
|
495
|
+
}
|
|
496
|
+
type TApiaFormButton = {
|
|
497
|
+
onclick: string;
|
|
498
|
+
text: string;
|
|
499
|
+
id: string;
|
|
500
|
+
type: string;
|
|
501
|
+
};
|
|
502
|
+
interface TApiaSelectPossibleValue {
|
|
503
|
+
value: string | number;
|
|
504
|
+
label: string;
|
|
505
|
+
selected?: boolean;
|
|
506
|
+
}
|
|
507
|
+
interface TApiaMultiplePossibleValue {
|
|
508
|
+
value: string | number;
|
|
509
|
+
label: string;
|
|
510
|
+
selected?: boolean;
|
|
511
|
+
}
|
|
512
|
+
interface TApiaRadioPossibleValue {
|
|
513
|
+
value: string | number;
|
|
514
|
+
label: string;
|
|
515
|
+
selected?: boolean;
|
|
516
|
+
}
|
|
517
|
+
type TApiaPossibleValue = TApiaRadioPossibleValue & TApiaMultiplePossibleValue & TApiaSelectPossibleValue;
|
|
518
|
+
type TFieldEvent = 'onLoad' | 'onReload' | 'onSubmit' | 'onChange' | 'onModalReturn' | 'onClick' | 'onPopulate' | 'populate' | 'gridAdd' | 'gridSort' | 'gridSortUp' | 'gridSortDown' | 'gridDelete' | 'gridColumnSelect' | 'JSApiaUpdate' | 'onSubmit';
|
|
519
|
+
interface TFieldScriptEvent {
|
|
520
|
+
fncName: string;
|
|
521
|
+
evtName: Readonly<TFieldEvent>;
|
|
522
|
+
evtId: number | string;
|
|
523
|
+
fncParams: TFncParams[];
|
|
524
|
+
}
|
|
525
|
+
type TFieldScriptEvents = TFieldScriptEvent[];
|
|
526
|
+
interface TFieldServerEvent {
|
|
527
|
+
evtId: number;
|
|
528
|
+
evtName: Readonly<TFieldEvent>;
|
|
529
|
+
isAjax: boolean;
|
|
530
|
+
}
|
|
531
|
+
type TFieldServerEvents = TFieldServerEvent[];
|
|
532
|
+
interface TApiaFieldPropsObj {
|
|
533
|
+
alignment?: string;
|
|
534
|
+
alt?: string;
|
|
535
|
+
bold?: string;
|
|
536
|
+
checked?: boolean;
|
|
537
|
+
colspan?: number;
|
|
538
|
+
cssClass?: string;
|
|
539
|
+
disabled?: boolean;
|
|
540
|
+
docType?: string;
|
|
541
|
+
dontBreakRadio?: boolean;
|
|
542
|
+
fontColor?: string;
|
|
543
|
+
gridHeight?: number;
|
|
544
|
+
gridColTitle?: string;
|
|
545
|
+
gridTitle?: string;
|
|
546
|
+
height?: string;
|
|
547
|
+
hideAddButton?: boolean;
|
|
548
|
+
hideDelButton?: boolean;
|
|
549
|
+
hideDocMetadata?: boolean;
|
|
550
|
+
hideDocPermissions?: boolean;
|
|
551
|
+
hideGridButtons?: boolean;
|
|
552
|
+
hideIncludeButton?: boolean;
|
|
553
|
+
hideOrderButton?: boolean;
|
|
554
|
+
hideSignButtons?: boolean;
|
|
555
|
+
pagedGridSize?: number;
|
|
556
|
+
paged?: boolean;
|
|
557
|
+
includeFirstRow?: boolean;
|
|
558
|
+
imageUrl?: string;
|
|
559
|
+
inputAsText?: boolean;
|
|
560
|
+
isActuallyReadonly?: boolean;
|
|
561
|
+
multiselect?: boolean;
|
|
562
|
+
name?: string;
|
|
563
|
+
noPrint?: boolean;
|
|
564
|
+
readonly?: boolean;
|
|
565
|
+
readOnly?: boolean;
|
|
566
|
+
regExpMessage?: string;
|
|
567
|
+
reqSign?: boolean;
|
|
568
|
+
reqTrad?: boolean;
|
|
569
|
+
required?: boolean;
|
|
570
|
+
rowspan?: number;
|
|
571
|
+
selParent?: boolean;
|
|
572
|
+
size?: string;
|
|
573
|
+
storeMdlQryResult?: boolean;
|
|
574
|
+
tooltip?: string;
|
|
575
|
+
tooltipHelp?: boolean;
|
|
576
|
+
transient?: boolean;
|
|
577
|
+
underlined?: boolean;
|
|
578
|
+
url?: string;
|
|
579
|
+
value?: unknown;
|
|
580
|
+
updateValueWithoutSynchronize?: unknown;
|
|
581
|
+
valueColor?: string;
|
|
582
|
+
visibilityHidden?: boolean;
|
|
583
|
+
possibleValue?: TApiaSelectPossibleValue[] | TApiaSelectPossibleValue | TApiaRadioPossibleValue[] | TApiaMultiplePossibleValue[] | TApiaMultiplePossibleValue;
|
|
584
|
+
leafIcon?: string;
|
|
585
|
+
parentIcon?: string;
|
|
586
|
+
props?: string;
|
|
587
|
+
id?: string;
|
|
588
|
+
noLock?: boolean;
|
|
589
|
+
noErase?: boolean;
|
|
590
|
+
noModify?: boolean;
|
|
591
|
+
noDownload?: boolean;
|
|
592
|
+
allowEdition?: boolean;
|
|
593
|
+
hideDocDownload?: boolean;
|
|
594
|
+
qryId?: string;
|
|
595
|
+
startIndex?: number;
|
|
596
|
+
curPage?: number;
|
|
597
|
+
pages?: number;
|
|
598
|
+
rowCount?: number;
|
|
599
|
+
maxRecords?: number;
|
|
600
|
+
colWidth?: string;
|
|
601
|
+
gridForm?: string;
|
|
602
|
+
documentMonitorCus?: number;
|
|
603
|
+
fileCollapseFldStrc?: boolean;
|
|
604
|
+
fileCollapseMetadata?: boolean;
|
|
605
|
+
fileCollapsePermission?: boolean;
|
|
606
|
+
fileDefFolder?: number;
|
|
607
|
+
fileDntShwDocMdlOnDrop?: boolean;
|
|
608
|
+
fileExpDate?: boolean;
|
|
609
|
+
fileNoAllwDnD?: boolean;
|
|
610
|
+
fileNotShowDocMon?: boolean;
|
|
611
|
+
fileShowDesc?: boolean;
|
|
612
|
+
fileShwFoldTreeBtn?: boolean;
|
|
613
|
+
fileShwFoldTreeStr?: boolean;
|
|
614
|
+
oneClickUpload?: boolean;
|
|
615
|
+
fieldId?: string;
|
|
616
|
+
hasFinishedLoading?: boolean;
|
|
617
|
+
}
|
|
618
|
+
type TApiaFormElementOption = {
|
|
619
|
+
content: string;
|
|
620
|
+
value: string;
|
|
621
|
+
};
|
|
622
|
+
type TApiaFormElement = {
|
|
623
|
+
adtInfo?: string;
|
|
624
|
+
class: string;
|
|
625
|
+
disabled: boolean;
|
|
626
|
+
html: boolean;
|
|
627
|
+
id: string;
|
|
628
|
+
isADate: boolean;
|
|
629
|
+
mandatory: boolean;
|
|
630
|
+
maxlength?: string;
|
|
631
|
+
modalFunction?: string;
|
|
632
|
+
name: string;
|
|
633
|
+
normalWhiteSpace: boolean;
|
|
634
|
+
onChange: string;
|
|
635
|
+
options: {
|
|
636
|
+
option: TApiaFormElementOption | TApiaFormElementOption[];
|
|
637
|
+
};
|
|
638
|
+
readonly: boolean;
|
|
639
|
+
regExp?: string;
|
|
640
|
+
regExpMessage?: string;
|
|
641
|
+
selected: boolean;
|
|
642
|
+
size: string;
|
|
643
|
+
text: string;
|
|
644
|
+
title: string;
|
|
645
|
+
type: string;
|
|
646
|
+
value: string;
|
|
647
|
+
valueAsAttribute: boolean;
|
|
648
|
+
};
|
|
649
|
+
type TApiaLoadForm = {
|
|
650
|
+
form: {
|
|
651
|
+
closeOnSubmit: boolean;
|
|
652
|
+
multiPart: boolean;
|
|
653
|
+
ajaxNewPanel: boolean;
|
|
654
|
+
showErrors: boolean;
|
|
655
|
+
doEscape: boolean;
|
|
656
|
+
action: string;
|
|
657
|
+
onLoad: string;
|
|
658
|
+
ajaxsubmit: boolean;
|
|
659
|
+
closeAll: boolean;
|
|
660
|
+
title: string;
|
|
661
|
+
autoExpand: boolean;
|
|
662
|
+
titleClass: string;
|
|
663
|
+
addClass: string;
|
|
664
|
+
elements?: {
|
|
665
|
+
label: string;
|
|
666
|
+
element: TApiaFormElement | TApiaFormElement[];
|
|
667
|
+
};
|
|
668
|
+
buttons?: {
|
|
669
|
+
button: TApiaFormButton | TApiaFormButton[];
|
|
670
|
+
};
|
|
671
|
+
};
|
|
672
|
+
};
|
|
673
|
+
type TApiaFilterValue = string | number;
|
|
674
|
+
type TApiaFilterOption = {
|
|
675
|
+
label: string;
|
|
676
|
+
value: TApiaFilterValue;
|
|
677
|
+
selected?: boolean;
|
|
678
|
+
id?: string;
|
|
679
|
+
name?: string;
|
|
680
|
+
};
|
|
681
|
+
type TApiaFilter = {
|
|
682
|
+
asAdditional?: boolean;
|
|
683
|
+
column?: string;
|
|
684
|
+
currentValue: TApiaFilterValue;
|
|
685
|
+
deleteFiltersTimestamp?: number;
|
|
686
|
+
error?: string;
|
|
687
|
+
id: string | number;
|
|
688
|
+
isMeta?: boolean;
|
|
689
|
+
placeholder?: string;
|
|
690
|
+
runAutomatically?: boolean;
|
|
691
|
+
title?: string;
|
|
692
|
+
toolTip?: string;
|
|
693
|
+
detectOnChange?: boolean;
|
|
694
|
+
readonly?: boolean;
|
|
695
|
+
required?: boolean;
|
|
696
|
+
sortCombo?: boolean;
|
|
697
|
+
/**
|
|
698
|
+
* Con esta propiedad se permite agupar los filtros para mostrarlos en un
|
|
699
|
+
* panel especifico.
|
|
700
|
+
*/
|
|
701
|
+
group?: string;
|
|
702
|
+
options?: TApiaFilterOption[];
|
|
703
|
+
type?: 'date' | 'D' | 'S' | 'number' | 'N' | 'apiaNumber';
|
|
704
|
+
hide?: boolean;
|
|
705
|
+
hideToFilter?: boolean;
|
|
706
|
+
filterToId?: string;
|
|
707
|
+
filterToValue?: TApiaFilterValue;
|
|
708
|
+
isRange?: boolean;
|
|
709
|
+
};
|
|
710
|
+
|
|
711
|
+
interface TApiaAction {
|
|
712
|
+
toDo?: string;
|
|
713
|
+
param: string | string[];
|
|
714
|
+
}
|
|
715
|
+
interface TApiaActions {
|
|
716
|
+
action: TApiaAction | TApiaAction[];
|
|
717
|
+
}
|
|
718
|
+
interface TApiaMessage {
|
|
719
|
+
text: string;
|
|
720
|
+
label?: string;
|
|
721
|
+
}
|
|
722
|
+
type TApiaComplexCell = {
|
|
723
|
+
label: string;
|
|
724
|
+
classToAdd?: string;
|
|
725
|
+
isHTML?: boolean;
|
|
726
|
+
docName?: string;
|
|
727
|
+
forceTitle?: string;
|
|
728
|
+
[key: string]: unknown;
|
|
729
|
+
};
|
|
730
|
+
type TApiaCellDefinition = TApiaComplexCell | string;
|
|
731
|
+
type TApiaRowDefinition = {
|
|
732
|
+
'data-selected'?: boolean;
|
|
733
|
+
selected?: boolean;
|
|
734
|
+
dblclic: boolean;
|
|
735
|
+
id: string;
|
|
736
|
+
classToAdd?: string;
|
|
737
|
+
rowSeparator?: boolean;
|
|
738
|
+
suspended?: boolean;
|
|
739
|
+
unselectableTR?: boolean;
|
|
740
|
+
headName?: string;
|
|
741
|
+
isLocked?: boolean;
|
|
742
|
+
cell: TApiaCellDefinition | TApiaCellDefinition[];
|
|
743
|
+
boldType?: boolean;
|
|
744
|
+
'expired-doc': true;
|
|
745
|
+
};
|
|
746
|
+
type TApiaFunctionPageInfo = {
|
|
747
|
+
amount: string;
|
|
748
|
+
currentPage: string;
|
|
749
|
+
hasMore: boolean;
|
|
750
|
+
pageCount: string;
|
|
751
|
+
prefix: string;
|
|
752
|
+
reachedMax: boolean;
|
|
753
|
+
selectOnlyOne: boolean;
|
|
754
|
+
totalRecords: string;
|
|
755
|
+
orderType: 'desc' | '';
|
|
756
|
+
orderCol: number;
|
|
757
|
+
};
|
|
758
|
+
type TApiaSystemMessageObj<Structure = Record<string, unknown>> = Structure & {
|
|
759
|
+
onClose?: string;
|
|
760
|
+
sysMessages?: {
|
|
761
|
+
message: TApiaMessage | TApiaMessage[];
|
|
762
|
+
};
|
|
763
|
+
sysExceptions?: {
|
|
764
|
+
exception: TApiaMessage | TApiaMessage[];
|
|
765
|
+
};
|
|
766
|
+
exceptions?: {
|
|
767
|
+
exception: TApiaMessage | TApiaMessage[];
|
|
768
|
+
};
|
|
769
|
+
actions?: TApiaActions;
|
|
770
|
+
code?: unknown;
|
|
771
|
+
load?: Structure;
|
|
772
|
+
};
|
|
773
|
+
type TApiaTableFunction = {
|
|
774
|
+
result: {
|
|
775
|
+
pageInfo: TApiaFunctionPageInfo;
|
|
776
|
+
table?: {
|
|
777
|
+
row: TApiaRowDefinition | TApiaRowDefinition[];
|
|
778
|
+
};
|
|
779
|
+
};
|
|
780
|
+
};
|
|
781
|
+
type TApiaFunction<T = TApiaTableFunction, HasMessages = true> = HasMessages extends true ? {
|
|
782
|
+
function: {
|
|
783
|
+
dropLastMessage?: boolean;
|
|
784
|
+
name: string;
|
|
785
|
+
messages: T;
|
|
786
|
+
};
|
|
787
|
+
} : {
|
|
788
|
+
function: {
|
|
789
|
+
name: string;
|
|
790
|
+
} & T;
|
|
791
|
+
};
|
|
792
|
+
type TApiaLoadText = {
|
|
793
|
+
text: {
|
|
794
|
+
closeAll: boolean;
|
|
795
|
+
title: string;
|
|
796
|
+
addClass: string;
|
|
797
|
+
content: string;
|
|
798
|
+
};
|
|
799
|
+
};
|
|
800
|
+
type TApiaLoad<T extends Record<string, unknown> = TApiaLoadForm> = {
|
|
801
|
+
canClose: boolean;
|
|
802
|
+
type: string;
|
|
803
|
+
} & T;
|
|
804
|
+
interface TMessage {
|
|
805
|
+
text: string;
|
|
806
|
+
content?: string;
|
|
807
|
+
title?: string;
|
|
808
|
+
type?: string;
|
|
809
|
+
}
|
|
810
|
+
interface TNotificationMessage {
|
|
811
|
+
onClose?: string;
|
|
812
|
+
sysMessages?: {
|
|
813
|
+
message: TMessage | TMessage[];
|
|
814
|
+
};
|
|
815
|
+
sysExceptions?: {
|
|
816
|
+
exception: TMessage | TMessage[];
|
|
817
|
+
};
|
|
818
|
+
exceptions?: {
|
|
819
|
+
exception: TMessage | TMessage[];
|
|
820
|
+
};
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
type TId = string | number;
|
|
824
|
+
type TModify<T, R> = Omit<T, keyof R> & R;
|
|
825
|
+
type TMap$1<T> = Record<string | number, T>;
|
|
826
|
+
type TRequireOnlyOne<T, Keys extends keyof T = keyof T> = Pick<T, Exclude<keyof T, Keys>> & {
|
|
827
|
+
[K in Keys]-?: Required<Pick<T, K>> & Partial<Record<Exclude<Keys, K>, undefined>>;
|
|
828
|
+
}[Keys];
|
|
829
|
+
|
|
830
|
+
interface IFocusProps {
|
|
831
|
+
modalsContainerRetriever?: () => HTMLElement;
|
|
832
|
+
notificationsContainerRetriever?: () => HTMLElement;
|
|
833
|
+
}
|
|
834
|
+
interface IOnFocusConfiguration {
|
|
835
|
+
/**
|
|
836
|
+
* El controlador emite un evento custom cuando se realiza foco, con la
|
|
837
|
+
* intención de que los elementos colapsables se abran automáticamente. Si
|
|
838
|
+
* este parámetro es pasado con false, se evita ese comportamiento.
|
|
839
|
+
*/
|
|
840
|
+
dispatchCustomEvent?: boolean;
|
|
841
|
+
/**
|
|
842
|
+
* Cuando la pantalla está bloqueada con el spinner, el controlador no
|
|
843
|
+
* intentará hacer foco, a menos que este parámetro se pase en true.
|
|
844
|
+
*/
|
|
845
|
+
focusEvenWhenScreenLocked?: boolean;
|
|
846
|
+
scrollIntoViewOptions?: ScrollIntoViewOptions;
|
|
847
|
+
}
|
|
848
|
+
declare const notificationsSelector = ".notification";
|
|
849
|
+
/**
|
|
850
|
+
* Al método focus.on se le puede pasar o bien un HTMLElement o bien una
|
|
851
|
+
* función que implemente esta interfaz. Cuando se pasa una función, la misma
|
|
852
|
+
* será invocada cada vez que se vaya a intentar una acción de foco.
|
|
853
|
+
*
|
|
854
|
+
* Si la función devuelve un elemento HTML, se intentará hacer foco sobre éste.
|
|
855
|
+
*
|
|
856
|
+
* Si la función devuelve null, ese intento será tomado como nulo y se volverá
|
|
857
|
+
* a intentar luego del tiempo determinado.
|
|
858
|
+
*
|
|
859
|
+
* Si la función devuelve false, será eliminada de la cola de foco, lo que
|
|
860
|
+
* significa que ya no se intentará hacer foco sobre este elemento. En cambio,
|
|
861
|
+
* se continuará con los demás elementos de la cola o en caso de no haber
|
|
862
|
+
* ninguno, con el último elemento que tuvo foco y aún esté presente en el
|
|
863
|
+
* documento.
|
|
864
|
+
*/
|
|
865
|
+
type TFocusRetriever = (isLastTry: boolean) => HTMLElement | null | false;
|
|
866
|
+
interface IFocusQueryElement {
|
|
867
|
+
element: HTMLElement | TFocusRetriever;
|
|
868
|
+
configuration?: IOnFocusConfiguration;
|
|
869
|
+
}
|
|
870
|
+
declare global {
|
|
871
|
+
interface Window {
|
|
872
|
+
focusStatus: Record<string, unknown>;
|
|
873
|
+
}
|
|
874
|
+
}
|
|
875
|
+
interface IFocusCheck {
|
|
876
|
+
currentInstruction: number;
|
|
877
|
+
}
|
|
878
|
+
declare const focus: {
|
|
879
|
+
"__#5@#root": HTMLElement;
|
|
880
|
+
"__#5@#props": IFocusProps | undefined;
|
|
881
|
+
afterNotificationFocus: IFocusQueryElement | undefined;
|
|
882
|
+
"__#5@#actualFocusQuery": IFocusQueryElement[];
|
|
883
|
+
"__#5@#currentInstruction": number;
|
|
884
|
+
"__#5@#focusDelay": number;
|
|
885
|
+
"__#5@#focusRetries": number;
|
|
886
|
+
"__#5@#focusTimeout": number;
|
|
887
|
+
"__#5@#isIntervalRunning": boolean;
|
|
888
|
+
"__#5@#focusQuery": IFocusQueryElement[];
|
|
889
|
+
"__#5@#checkInstruction"(focusCheck: IFocusCheck): boolean;
|
|
890
|
+
"__#5@#doFocus"(HTMLElement: HTMLElement | TFocusRetriever, focusCheck: IFocusCheck, isLastTry: boolean, configuration?: IOnFocusConfiguration): Promise<false | HTMLElement | null>;
|
|
891
|
+
"__#5@#resetInterval"(): void;
|
|
892
|
+
"__#5@#runFocusInterval"(focusElement?: IFocusQueryElement, internalCall?: boolean): Promise<false | HTMLElement>;
|
|
893
|
+
/**
|
|
894
|
+
* Da la instrucción de colocar el foco en el elemento provisto como
|
|
895
|
+
* parámetro una vez que todas las notificaciones se hayan cerrado. En caso
|
|
896
|
+
* de no existir notificaciones abiertas, hace foco en el elemento
|
|
897
|
+
* directamente.
|
|
898
|
+
*/
|
|
899
|
+
afterNotifications(element: HTMLElement | TFocusRetriever, configuration?: IOnFocusConfiguration): void;
|
|
900
|
+
/**
|
|
901
|
+
* Da la instrucción de colocar el foco en el elemento provisto como
|
|
902
|
+
* parámetro luego de recargar la página.
|
|
903
|
+
*
|
|
904
|
+
* Los parámetros pasados serán ordenados en orden de importancia priorizando
|
|
905
|
+
* en el siguiente orden:
|
|
906
|
+
* - id
|
|
907
|
+
* - name
|
|
908
|
+
* - className
|
|
909
|
+
* - selector
|
|
910
|
+
*/
|
|
911
|
+
afterReload({ className, id, name, selector, }: TRequireOnlyOne<{
|
|
912
|
+
className: string;
|
|
913
|
+
id: string;
|
|
914
|
+
name: string;
|
|
915
|
+
selector: string;
|
|
916
|
+
}>): void;
|
|
917
|
+
/**
|
|
918
|
+
* Da la instrucción de colocar el foco el elemento pasado como parámetro.
|
|
919
|
+
* Se puede pasar también una función que devuelva HTMLElement | false |
|
|
920
|
+
* null.
|
|
921
|
+
*
|
|
922
|
+
* El segundo parámetro del método on es un objeto de tipo
|
|
923
|
+
* ScrollIntoViewOptions, que permite modificar el comportamiento del scroll
|
|
924
|
+
* a en el elemento.
|
|
925
|
+
*
|
|
926
|
+
* @see TFocusRetriever para más detalles sobre la función como parámetro.
|
|
927
|
+
*/
|
|
928
|
+
on(element: HTMLElement | TFocusRetriever, configuration?: IOnFocusConfiguration): Promise<false | HTMLElement>;
|
|
929
|
+
focusOnReload: string | null;
|
|
930
|
+
restore(): void;
|
|
931
|
+
init(): void;
|
|
932
|
+
};
|
|
933
|
+
|
|
934
|
+
/**
|
|
935
|
+
* The GlobalFocus helper keeps a list of the last focused elements and allows
|
|
936
|
+
* to retrieve the last focused element which matches against a query selector.
|
|
937
|
+
*/
|
|
938
|
+
declare const globalFocus: {
|
|
939
|
+
focused: (HTMLElement | TFocusRetriever)[];
|
|
940
|
+
"__#2@#onFocusCallbacks": (() => unknown)[];
|
|
941
|
+
offFocus(cb: () => unknown): void;
|
|
942
|
+
onFocus(cb: () => unknown): () => void;
|
|
943
|
+
inDocument(el: HTMLElement | TFocusRetriever): boolean;
|
|
944
|
+
focus: HTMLElement | TFocusRetriever;
|
|
945
|
+
readonly list: (HTMLElement | TFocusRetriever)[];
|
|
946
|
+
/**
|
|
947
|
+
* @param querySelector A query selector against which the element should match
|
|
948
|
+
* @returns The last HTMLElement if no querySelector argument provided or else, the last which matches
|
|
949
|
+
* against that query selector.
|
|
950
|
+
* */
|
|
951
|
+
last(querySelector?: string, omit?: number): HTMLElement | TFocusRetriever | null;
|
|
952
|
+
};
|
|
953
|
+
|
|
954
|
+
type THistoryCount = {
|
|
955
|
+
currentStep: number;
|
|
956
|
+
stepCount: number;
|
|
957
|
+
};
|
|
958
|
+
type THistoryStep<T> = {
|
|
959
|
+
content: T;
|
|
960
|
+
} & THistoryCount;
|
|
961
|
+
type THistoryStepChange<T> = THistoryCount & THistoryStep<T> & {
|
|
962
|
+
fromPush?: boolean;
|
|
963
|
+
hasPrevious: boolean;
|
|
964
|
+
hasNext: boolean;
|
|
965
|
+
};
|
|
966
|
+
type THistoryConfiguration = {
|
|
967
|
+
maxLength: number;
|
|
968
|
+
};
|
|
969
|
+
/**
|
|
970
|
+
* # Cómo usar el historial
|
|
971
|
+
*
|
|
972
|
+
* Es muy sencillo: se instancia con un callback que recibirá un método push
|
|
973
|
+
* cada vez que una ventana se cierre. En esos momentos, el usuario del History
|
|
974
|
+
* puede hacer push al estado.
|
|
975
|
+
*
|
|
976
|
+
* ## La mecánica
|
|
977
|
+
*
|
|
978
|
+
* - Instancio la clase y recibo el método push
|
|
979
|
+
* - Cuando se realizan cambios significativos, llamo al método openWindow
|
|
980
|
+
* - El método openWindow da una ventana de 350ms antes de llamar al callback
|
|
981
|
+
* - Si durante esa ventana se vuelve a llamar a openWindow, la ventana se
|
|
982
|
+
* resetea
|
|
983
|
+
* - Si al llamar al callback, se hace push al estado, ese estado es propagado
|
|
984
|
+
* mediante el hook y mediante el evento on('stepChange')
|
|
985
|
+
*
|
|
986
|
+
* ## Cómo escuchar cambios
|
|
987
|
+
*
|
|
988
|
+
* ```ts
|
|
989
|
+
* this.history.on('stepChange', (data) => {
|
|
990
|
+
if (!data.fromPush) this.update(data.content);
|
|
991
|
+
});
|
|
992
|
+
```
|
|
993
|
+
*
|
|
994
|
+
* ## Back y forward
|
|
995
|
+
*
|
|
996
|
+
* El back y forward son dos métodos del history que hacen un stepChange y
|
|
997
|
+
* emiten a través de on('stepChange') y el hook
|
|
998
|
+
*/
|
|
999
|
+
declare class History<T> extends EventEmitter<{
|
|
1000
|
+
stepChange: THistoryStepChange<T>;
|
|
1001
|
+
}> {
|
|
1002
|
+
private configuration;
|
|
1003
|
+
private autocloseTimeout;
|
|
1004
|
+
private currentStep;
|
|
1005
|
+
private content;
|
|
1006
|
+
private emitting;
|
|
1007
|
+
protected enabled: boolean;
|
|
1008
|
+
private _isOpen;
|
|
1009
|
+
private timeoutMs;
|
|
1010
|
+
constructor(onCloseWindow: (push: (newState: T) => void) => unknown, configuration?: THistoryConfiguration);
|
|
1011
|
+
private closeWindow;
|
|
1012
|
+
private getEvent;
|
|
1013
|
+
private onCloseWindow;
|
|
1014
|
+
private push;
|
|
1015
|
+
private shoutStepChange;
|
|
1016
|
+
hooks: {
|
|
1017
|
+
useCountChange: (onChange: (ev: THistoryStepChange<T>) => unknown) => void;
|
|
1018
|
+
};
|
|
1019
|
+
back: () => void;
|
|
1020
|
+
disable: () => void;
|
|
1021
|
+
emit<K extends 'stepChange'>(eventName: K, params?: THistoryStepChange<T>): void;
|
|
1022
|
+
enable: () => void;
|
|
1023
|
+
forward: () => void;
|
|
1024
|
+
get isOpen(): boolean;
|
|
1025
|
+
openWindow: () => void;
|
|
1026
|
+
reset: () => void;
|
|
1027
|
+
updateConfig: (newConfiguration: Partial<THistoryConfiguration>) => void;
|
|
1028
|
+
useStep: () => Pick<THistoryStepChange<T>, "hasNext" | "hasPrevious" | "currentStep">;
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1031
|
+
/**
|
|
1032
|
+
* Permite reasignar múltiples referencias desde un mismo componente.
|
|
1033
|
+
*
|
|
1034
|
+
* @example
|
|
1035
|
+
*
|
|
1036
|
+
* const ref1 = useRef(null)
|
|
1037
|
+
* const ref2 = useRef(null)
|
|
1038
|
+
*
|
|
1039
|
+
* const assignRefs = useMultipleRefs(ref1, ref2);
|
|
1040
|
+
*
|
|
1041
|
+
* return <Box ref={assignRefs} ...
|
|
1042
|
+
*/
|
|
1043
|
+
declare function useCombinedRefs<RefType = HTMLInputElement>(...refs: (React.ForwardedRef<unknown> | undefined)[]): React.Dispatch<React.SetStateAction<RefType | undefined>>;
|
|
1044
|
+
|
|
1045
|
+
declare const useDebouncedCallback: <Params extends any[]>(callback: (...params: Params) => unknown, { runWhenTriggered, timeout }?: {
|
|
1046
|
+
runWhenTriggered: boolean;
|
|
1047
|
+
timeout: number;
|
|
1048
|
+
}) => (...params: Params) => void;
|
|
1049
|
+
|
|
1050
|
+
/**
|
|
1051
|
+
* Este hook permite mantener un estado interno en un componente, al mismo tiempo que se escucha el estado externo a través de las props, permitiendo la edición del valor en forma interna, a la vez que se permite su definición desde los padres del componente.
|
|
1052
|
+
*
|
|
1053
|
+
* Es útil especialmente en campos de tipo input en los cuales es deseable permitir al usuario escribir libremente, y luego de validada la entrada, establecer un valor diferente para mostrar.
|
|
1054
|
+
*/
|
|
1055
|
+
declare function useIntermediateValue<T>(currentValue: T): [T, Dispatch<SetStateAction<T>>];
|
|
1056
|
+
|
|
1057
|
+
/**
|
|
1058
|
+
* Devuelve una referencia que mantiene siempre el último valor del elemento
|
|
1059
|
+
* pasado, es especialmente útil para acceder a valores del componente desde
|
|
1060
|
+
* dentro de efectos.
|
|
1061
|
+
*
|
|
1062
|
+
* *Investigar qué es 'react stale state'*
|
|
1063
|
+
*/
|
|
1064
|
+
declare function useLatest<T>(value: T): React.MutableRefObject<T>;
|
|
1065
|
+
|
|
1066
|
+
declare function useMount(effect: EffectCallback): void;
|
|
1067
|
+
|
|
1068
|
+
declare function useUnmount(unmountCallback: () => void): void;
|
|
1069
|
+
|
|
1070
|
+
declare function usePrevious<T>(value: T): React.MutableRefObject<T | undefined>;
|
|
1071
|
+
|
|
1072
|
+
declare function useStateRef<T>(initialState?: T): [
|
|
1073
|
+
typeof initialState extends undefined ? T | undefined : T,
|
|
1074
|
+
Dispatch<SetStateAction<typeof initialState extends undefined ? T | undefined : T>>,
|
|
1075
|
+
MutableRefObject<typeof initialState extends undefined ? T | undefined : T>
|
|
1076
|
+
];
|
|
1077
|
+
|
|
1078
|
+
/**
|
|
1079
|
+
* Este hook es una simplificación de la dinámica de suscripción con cambio de
|
|
1080
|
+
* estado ante eventos.
|
|
1081
|
+
*
|
|
1082
|
+
* @example
|
|
1083
|
+
*
|
|
1084
|
+
* useIsAfter = (id: string) => {
|
|
1085
|
+
return useSubscription({
|
|
1086
|
+
getInitialState: () => {
|
|
1087
|
+
return { isAfter: this.#isAfter(id), isBefore: this.#isBefore(id) };
|
|
1088
|
+
},
|
|
1089
|
+
makeSubscription: (setState) => {
|
|
1090
|
+
return this.#emitter.on('hover', () => {
|
|
1091
|
+
setState({
|
|
1092
|
+
isAfter: this.#isAfter(id),
|
|
1093
|
+
isBefore: this.#isBefore(id),
|
|
1094
|
+
});
|
|
1095
|
+
});
|
|
1096
|
+
},
|
|
1097
|
+
});
|
|
1098
|
+
};
|
|
1099
|
+
*/
|
|
1100
|
+
declare function useSubscription<T>({ getInitialState, makeSubscription, }: {
|
|
1101
|
+
getInitialState?: (() => T) | (() => () => T);
|
|
1102
|
+
makeSubscription: (setState: Dispatch<SetStateAction<T>>) => () => void;
|
|
1103
|
+
}): T;
|
|
1104
|
+
|
|
1105
|
+
/**
|
|
1106
|
+
* Este hook se comporta igual que useEffect, con la diferencia de que en el
|
|
1107
|
+
* primer renderizado no se va a ejecutar.
|
|
1108
|
+
*/
|
|
1109
|
+
declare function useUpdateEffect(effect: EffectCallback, deps?: DependencyList): void;
|
|
1110
|
+
|
|
1111
|
+
declare function shallowEqual(a: unknown, b: unknown): boolean;
|
|
1112
|
+
/**
|
|
1113
|
+
* Compara con shallowEqual todos los ítems de dos arrays
|
|
1114
|
+
*/
|
|
1115
|
+
declare function shallowCompareArrays(a: unknown[], b: unknown[]): boolean;
|
|
1116
|
+
declare function useShallowMemo<T>(creator: () => T, deps: unknown[]): T;
|
|
1117
|
+
|
|
1118
|
+
declare function useWhyUpdated(label: any, e: Record<string, any>): void;
|
|
1119
|
+
|
|
1120
|
+
type TMethod<CR> = CR extends (state: any, ...args: infer Action) => any ? (id: TId, ...args: Action) => unknown : () => unknown;
|
|
1121
|
+
type TMethods<State extends TMap, K extends any[] = any[]> = Record<string, (setState: TStateManager<State>, ...args: K) => void>;
|
|
1122
|
+
type TMethodsMap<OriginalMethods extends TMethods<any>> = {
|
|
1123
|
+
[Name in keyof OriginalMethods]: TMethod<OriginalMethods[Name]>;
|
|
1124
|
+
};
|
|
1125
|
+
type TEventsMap<OriginalEvents extends TMap> = {
|
|
1126
|
+
[Name in keyof OriginalEvents]: (args: OriginalEvents[Name]) => unknown;
|
|
1127
|
+
};
|
|
1128
|
+
type TEventsHandlers<OriginalEvents extends TMap> = Record<TId, {
|
|
1129
|
+
[Name in keyof OriginalEvents]?: {
|
|
1130
|
+
cb: (args?: OriginalEvents[Name]) => unknown;
|
|
1131
|
+
uniqueHookId: string;
|
|
1132
|
+
}[];
|
|
1133
|
+
}>;
|
|
1134
|
+
type TMap = Record<string, any>;
|
|
1135
|
+
type TStateManager<State> = (newState: Partial<State>) => void;
|
|
1136
|
+
type TFireEvent<Events extends TMap> = <K extends keyof Events>(id: TId, ev: K, args: Events[K] extends void ? undefined : Events[K]) => void;
|
|
1137
|
+
|
|
1138
|
+
/**
|
|
1139
|
+
* Permite la creación de componentes multi-instancia que ofrecen métodos para
|
|
1140
|
+
* trabajar sobre su estado o su comportamiento interno.
|
|
1141
|
+
*
|
|
1142
|
+
* @example
|
|
1143
|
+
* const [methods, events, Imperative] = makeImperativeComponent<
|
|
1144
|
+
{
|
|
1145
|
+
age: number;
|
|
1146
|
+
},
|
|
1147
|
+
{ blink: number }
|
|
1148
|
+
>()(
|
|
1149
|
+
{} as {
|
|
1150
|
+
name: string;
|
|
1151
|
+
},
|
|
1152
|
+
{
|
|
1153
|
+
setName(setState, name: string) {
|
|
1154
|
+
setState({ name });
|
|
1155
|
+
},
|
|
1156
|
+
},
|
|
1157
|
+
({ age, name, useEvents }) => {
|
|
1158
|
+
const [isBlinking, setIsBlinking] = useState(false);
|
|
1159
|
+
|
|
1160
|
+
useEvents({
|
|
1161
|
+
blink() {
|
|
1162
|
+
setInterval(() => setIsBlinking((current) => !current), 300);
|
|
1163
|
+
},
|
|
1164
|
+
});
|
|
1165
|
+
|
|
1166
|
+
return (
|
|
1167
|
+
<Box sx={{ background: isBlinking ? 'red' : undefined }}>
|
|
1168
|
+
{age} {name}
|
|
1169
|
+
</Box>
|
|
1170
|
+
);
|
|
1171
|
+
},
|
|
1172
|
+
);
|
|
1173
|
+
|
|
1174
|
+
methods
|
|
1175
|
+
*/
|
|
1176
|
+
declare function makeImperativeComponent<ComponentProps extends TMap, Events extends TMap = TMap>(): <State extends TMap, Methods extends TMethods<State>>({ Component, initialState, methods, }: {
|
|
1177
|
+
initialState?: State | undefined;
|
|
1178
|
+
methods?: Methods | undefined;
|
|
1179
|
+
Component: FC<Omit<ComponentProps, 'id'> & State>;
|
|
1180
|
+
}) => [
|
|
1181
|
+
TMethodsMap<Methods>,
|
|
1182
|
+
TFireEvent<Events>,
|
|
1183
|
+
FC<ComponentProps & {
|
|
1184
|
+
id: TId;
|
|
1185
|
+
}>
|
|
1186
|
+
];
|
|
1187
|
+
|
|
1188
|
+
type TSingleMethodsMap<Methods extends TMethods<any>, MethodsMap extends TMethodsMap<Methods>> = {
|
|
1189
|
+
[Name in keyof MethodsMap]: MethodsMap[Name] extends (id: TId, ...args: infer Action) => unknown ? (...args: Action) => unknown : never;
|
|
1190
|
+
};
|
|
1191
|
+
declare function makeSingleImperativeComponent<ComponentProps extends TMap, Events extends TMap = TMap>(): <State extends TMap, Methods extends TMethods<State>>({ initialState, methods, Component, }: {
|
|
1192
|
+
initialState?: State | undefined;
|
|
1193
|
+
methods?: Methods | undefined;
|
|
1194
|
+
Component: FC<Omit<ComponentProps, 'id'> & State>;
|
|
1195
|
+
}) => [TSingleMethodsMap<Methods, TMethodsMap<Methods>>, <K extends keyof Events>(ev: K, args: Events[K]) => void, FC<ComponentProps>];
|
|
1196
|
+
|
|
1197
|
+
declare const useImperativeComponentEvents: <Events extends TMap = TMap>(handlers: Partial<TEventsMap<Events>>) => string;
|
|
1198
|
+
|
|
1199
|
+
/**
|
|
1200
|
+
* Permite el uso de eventos en herederos directos o no del imperativeComponent
|
|
1201
|
+
* más cercano.
|
|
1202
|
+
*/
|
|
1203
|
+
declare function useImperativeComponentContext<Events extends TMap = TMap>(): {
|
|
1204
|
+
id: TId;
|
|
1205
|
+
eventsStore: TEventsHandlers<Events>;
|
|
1206
|
+
};
|
|
1207
|
+
|
|
1208
|
+
/**
|
|
1209
|
+
* Dado un nombre de etiqueta, devuelve el texto que esa etiqueta contiene en
|
|
1210
|
+
* el idioma actual. En este momento, lo único que hace realmente esta función
|
|
1211
|
+
* es devolver la variable del window con el mismo nombre que se está
|
|
1212
|
+
* pidiendo.
|
|
1213
|
+
*
|
|
1214
|
+
* La idea de implementar esta función, es que en un futuro la fuente de la
|
|
1215
|
+
* que provienen las labels pueda ser más diversa.
|
|
1216
|
+
*
|
|
1217
|
+
* Permite el pasaje de tokens para el reemplazo automático de los mismos.
|
|
1218
|
+
*
|
|
1219
|
+
* @example
|
|
1220
|
+
*
|
|
1221
|
+
* // Suponemos la etiqueta msgUsu = { text: 'Usuario <TOK1>', title: 'Usuario <TOK1>' }
|
|
1222
|
+
*
|
|
1223
|
+
* getLabel('msgUsu' , {
|
|
1224
|
+
* text: {
|
|
1225
|
+
* TOK1: 'admin',
|
|
1226
|
+
* },
|
|
1227
|
+
* title: {
|
|
1228
|
+
* TOK1: 'no disponible',
|
|
1229
|
+
* }
|
|
1230
|
+
* })
|
|
1231
|
+
*/
|
|
1232
|
+
declare function getLabel(name: string, replaceTokens?: {
|
|
1233
|
+
text?: Record<string, string>;
|
|
1234
|
+
title?: Record<string, string>;
|
|
1235
|
+
}): {
|
|
1236
|
+
text: string;
|
|
1237
|
+
tooltip: string;
|
|
1238
|
+
};
|
|
1239
|
+
|
|
1240
|
+
/**
|
|
1241
|
+
* Da formato a un mensaje con tokens incrustados.
|
|
1242
|
+
*
|
|
1243
|
+
* @example
|
|
1244
|
+
*
|
|
1245
|
+
* // Dado el siguiente mensaje:
|
|
1246
|
+
* var msg = 'El campo <TOK1> es inválido.';
|
|
1247
|
+
*
|
|
1248
|
+
* console.log(formatMessage(msg, {
|
|
1249
|
+
* TOK1: 'nombre',
|
|
1250
|
+
* }));
|
|
1251
|
+
* // Imprime: El campo nombre es inválido.
|
|
1252
|
+
*/
|
|
1253
|
+
declare const formatMessage: (str: string, obj: {
|
|
1254
|
+
[key: string]: string;
|
|
1255
|
+
}) => string;
|
|
1256
|
+
|
|
1257
|
+
interface ISetBoundary {
|
|
1258
|
+
number?: number | string;
|
|
1259
|
+
min?: number;
|
|
1260
|
+
max?: number;
|
|
1261
|
+
loop?: boolean;
|
|
1262
|
+
}
|
|
1263
|
+
/**
|
|
1264
|
+
* Añade límites a un número, impidiendo que sea
|
|
1265
|
+
* inferior o superior a los límites establecidos.
|
|
1266
|
+
*
|
|
1267
|
+
* Si se pasa loop en true, al llegar al valor maximo o minimo regresara al
|
|
1268
|
+
* minimo o maximo respectivamente.
|
|
1269
|
+
*/
|
|
1270
|
+
declare function addBoundary(num: number, min: number, max?: number, loop?: boolean): number;
|
|
1271
|
+
declare function addBoundary(definition: ISetBoundary): number;
|
|
1272
|
+
/**
|
|
1273
|
+
* Esta función acepta un número y devuelve la representaciíon
|
|
1274
|
+
* en string de su tamaño en disco. Ej: 1024 => 1kb
|
|
1275
|
+
*/
|
|
1276
|
+
declare function parseAsSize(num: number): string;
|
|
1277
|
+
/**
|
|
1278
|
+
* Toma cualquier valor y devuelve siempre un número. En caso de que el valor
|
|
1279
|
+
* casteado con la función Number(value) de NaN, devuelve defaultReturn, que por
|
|
1280
|
+
* defecto es 0
|
|
1281
|
+
*/
|
|
1282
|
+
declare function noNaN(number: unknown, defaultReturn?: number): number;
|
|
1283
|
+
|
|
1284
|
+
/**
|
|
1285
|
+
* Este método itera sobre un objeto hasta encontrar la ruta especificada
|
|
1286
|
+
*
|
|
1287
|
+
* @example
|
|
1288
|
+
*
|
|
1289
|
+
const obj = {
|
|
1290
|
+
a: {
|
|
1291
|
+
b: {
|
|
1292
|
+
c: {
|
|
1293
|
+
d: "d"
|
|
1294
|
+
}
|
|
1295
|
+
}
|
|
1296
|
+
}
|
|
1297
|
+
};
|
|
1298
|
+
|
|
1299
|
+
console.log(getValueByPath(obj,'a.b.c')) // { d: 'd' }
|
|
1300
|
+
console.log(getValueByPath(obj,'a.b.c.d')) // 'd'
|
|
1301
|
+
*
|
|
1302
|
+
*/
|
|
1303
|
+
declare function getValueByPath(obj: Record<string, unknown>, path: string | string[], separator?: string): unknown;
|
|
1304
|
+
|
|
1305
|
+
/**
|
|
1306
|
+
* Permite escribir una propiedad en un objeto, en una ruta especificada. Si
|
|
1307
|
+
* dicha ruta no existe dentro del objeto la crea, siempre que sea posible. No
|
|
1308
|
+
* será posible en caso de que alguno de los elementos de la ruta contenga una
|
|
1309
|
+
* propiedad que no sea de tipo objeto.
|
|
1310
|
+
*
|
|
1311
|
+
* @param obj El objeto donde se desea escribir la propiedad
|
|
1312
|
+
* @param path La ruta en la que se va a escribir
|
|
1313
|
+
* @param value El valor que se va a escribir en la ruta especificada
|
|
1314
|
+
* @returns Un objeto idéntico del recibido pero co nlos cambios aplicados
|
|
1315
|
+
*
|
|
1316
|
+
* @throws { Error } En caso de que la ruta especificada contenga algún elemento que no puede ser escrito.
|
|
1317
|
+
*
|
|
1318
|
+
* @example
|
|
1319
|
+
*
|
|
1320
|
+
* const a = {
|
|
1321
|
+
* a: {}
|
|
1322
|
+
* };
|
|
1323
|
+
*
|
|
1324
|
+
* setValueByPath(a, 'a.b.c', 'Hello world');
|
|
1325
|
+
* /* Outputs:
|
|
1326
|
+
* {
|
|
1327
|
+
* a: {
|
|
1328
|
+
* b: {
|
|
1329
|
+
* c: 'Hello world'
|
|
1330
|
+
* }
|
|
1331
|
+
* }
|
|
1332
|
+
* }
|
|
1333
|
+
*/
|
|
1334
|
+
declare function setValueByPath(obj: Record<string, unknown>, path: string, value: unknown): Record<string, unknown> | null;
|
|
1335
|
+
|
|
1336
|
+
type TProperties = Record<string, unknown>;
|
|
1337
|
+
type TPropsSuscriptor<PropsType extends Record<string, unknown> = TProperties> = (props: PropsType, urgent?: boolean) => unknown;
|
|
1338
|
+
type TPropsSelector<Selected = any, PropsType = TProperties> = (props: PropsType) => Selected;
|
|
1339
|
+
/**
|
|
1340
|
+
* La función comparadora debe devolver true cuando
|
|
1341
|
+
* los elementos son iguales o false cuando son
|
|
1342
|
+
* distintos.
|
|
1343
|
+
*/
|
|
1344
|
+
type TPropsComparator<Selected> = (prevProps: Selected | undefined, newProps: Selected | undefined) => boolean;
|
|
1345
|
+
type TPropsConfiguration<Selected, PropsType extends Record<string, unknown> = TProperties> = {
|
|
1346
|
+
selector?: TPropsSelector<Selected, PropsType>;
|
|
1347
|
+
comparator?: TPropsComparator<Selected>;
|
|
1348
|
+
initialValue?: Selected;
|
|
1349
|
+
propsStore?: PropsStore<PropsType>;
|
|
1350
|
+
};
|
|
1351
|
+
type TUpdateFieldConfiguration = Partial<{
|
|
1352
|
+
noEmit: boolean;
|
|
1353
|
+
isUrgent: boolean;
|
|
1354
|
+
}>;
|
|
1355
|
+
|
|
1356
|
+
declare const PropsSelectorUndefinedObject: {};
|
|
1357
|
+
interface IPropsStoreConf {
|
|
1358
|
+
logCommands: {
|
|
1359
|
+
propsStore?: string;
|
|
1360
|
+
updateProp?: string;
|
|
1361
|
+
propsSuscriptors?: string;
|
|
1362
|
+
propsLog?: string;
|
|
1363
|
+
};
|
|
1364
|
+
}
|
|
1365
|
+
declare class PropsStore<PropsType extends Record<TId, unknown> = Record<TId, unknown>> {
|
|
1366
|
+
private configuration?;
|
|
1367
|
+
log: unknown;
|
|
1368
|
+
fields: Record<TId, PropsType>;
|
|
1369
|
+
suscriptors: Record<TId, TPropsSuscriptor<PropsType>[]>;
|
|
1370
|
+
loggers: Record<string, (props: unknown[]) => void>;
|
|
1371
|
+
constructor(configuration?: IPropsStoreConf | undefined);
|
|
1372
|
+
destructor(): void;
|
|
1373
|
+
getAllFields(): Record<TId, PropsType>;
|
|
1374
|
+
/**
|
|
1375
|
+
* Devuelve los props actuales de un campo.
|
|
1376
|
+
*/
|
|
1377
|
+
getFieldProps<ParsedPropsType = PropsType>(fieldId: TId): ParsedPropsType;
|
|
1378
|
+
removeField(fieldId: TId): void;
|
|
1379
|
+
/**
|
|
1380
|
+
* Permite establecer un suscriptor que será llamado
|
|
1381
|
+
* cada vez que las props del campo especificado cambien.
|
|
1382
|
+
*/
|
|
1383
|
+
suscribe(fieldId: TId, callback: TPropsSuscriptor<PropsType>): () => void;
|
|
1384
|
+
/**
|
|
1385
|
+
* Actualiza o crea las props de un campo.
|
|
1386
|
+
*
|
|
1387
|
+
* La tercera prop está relacionada
|
|
1388
|
+
*/
|
|
1389
|
+
updateField<NewPropsType extends Record<TId, unknown> = Partial<PropsType>>(fieldId: TId, props: Partial<NewPropsType>, conf?: TUpdateFieldConfiguration): void;
|
|
1390
|
+
}
|
|
1391
|
+
declare const propsStore: PropsStore<TProperties>;
|
|
1392
|
+
|
|
1393
|
+
declare function isPropsConfigurationObject<Selected, PropsType extends Record<string, unknown> = TProperties>(value?: TPropsSelector<Selected, PropsType> | TPropsConfiguration<Selected, PropsType>): value is TPropsConfiguration<Selected, PropsType>;
|
|
1394
|
+
/**
|
|
1395
|
+
*
|
|
1396
|
+
* Este hook permite escuchar los cambios en las propiedades
|
|
1397
|
+
* de un campo en particular.
|
|
1398
|
+
*
|
|
1399
|
+
* @param configuration
|
|
1400
|
+
* Este objeto permite pasar las siguientes propiedades para ser
|
|
1401
|
+
* determinar el comportamiento del hook:
|
|
1402
|
+
*
|
|
1403
|
+
* **selector:** La función selectora es una función equivalente
|
|
1404
|
+
* a la que se utiliza en el useAppSelector de redux. Con ella
|
|
1405
|
+
* se puede seleccionar una porción de las props, evitando
|
|
1406
|
+
* re-renderizados innecesarios. Esto se debe a que el renderizado
|
|
1407
|
+
* solamente ocurrirá cuando la función selectora devuelva un valor
|
|
1408
|
+
* que sea distinto del anterior.
|
|
1409
|
+
*
|
|
1410
|
+
* El concepto de distinto es: si existe una función comparadora,
|
|
1411
|
+
* se determinará mediante la ejecución de dicha función, a la que
|
|
1412
|
+
* se le pasan como parámetros el objeto anterior y el nuevo.
|
|
1413
|
+
*
|
|
1414
|
+
* En caso de que no haya función comparadora, se comparará que
|
|
1415
|
+
* las props seleccionadas y las nuevas sean exactamente las mismas
|
|
1416
|
+
* (la referencia al mismo objeto).
|
|
1417
|
+
*
|
|
1418
|
+
* **comparator:** La función comparadora de la que estamos
|
|
1419
|
+
* hablando.
|
|
1420
|
+
*
|
|
1421
|
+
* **initialValue:** Un valor para setearlo al inicio, el mismo
|
|
1422
|
+
* solamente será seteado en caso de que ya no exista un valor
|
|
1423
|
+
* en el store.
|
|
1424
|
+
* @returns
|
|
1425
|
+
*/
|
|
1426
|
+
declare function usePropsSelector<Selected = TProperties, PropsType extends Record<string, unknown> = TProperties>(fieldId: TId, configuration?: TPropsConfiguration<Selected, PropsType>): Selected;
|
|
1427
|
+
/**
|
|
1428
|
+
*
|
|
1429
|
+
* Este hook permite escuchar los cambios en las propiedades
|
|
1430
|
+
* de un campo en particular.
|
|
1431
|
+
*
|
|
1432
|
+
* @param selector La función selectora es una función equivalente
|
|
1433
|
+
* a la que se utiliza en el useAppSelector de redux. Con ella
|
|
1434
|
+
* se puede seleccionar una porción de las props, evitando
|
|
1435
|
+
* re-renderizados innecesarios. Esto se debe a que el renderizado
|
|
1436
|
+
* solamente ocurrirá cuando la función selectora devuelva un valor
|
|
1437
|
+
* que sea distinto del anterior.
|
|
1438
|
+
*
|
|
1439
|
+
* El concepto de distinto es: si existe una función comparadora,
|
|
1440
|
+
* se determinará mediante la ejecución de dicha función, a la que
|
|
1441
|
+
* se le pasan como parámetros el objeto anterior y el nuevo.
|
|
1442
|
+
*
|
|
1443
|
+
* En caso de que no haya función comparadora, se comparará que
|
|
1444
|
+
* las props seleccionadas y las nuevas sean exactamente las mismas
|
|
1445
|
+
* (la referencia al mismo objeto).
|
|
1446
|
+
*
|
|
1447
|
+
* @param comparator La función comparadora de la que estamos
|
|
1448
|
+
* hablando.
|
|
1449
|
+
*
|
|
1450
|
+
* @returns
|
|
1451
|
+
*/
|
|
1452
|
+
declare function usePropsSelector<Selected = TProperties, PropsType extends Record<string, unknown> = TProperties>(fieldId: TId, selector?: TPropsSelector<Selected, PropsType> | TPropsConfiguration<Selected, PropsType>, comparator?: TPropsComparator<Selected>, anotherPropsStore?: PropsStore<PropsType>): Selected;
|
|
1453
|
+
|
|
1454
|
+
/**
|
|
1455
|
+
* El hook useDomState permite aplicar propiedades a un
|
|
1456
|
+
* elemento del DOM de la forma más eficiente posible.
|
|
1457
|
+
*
|
|
1458
|
+
* Este hook no permite el uso de sx ya que por las características
|
|
1459
|
+
* del sx, el re-renderizado es necesario.
|
|
1460
|
+
*
|
|
1461
|
+
* @example
|
|
1462
|
+
*
|
|
1463
|
+
*
|
|
1464
|
+
* const TestComponent = () => {
|
|
1465
|
+
const { domProps, setDomProps } = useDomState<BoxProps>({
|
|
1466
|
+
style: {
|
|
1467
|
+
position: 'fixed',
|
|
1468
|
+
left: 0,
|
|
1469
|
+
top: 0,
|
|
1470
|
+
width: '150px',
|
|
1471
|
+
height: '150px',
|
|
1472
|
+
backgroundColor: '#ccc',
|
|
1473
|
+
},
|
|
1474
|
+
});
|
|
1475
|
+
const initialPosition = React.useRef({ boxX: 0, boxY: 0, x: 0, y: 0 });
|
|
1476
|
+
const isDragging = React.useRef(false);
|
|
1477
|
+
const [state, setState] = React.useState(1);
|
|
1478
|
+
|
|
1479
|
+
React.useEffect(() => {
|
|
1480
|
+
const move = (ev: MouseEvent) => {
|
|
1481
|
+
if (isDragging.current) {
|
|
1482
|
+
const moveX = ev.clientX - initialPosition.current.x;
|
|
1483
|
+
const moveY = ev.clientY - initialPosition.current.y;
|
|
1484
|
+
const newLeft = initialPosition.current.boxX + moveX;
|
|
1485
|
+
const newTop = initialPosition.current.boxY + moveY;
|
|
1486
|
+
setDomProps({
|
|
1487
|
+
style: {
|
|
1488
|
+
left: `${newLeft}px`,
|
|
1489
|
+
top: `${newTop}px`,
|
|
1490
|
+
},
|
|
1491
|
+
});
|
|
1492
|
+
}
|
|
1493
|
+
};
|
|
1494
|
+
|
|
1495
|
+
const removeSuscription = () => {
|
|
1496
|
+
isDragging.current = false;
|
|
1497
|
+
};
|
|
1498
|
+
|
|
1499
|
+
document.addEventListener('mousemove', move);
|
|
1500
|
+
document.addEventListener('mouseup', removeSuscription);
|
|
1501
|
+
|
|
1502
|
+
return () => {
|
|
1503
|
+
document.removeEventListener('mousemove', move);
|
|
1504
|
+
document.removeEventListener('mouseup', removeSuscription);
|
|
1505
|
+
};
|
|
1506
|
+
}, [setDomProps]);
|
|
1507
|
+
|
|
1508
|
+
return (
|
|
1509
|
+
<Box
|
|
1510
|
+
{...domProps}
|
|
1511
|
+
onMouseDown={(ev) => {
|
|
1512
|
+
initialPosition.current = {
|
|
1513
|
+
boxX: Number.parseInt(domProps.style?.left as string, 10),
|
|
1514
|
+
boxY: Number.parseInt(domProps.style?.top as string, 10),
|
|
1515
|
+
x: ev.clientX,
|
|
1516
|
+
y: ev.clientY,
|
|
1517
|
+
};
|
|
1518
|
+
isDragging.current = true;
|
|
1519
|
+
}}
|
|
1520
|
+
>
|
|
1521
|
+
Esta caja es arrastrable. Renderizados: {state}
|
|
1522
|
+
<Button onClick={() => setState((current) => current + 1)}>
|
|
1523
|
+
Renderizar
|
|
1524
|
+
</Button>
|
|
1525
|
+
</Box>
|
|
1526
|
+
);
|
|
1527
|
+
};
|
|
1528
|
+
*/
|
|
1529
|
+
declare function useDomState<T extends HTMLAttributes<HTMLElement>>(initialDomProps?: T): {
|
|
1530
|
+
domProps: T & {
|
|
1531
|
+
ref: (el: HTMLElement) => void;
|
|
1532
|
+
};
|
|
1533
|
+
setDomProps: ({ style, ...newDomProps }: Partial<T>) => void;
|
|
1534
|
+
};
|
|
1535
|
+
|
|
1536
|
+
/**
|
|
1537
|
+
* Permite manejar un estado que se actualizará únicamente siguiendo el
|
|
1538
|
+
* comportamiento esperado de un debounce
|
|
1539
|
+
*/
|
|
1540
|
+
declare function useDebouncedState<T>(timeout: number, initialState?: T): [T | undefined, (state: SetStateAction<T>, immediate?: boolean) => unknown];
|
|
1541
|
+
|
|
1542
|
+
declare class ScreenLocker extends EventEmitter<{
|
|
1543
|
+
forcedStateChange: {
|
|
1544
|
+
hasReleasedFirstTime: boolean;
|
|
1545
|
+
isForced: boolean;
|
|
1546
|
+
};
|
|
1547
|
+
lockStateChange: {
|
|
1548
|
+
hasReleasedFirstTime: boolean;
|
|
1549
|
+
isLocked: boolean;
|
|
1550
|
+
lockName: string;
|
|
1551
|
+
};
|
|
1552
|
+
releaseForFirstTime: null;
|
|
1553
|
+
ready: null;
|
|
1554
|
+
}> {
|
|
1555
|
+
#private;
|
|
1556
|
+
get hasReleasedFirstTime(): boolean;
|
|
1557
|
+
get isForced(): boolean;
|
|
1558
|
+
/**
|
|
1559
|
+
* Permite saber si un bloqueo determinado está activo o si la clase tiene
|
|
1560
|
+
* forceLock activo.
|
|
1561
|
+
*/
|
|
1562
|
+
isLocked(lockName?: string): boolean;
|
|
1563
|
+
constructor();
|
|
1564
|
+
lock(lockName?: string): void;
|
|
1565
|
+
unlock(lockName?: string): void;
|
|
1566
|
+
force(): void;
|
|
1567
|
+
releaseForced(): void;
|
|
1568
|
+
}
|
|
1569
|
+
/**
|
|
1570
|
+
* Esta clase no implementa ninguna funcionalidad de bloqueo, sino solamente se
|
|
1571
|
+
* encarga de la lógica y de los eventos.
|
|
1572
|
+
*
|
|
1573
|
+
* El concepto es que hay n niveles de bloqueo y además existe el bloqueo
|
|
1574
|
+
* forzado. Cada uno de los niveles recibe un nombre, por defecto se realizan
|
|
1575
|
+
* operaciones contra el bloque 'common' si no se pasa ninguno, pero
|
|
1576
|
+
* podría utilizarse cualquier otro. Esto es así con el fin de implementar
|
|
1577
|
+
* varios bloqueos en la misma clase, ejemplos: el bloqueo común, el bloqueo
|
|
1578
|
+
* lineal de las tablas, bloque con pantalla blanca en el inicio de formularios,
|
|
1579
|
+
* o cualquier otro que se desee. Para los bloqueos estándar se utilizan los
|
|
1580
|
+
* métodos lock y unlock.
|
|
1581
|
+
*
|
|
1582
|
+
* El bloqueo forzado por otra parte es un estado general que se puede alterar
|
|
1583
|
+
* mediante los métodos force y releaseForced. Cada vez que se bloquee o
|
|
1584
|
+
* desbloquee la pantalla, se lanzará un evento lockStateChange sin lockName y
|
|
1585
|
+
* con forced = true.
|
|
1586
|
+
*
|
|
1587
|
+
* Además, provee un evento para saber cuándo se desbloquea la pantalla
|
|
1588
|
+
* efectivamente por primera vez para cada tipo de bloqueo. Es posible a su vez
|
|
1589
|
+
* resetear la clase para que este evento sea lanzado nuevamente en el próximo
|
|
1590
|
+
* desbloqueo mediante resetRefreshFirstTime.
|
|
1591
|
+
*
|
|
1592
|
+
* El evento releasForFirstTime se dispara únicamente para el bloqueo 'common'.
|
|
1593
|
+
* Esto es así ya que sino podría dar lugar a confusión en situaciones donde no
|
|
1594
|
+
* se controle el nombre del bloqueo.
|
|
1595
|
+
*/
|
|
1596
|
+
declare const screenLocker: ScreenLocker;
|
|
1597
|
+
|
|
1598
|
+
type StatefulStoreUnsuscriber = () => void;
|
|
1599
|
+
type StatefulStoreUpdater<Props> = (currentProps: Props) => Props;
|
|
1600
|
+
type StatefulStoreUpdateProps<Props> = StatefulStoreUpdater<Props> | Partial<Props>;
|
|
1601
|
+
/**
|
|
1602
|
+
* Clase facilitadora del uso de StatefulStore. Es un pequeño almacen que
|
|
1603
|
+
* permite actualizar sus propiedades y sabe cómo sincronizarse con el store de
|
|
1604
|
+
* modo que los cambios se propaguen según corresponda.
|
|
1605
|
+
*/
|
|
1606
|
+
declare abstract class BasicStoredElement<Props extends Record<string, unknown>> {
|
|
1607
|
+
#private;
|
|
1608
|
+
abstract getId(): TId;
|
|
1609
|
+
onUpdate(cb: () => void): StatefulStoreUnsuscriber;
|
|
1610
|
+
props: Props;
|
|
1611
|
+
constructor(props: Props);
|
|
1612
|
+
protected shoutUpdates: () => void;
|
|
1613
|
+
update(newProps: StatefulStoreUpdateProps<Props>): void;
|
|
1614
|
+
useProps: () => Props;
|
|
1615
|
+
}
|
|
1616
|
+
/**
|
|
1617
|
+
* Son las acciones de adición del store.
|
|
1618
|
+
*/
|
|
1619
|
+
type AddActions<T extends Record<string, BasicStoredElement<any>>> = {
|
|
1620
|
+
[P in keyof T as `add${Capitalize<string & P>}`]: (el: T[P]) => void;
|
|
1621
|
+
};
|
|
1622
|
+
/**
|
|
1623
|
+
* Acciones de vaciado del store.
|
|
1624
|
+
*/
|
|
1625
|
+
type EmptyActions<T extends Record<string, BasicStoredElement<any>>> = {
|
|
1626
|
+
[P in keyof T as `empty${Capitalize<string & P>}`]: () => void;
|
|
1627
|
+
};
|
|
1628
|
+
/**
|
|
1629
|
+
* Acciones de removido del store.
|
|
1630
|
+
*/
|
|
1631
|
+
type RemoveActions<T extends Record<string, BasicStoredElement<any>>> = {
|
|
1632
|
+
[P in keyof T as `remove${Capitalize<string & P>}`]: (id: TId) => void;
|
|
1633
|
+
};
|
|
1634
|
+
type UpdateListActions<T extends Record<string, BasicStoredElement<any>>> = {
|
|
1635
|
+
[P in keyof T as `update${Capitalize<string & P>}List`]: (newList: T[P]) => void;
|
|
1636
|
+
};
|
|
1637
|
+
/**
|
|
1638
|
+
* Conjunto de acciones disponibles del store
|
|
1639
|
+
*/
|
|
1640
|
+
type ActionMethods<T extends Record<string, BasicStoredElement<any>>> = {
|
|
1641
|
+
actions: AddActions<T> & EmptyActions<T> & RemoveActions<T> & UpdateListActions<T>;
|
|
1642
|
+
};
|
|
1643
|
+
/**
|
|
1644
|
+
* Método que permite obtener el listado de elementos de un tipo.
|
|
1645
|
+
*/
|
|
1646
|
+
type GetStateActions<T extends Record<string, BasicStoredElement<any>>> = {
|
|
1647
|
+
[P in keyof T as `get${Capitalize<string & P>}State`]: () => T[P][];
|
|
1648
|
+
};
|
|
1649
|
+
/**
|
|
1650
|
+
* Método que permite conocer las propiedades de un elemento.
|
|
1651
|
+
*/
|
|
1652
|
+
type GetItemActions<T extends Record<string, BasicStoredElement<any>>> = {
|
|
1653
|
+
[P in keyof T as `get${Capitalize<string & P>}`]: (id: TId) => T[P];
|
|
1654
|
+
};
|
|
1655
|
+
type UpdateItemActions<T extends Record<string, BasicStoredElement<any>>> = {
|
|
1656
|
+
[P in keyof T as `update${Capitalize<string & P>}`]: (id: TId, newProps: StatefulStoreUpdateProps<T[P]['props']>) => void;
|
|
1657
|
+
};
|
|
1658
|
+
/**
|
|
1659
|
+
* Conjunto de métodos que permiten acceder al estado en un momento
|
|
1660
|
+
* determinado.
|
|
1661
|
+
*/
|
|
1662
|
+
type StateMethods<T extends Record<string, BasicStoredElement<any>>> = {
|
|
1663
|
+
state: GetStateActions<T> & GetItemActions<T> & UpdateItemActions<T>;
|
|
1664
|
+
};
|
|
1665
|
+
/**
|
|
1666
|
+
* Es el hook encargado de permitir la escucha de listado de elementos y sus
|
|
1667
|
+
* propiedades.
|
|
1668
|
+
*/
|
|
1669
|
+
type HookUseState<T extends Record<string, BasicStoredElement<any>>> = {
|
|
1670
|
+
[P in keyof T as `use${Capitalize<string & P>}`]: () => T[P][];
|
|
1671
|
+
};
|
|
1672
|
+
/**
|
|
1673
|
+
* Es el hook encargado de permitir la escucha de listado de elementos
|
|
1674
|
+
*/
|
|
1675
|
+
type HookUseList<T extends Record<string, BasicStoredElement<any>>> = {
|
|
1676
|
+
[P in keyof T as `use${Capitalize<string & P>}List`]: () => T[P][];
|
|
1677
|
+
};
|
|
1678
|
+
/**
|
|
1679
|
+
* Es el hook encargado de permitir la escucha de propiedades de un elemento
|
|
1680
|
+
*/
|
|
1681
|
+
type HookUseStateById<T extends Record<string, BasicStoredElement<any>>> = {
|
|
1682
|
+
[P in keyof T as `use${Capitalize<string & P>}ById`]: (id: TId) => T[P] | undefined;
|
|
1683
|
+
};
|
|
1684
|
+
/**
|
|
1685
|
+
* Conjunto de hooks del store.
|
|
1686
|
+
*/
|
|
1687
|
+
type HooksMethods<T extends Record<string, BasicStoredElement<any>>> = {
|
|
1688
|
+
hooks: HookUseState<T> & HookUseStateById<T> & HookUseList<T>;
|
|
1689
|
+
};
|
|
1690
|
+
/**
|
|
1691
|
+
* Es la suscripción encargada de permitir la escucha de propiedades de un
|
|
1692
|
+
* elemento
|
|
1693
|
+
*/
|
|
1694
|
+
type SuscribeById<T extends Record<string, BasicStoredElement<any>>> = {
|
|
1695
|
+
[P in keyof T as `change${Capitalize<string & P>}Element`]: (id: TId, cb: (props: T[P]) => unknown) => StatefulStoreUnsuscriber;
|
|
1696
|
+
};
|
|
1697
|
+
/**
|
|
1698
|
+
* Es la suscripción encaragada de permitir la escucha de cambios en la lista y
|
|
1699
|
+
* las propiedades de sus elementos.
|
|
1700
|
+
*/
|
|
1701
|
+
type SuscribeToListChange<T extends Record<string, BasicStoredElement<any>>> = {
|
|
1702
|
+
[P in keyof T as `change${Capitalize<string & P>}`]: (cb: (props: T[P][]) => unknown) => StatefulStoreUnsuscriber;
|
|
1703
|
+
};
|
|
1704
|
+
/**
|
|
1705
|
+
* Es la suscripción encaragada de permitir la escucha de cambios en la
|
|
1706
|
+
* cantidad de elementos de la lista, pero no en las propiedades de los
|
|
1707
|
+
* elementos.
|
|
1708
|
+
*/
|
|
1709
|
+
type SuscribeToListCountChange<T extends Record<string, BasicStoredElement<any>>> = {
|
|
1710
|
+
[P in keyof T as `change${Capitalize<string & P>}Ammount`]: (cb: (props: T[P][]) => unknown) => StatefulStoreUnsuscriber;
|
|
1711
|
+
};
|
|
1712
|
+
type SuscribeMethods<T extends Record<string, BasicStoredElement<any>>> = {
|
|
1713
|
+
on: SuscribeById<T> & SuscribeToListChange<T> & SuscribeToListCountChange<T>;
|
|
1714
|
+
};
|
|
1715
|
+
type InitialStates<T extends Record<string, BasicStoredElement<any>>> = {
|
|
1716
|
+
[P in keyof T as `${string & P}State`]: T[P][];
|
|
1717
|
+
};
|
|
1718
|
+
/**
|
|
1719
|
+
* Este store permite mantener `N` listados de objetos y por cada tipo de
|
|
1720
|
+
* objeto ofrece métodos para agregar, eliminar, obtener uno, obtener todos y
|
|
1721
|
+
* un hook para conocer el listado en tiempo real.
|
|
1722
|
+
*
|
|
1723
|
+
* **Métodos disponibles**
|
|
1724
|
+
*
|
|
1725
|
+
* - **action.addXXX**: Agrega un elemento de tipo XXX a la lista.
|
|
1726
|
+
* - **action.emptyXXX**: Vacía el listado de tipo XXX.
|
|
1727
|
+
* - **action.removeXXX**: Elimina un elemento de tipo XXX de la lista.
|
|
1728
|
+
* - **action.updateXXXList**: Permite actualizar toda la lista en una sola
|
|
1729
|
+
* acción. - **hooks.useXXX**: Permite conocer el listado de elementos y el
|
|
1730
|
+
* cambio
|
|
1731
|
+
* en sus propiedades en tiempo real.
|
|
1732
|
+
* - **hooks.useXXXById**: Permite conocer los cambios a un elemento de la
|
|
1733
|
+
* lista en tiempo real.
|
|
1734
|
+
* - **hooks.useXXXList**: Permite conocer el listado de
|
|
1735
|
+
* elementos pero no reacciona a los cambios en las propiedades de los
|
|
1736
|
+
* elementos.
|
|
1737
|
+
* - **on.changeXXX**: Permite suscribirse al listado de elementos y
|
|
1738
|
+
* cambios en sus propiedades.
|
|
1739
|
+
* - **on.changeXXXAmmount**: Permite suscribirse
|
|
1740
|
+
* al listado de elementos, sin tomar en cuenta el cambio en las propiedades
|
|
1741
|
+
* de sus items.
|
|
1742
|
+
* - **on.changeXXXElement**: Permite suscribirse al cambio de
|
|
1743
|
+
* propiedades de un ítem particular
|
|
1744
|
+
* - **state.getXXX**: Permite obtener el
|
|
1745
|
+
* esatdo de un elemento particular de la lista.
|
|
1746
|
+
* - **state.getXXXState**:
|
|
1747
|
+
* Permite obtener el estado del listado completo de un tipo de elementos.
|
|
1748
|
+
* - **state.updateXXX**: Es un atajo para state.getXXX(id).update
|
|
1749
|
+
*
|
|
1750
|
+
* La funcionalidad de actualización se implementa en el objeto almacenado y es
|
|
1751
|
+
* comunicada en forma automática al store, de forma que el store no conoce
|
|
1752
|
+
* solamente cuántos y cuáles elementos hay almacenados, sino que además refleja
|
|
1753
|
+
* en tiempo real el estado de sus propiedades.
|
|
1754
|
+
*
|
|
1755
|
+
* @example
|
|
1756
|
+
*
|
|
1757
|
+
type TPeople = { name: string };
|
|
1758
|
+
class People extends BasicStoredElement<TPeople> {
|
|
1759
|
+
getId(): TId {
|
|
1760
|
+
return this.props.name;
|
|
1761
|
+
}
|
|
1762
|
+
}
|
|
1763
|
+
|
|
1764
|
+
class Schedule extends BasicStoredElement<{ day: string; task: string }>
|
|
1765
|
+
{
|
|
1766
|
+
getId() {
|
|
1767
|
+
return this.props.day;
|
|
1768
|
+
}
|
|
1769
|
+
}
|
|
1770
|
+
|
|
1771
|
+
const r = makeStatefulStore(
|
|
1772
|
+
{
|
|
1773
|
+
people: People.prototype,
|
|
1774
|
+
schedules: Schedule.prototype,
|
|
1775
|
+
},
|
|
1776
|
+
{
|
|
1777
|
+
peopleState: [new People({ name: 'A' }), new People({ name: 'B' })],
|
|
1778
|
+
},
|
|
1779
|
+
);
|
|
1780
|
+
|
|
1781
|
+
const p = r.hooks.usePeople();
|
|
1782
|
+
p[0].props.name;
|
|
1783
|
+
|
|
1784
|
+
r.hooks.usePeople();
|
|
1785
|
+
|
|
1786
|
+
r.actions.removePeople('asdf');
|
|
1787
|
+
|
|
1788
|
+
r.actions.addPeople(new People({ name: 'asdf' }));
|
|
1789
|
+
r.actions.removePeople('asdf');
|
|
1790
|
+
|
|
1791
|
+
r.state.getPeopleState();
|
|
1792
|
+
const pep = r.state.getPeople('asdf')
|
|
1793
|
+
|
|
1794
|
+
const ph = r.hooks.usePeople();
|
|
1795
|
+
const sch = r.hooks.useSchedules();
|
|
1796
|
+
*/
|
|
1797
|
+
declare function makeStatefulStore<T extends Record<string, BasicStoredElement<any>>>(entries: T, initialStates?: Partial<InitialStates<T>>): ActionMethods<T> & HooksMethods<T> & StateMethods<T> & SuscribeMethods<T>;
|
|
1798
|
+
|
|
1799
|
+
declare const persistentStorage: {
|
|
1800
|
+
[key: string]: unknown;
|
|
1801
|
+
remove(prop: string): unknown;
|
|
1802
|
+
};
|
|
1803
|
+
declare global {
|
|
1804
|
+
interface Window {
|
|
1805
|
+
persistentStorage: typeof persistentStorage;
|
|
1806
|
+
}
|
|
1807
|
+
}
|
|
1808
|
+
|
|
1809
|
+
/**
|
|
1810
|
+
* @param prop este nombre define el nombre del localStorage, las modificaciones a este parametro no van a tener efecto.
|
|
1811
|
+
*/
|
|
1812
|
+
declare function useLocalStorage<T>(prop: string, defaultValue?: T): [T, (newValue: T) => void];
|
|
1813
|
+
|
|
1814
|
+
/**
|
|
1815
|
+
* Calculates the alignment distance between two strings using the Levenshtein
|
|
1816
|
+
* distance algorithm. This distance is defined as the minimum number of
|
|
1817
|
+
* single-character edits (insertions, deletions, or substitutions) required to
|
|
1818
|
+
* change one string into the other. The function implements a dynamic
|
|
1819
|
+
* programming approach to efficiently compute this metric.
|
|
1820
|
+
*
|
|
1821
|
+
* @param {string} a - The first string to compare.
|
|
1822
|
+
* @param {string} b - The second string to compare.
|
|
1823
|
+
* @returns {number} The alignment distance between the two strings. This is a non-negative integer where
|
|
1824
|
+
* a value of 0 indicates that the strings are identical, and a larger value
|
|
1825
|
+
* indicates a greater degree of difference.
|
|
1826
|
+
*
|
|
1827
|
+
* @example
|
|
1828
|
+
* // returns 3
|
|
1829
|
+
* alignment("kitten", "sitting");
|
|
1830
|
+
*
|
|
1831
|
+
* @example
|
|
1832
|
+
* // returns 2
|
|
1833
|
+
* alignment("flaw", "lawn");
|
|
1834
|
+
*/
|
|
1835
|
+
declare function alignment(a: string, b: string): number;
|
|
1836
|
+
|
|
1837
|
+
declare function ucfirst(word: string): string;
|
|
1838
|
+
|
|
1839
|
+
/**
|
|
1840
|
+
* Toma un valor y devuelve true o false según las
|
|
1841
|
+
* siguientes condiciones:
|
|
1842
|
+
*
|
|
1843
|
+
* Si es string, ['',
|
|
1844
|
+
* 'false'].includes(value.toLowerCase()) => false, todo lo
|
|
1845
|
+
* demás => true.
|
|
1846
|
+
*
|
|
1847
|
+
* Si es array, [] => false, [...] => true.
|
|
1848
|
+
*
|
|
1849
|
+
* Todo lo demás !!value
|
|
1850
|
+
*
|
|
1851
|
+
* @example
|
|
1852
|
+
*
|
|
1853
|
+
* toBoolean('true') // true
|
|
1854
|
+
* toBoolean('TrUE') // true
|
|
1855
|
+
* toBoolean('FAlSe') // false
|
|
1856
|
+
* toBoolean(0) // false
|
|
1857
|
+
* toBoolean(1) // true
|
|
1858
|
+
* toBoolean([0]) // true
|
|
1859
|
+
* toBoolean([]) // false
|
|
1860
|
+
*/
|
|
1861
|
+
declare function toBoolean(value: unknown): boolean;
|
|
1862
|
+
|
|
1863
|
+
declare const parseXmlAsync: <T>(xml: string) => Promise<T>;
|
|
1864
|
+
|
|
1865
|
+
export { BasicStoredElement, BouncingEmitter, type Callback, type DebounceOptions, type DownloadStringAsDocProps, EventEmitter, History, type IOnFocusConfiguration, type IParameter, type ISetBoundary, type Map, 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 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, customEvents, dateToApiaFormat, debugDispatcher, decodeHTMLEntities, decrypt, defaultGetNameFromResponse, disableChildrenFocus, downloadStringAsDoc, downloadUrl, enableChildrenFocus, encrypt, findOffsetRelativeToScrollParent, findScrollContainer, focus, focusSelector, formatMessage, getDateFormat, getFocusSelector, getIndex, getLabel, getSpecificParent, getValueByPath, globalFocus, isChild, isDebugDispatcherEnabled, isPropsConfigurationObject, isSetter, makeImperativeComponent, makeSingleImperativeComponent, makeStatefulStore, noNaN, notificationsSelector, openAndReadFile, parseAsSize, parseXmlAsync, persistentStorage, 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 };
|
|
69
1866
|
//# sourceMappingURL=index.d.ts.map
|