@apia/util 1.0.4 → 2.0.1
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/animate/index.d.ts +4 -0
- package/dist/animate/index.d.ts.map +1 -0
- package/dist/animate/index.js +24 -0
- package/dist/animate/index.js.map +1 -0
- package/dist/array/arrayOrArray.d.ts +4 -0
- package/dist/array/arrayOrArray.d.ts.map +1 -0
- package/dist/array/arrayOrArray.js +8 -0
- package/dist/array/arrayOrArray.js.map +1 -0
- package/dist/array/getIndex.d.ts +14 -0
- package/dist/array/getIndex.d.ts.map +1 -0
- package/dist/array/getIndex.js +12 -0
- package/dist/array/getIndex.js.map +1 -0
- package/dist/crypto/decrypt.d.ts +4 -0
- package/dist/crypto/decrypt.d.ts.map +1 -0
- package/dist/crypto/decrypt.js +16 -0
- package/dist/crypto/decrypt.js.map +1 -0
- package/dist/crypto/encrypt.d.ts +4 -0
- package/dist/crypto/encrypt.d.ts.map +1 -0
- package/dist/crypto/encrypt.js +13 -0
- package/dist/crypto/encrypt.js.map +1 -0
- package/dist/crypto/generateKey.js +11 -0
- package/dist/crypto/generateKey.js.map +1 -0
- package/dist/date/apiaDateToStandarFormat.d.ts +4 -0
- package/dist/date/apiaDateToStandarFormat.d.ts.map +1 -0
- package/dist/date/apiaDateToStandarFormat.js +12 -0
- package/dist/date/apiaDateToStandarFormat.js.map +1 -0
- package/dist/date/dateToApiaFormat.d.ts +4 -0
- package/dist/date/dateToApiaFormat.d.ts.map +1 -0
- package/dist/date/dateToApiaFormat.js +9 -0
- package/dist/date/dateToApiaFormat.js.map +1 -0
- package/dist/date/getDateFormat.d.ts +11 -0
- package/dist/date/getDateFormat.d.ts.map +1 -0
- package/dist/date/getDateFormat.js +20 -0
- package/dist/date/getDateFormat.js.map +1 -0
- package/dist/debug/debugDispatcher.d.ts +32 -0
- package/dist/debug/debugDispatcher.d.ts.map +1 -0
- package/dist/debug/debugDispatcher.js +72 -0
- package/dist/debug/debugDispatcher.js.map +1 -0
- package/dist/debug/shortcutController.d.ts +57 -0
- package/dist/debug/shortcutController.d.ts.map +1 -0
- package/dist/debug/shortcutController.js +152 -0
- package/dist/debug/shortcutController.js.map +1 -0
- package/dist/documents/downloadStringAsDoc.d.ts +8 -0
- package/dist/documents/downloadStringAsDoc.d.ts.map +1 -0
- package/dist/documents/downloadStringAsDoc.js +12 -0
- package/dist/documents/downloadStringAsDoc.js.map +1 -0
- package/dist/documents/downloadUrl.d.ts +20 -0
- package/dist/documents/downloadUrl.d.ts.map +1 -0
- package/dist/documents/downloadUrl.js +18 -0
- package/dist/documents/downloadUrl.js.map +1 -0
- package/dist/documents/openAndReadFile.d.ts +4 -0
- package/dist/documents/openAndReadFile.d.ts.map +1 -0
- package/dist/documents/openAndReadFile.js +29 -0
- package/dist/documents/openAndReadFile.js.map +1 -0
- package/dist/dom/autoDisconnectMutationObserver.d.ts +17 -0
- package/dist/dom/autoDisconnectMutationObserver.d.ts.map +1 -0
- package/dist/dom/autoDisconnectMutationObserver.js +35 -0
- package/dist/dom/autoDisconnectMutationObserver.js.map +1 -0
- package/dist/dom/customEvents.d.ts +40 -0
- package/dist/dom/customEvents.d.ts.map +1 -0
- package/dist/dom/customEvents.js +34 -0
- package/dist/dom/customEvents.js.map +1 -0
- package/dist/dom/enableChildrenFocus.d.ts +18 -0
- package/dist/dom/enableChildrenFocus.d.ts.map +1 -0
- package/dist/dom/enableChildrenFocus.js +26 -0
- package/dist/dom/enableChildrenFocus.js.map +1 -0
- package/dist/dom/findOffsetRelativeToScrollParent.d.ts +7 -0
- package/dist/dom/findOffsetRelativeToScrollParent.d.ts.map +1 -0
- package/dist/dom/findOffsetRelativeToScrollParent.js +19 -0
- package/dist/dom/findOffsetRelativeToScrollParent.js.map +1 -0
- package/dist/dom/findScrollContainer.d.ts +8 -0
- package/dist/dom/findScrollContainer.d.ts.map +1 -0
- package/dist/dom/findScrollContainer.js +9 -0
- package/dist/dom/findScrollContainer.js.map +1 -0
- package/dist/dom/getFocusSelector.d.ts +25 -0
- package/dist/dom/getFocusSelector.d.ts.map +1 -0
- package/dist/dom/getFocusSelector.js +30 -0
- package/dist/dom/getFocusSelector.js.map +1 -0
- package/dist/dom/getSpecificParent.d.ts +23 -0
- package/dist/dom/getSpecificParent.d.ts.map +1 -0
- package/dist/dom/getSpecificParent.js +19 -0
- package/dist/dom/getSpecificParent.js.map +1 -0
- package/dist/dom/isChild.d.ts +13 -0
- package/dist/dom/isChild.d.ts.map +1 -0
- package/dist/dom/isChild.js +8 -0
- package/dist/dom/isChild.js.map +1 -0
- package/dist/dom/scrollParentIntoElement.d.ts +9 -0
- package/dist/dom/scrollParentIntoElement.d.ts.map +1 -0
- package/dist/dom/scrollParentIntoElement.js +24 -0
- package/dist/dom/scrollParentIntoElement.js.map +1 -0
- package/dist/dom/url.d.ts +18 -0
- package/dist/dom/url.d.ts.map +1 -0
- package/dist/dom/url.js +52 -0
- package/dist/dom/url.js.map +1 -0
- package/dist/dom/usePanAndZoom.d.ts +14 -0
- package/dist/dom/usePanAndZoom.d.ts.map +1 -0
- package/dist/dom/usePanAndZoom.js +111 -0
- package/dist/dom/usePanAndZoom.js.map +1 -0
- package/dist/encoding/index.d.ts +8 -0
- package/dist/encoding/index.d.ts.map +1 -0
- package/dist/encoding/index.js +12 -0
- package/dist/encoding/index.js.map +1 -0
- package/dist/events/BouncingEmitter.d.ts +67 -0
- package/dist/events/BouncingEmitter.d.ts.map +1 -0
- package/dist/events/BouncingEmitter.js +72 -0
- package/dist/events/BouncingEmitter.js.map +1 -0
- package/dist/events/EventEmitter.d.ts +47 -0
- package/dist/events/EventEmitter.d.ts.map +1 -0
- package/dist/events/EventEmitter.js +75 -0
- package/dist/events/EventEmitter.js.map +1 -0
- package/dist/events/StatefulEmitter.d.ts +44 -0
- package/dist/events/StatefulEmitter.d.ts.map +1 -0
- package/dist/events/StatefulEmitter.js +57 -0
- package/dist/events/StatefulEmitter.js.map +1 -0
- package/dist/events/types.d.ts +29 -0
- package/dist/events/types.d.ts.map +1 -0
- package/dist/focus/focusController.d.ts +108 -0
- package/dist/focus/focusController.d.ts.map +1 -0
- package/dist/focus/focusController.js +295 -0
- package/dist/focus/focusController.js.map +1 -0
- package/dist/focus/globalFocus.d.ts +24 -0
- package/dist/focus/globalFocus.d.ts.map +1 -0
- package/dist/focus/globalFocus.js +87 -0
- package/dist/focus/globalFocus.js.map +1 -0
- package/dist/history/History.d.ts +81 -0
- package/dist/history/History.d.ts.map +1 -0
- package/dist/history/History.js +122 -0
- package/dist/history/History.js.map +1 -0
- package/dist/hooks/useCombinedRefs.d.ts +18 -0
- package/dist/hooks/useCombinedRefs.d.ts.map +1 -0
- package/dist/hooks/useCombinedRefs.js +20 -0
- package/dist/hooks/useCombinedRefs.js.map +1 -0
- package/dist/hooks/useDebouncedCallback.d.ts +7 -0
- package/dist/hooks/useDebouncedCallback.d.ts.map +1 -0
- package/dist/hooks/useDebouncedCallback.js +21 -0
- package/dist/hooks/useDebouncedCallback.js.map +1 -0
- package/dist/hooks/useLatest.d.ts +13 -0
- package/dist/hooks/useLatest.d.ts.map +1 -0
- package/dist/hooks/useLatest.js +10 -0
- package/dist/hooks/useLatest.js.map +1 -0
- package/dist/hooks/useMount.d.ts +6 -0
- package/dist/hooks/useMount.d.ts.map +1 -0
- package/dist/hooks/useMount.js +14 -0
- package/dist/hooks/useMount.js.map +1 -0
- package/dist/hooks/usePrevious.d.ts +6 -0
- package/dist/hooks/usePrevious.d.ts.map +1 -0
- package/dist/hooks/usePrevious.js +12 -0
- package/dist/hooks/usePrevious.js.map +1 -0
- package/dist/hooks/useShallowMemo.d.ts +9 -0
- package/dist/hooks/useShallowMemo.d.ts.map +1 -0
- package/dist/hooks/useShallowMemo.js +42 -0
- package/dist/hooks/useShallowMemo.js.map +1 -0
- package/dist/hooks/useStateRef.d.ts +10 -0
- package/dist/hooks/useStateRef.d.ts.map +1 -0
- package/dist/hooks/useStateRef.js +11 -0
- package/dist/hooks/useStateRef.js.map +1 -0
- package/dist/hooks/useSubscription.d.ts +31 -0
- package/dist/hooks/useSubscription.d.ts.map +1 -0
- package/dist/hooks/useSubscription.js +21 -0
- package/dist/hooks/useSubscription.js.map +1 -0
- package/dist/hooks/useUnmount.d.ts +4 -0
- package/dist/hooks/useUnmount.d.ts.map +1 -0
- package/dist/hooks/useUnmount.js +10 -0
- package/dist/hooks/useUnmount.js.map +1 -0
- package/dist/hooks/useUpdateEffect.d.ts +10 -0
- package/dist/hooks/useUpdateEffect.d.ts.map +1 -0
- package/dist/hooks/useUpdateEffect.js +16 -0
- package/dist/hooks/useUpdateEffect.js.map +1 -0
- package/dist/imperative/makeImperativeComponent.d.ts +56 -0
- package/dist/imperative/makeImperativeComponent.d.ts.map +1 -0
- package/dist/imperative/makeImperativeComponent.js +48 -0
- package/dist/imperative/makeImperativeComponent.js.map +1 -0
- package/dist/imperative/makeSingleImperativeComponent.d.ts +15 -0
- package/dist/imperative/makeSingleImperativeComponent.d.ts.map +1 -0
- package/dist/imperative/makeSingleImperativeComponent.js +31 -0
- package/dist/imperative/makeSingleImperativeComponent.js.map +1 -0
- package/dist/imperative/types.d.ts +22 -0
- package/dist/imperative/types.d.ts.map +1 -0
- package/dist/imperative/types.js +8 -0
- package/dist/imperative/types.js.map +1 -0
- package/dist/imperative/useImperativeComponentEvents.d.ts +6 -0
- package/dist/imperative/useImperativeComponentEvents.d.ts.map +1 -0
- package/dist/imperative/useImperativeComponentEvents.js +35 -0
- package/dist/imperative/useImperativeComponentEvents.js.map +1 -0
- package/dist/imperative/useImperativeIdentifierContext.d.ts +14 -0
- package/dist/imperative/useImperativeIdentifierContext.d.ts.map +1 -0
- package/dist/imperative/useImperativeIdentifierContext.js +10 -0
- package/dist/imperative/useImperativeIdentifierContext.js.map +1 -0
- package/dist/index.d.ts +69 -1777
- package/dist/index.js +63 -2659
- package/dist/index.js.map +1 -1
- package/dist/labels/formatMessage.d.ts +19 -0
- package/dist/labels/formatMessage.d.ts.map +1 -0
- package/dist/labels/formatMessage.js +13 -0
- package/dist/labels/formatMessage.js.map +1 -0
- package/dist/labels/getLabel.d.ts +34 -0
- package/dist/labels/getLabel.d.ts.map +1 -0
- package/dist/labels/getLabel.js +18 -0
- package/dist/labels/getLabel.js.map +1 -0
- package/dist/number/index.d.ts +29 -0
- package/dist/number/index.d.ts.map +1 -0
- package/dist/number/index.js +43 -0
- package/dist/number/index.js.map +1 -0
- package/dist/objects/getValueByPath.d.ts +23 -0
- package/dist/objects/getValueByPath.d.ts.map +1 -0
- package/dist/objects/getValueByPath.js +19 -0
- package/dist/objects/getValueByPath.js.map +1 -0
- package/dist/objects/setValueByPath.d.ts +33 -0
- package/dist/objects/setValueByPath.d.ts.map +1 -0
- package/dist/objects/setValueByPath.js +35 -0
- package/dist/objects/setValueByPath.js.map +1 -0
- package/dist/propsStore/propsStore.d.ts +42 -0
- package/dist/propsStore/propsStore.d.ts.map +1 -0
- package/dist/propsStore/propsStore.js +157 -0
- package/dist/propsStore/propsStore.js.map +1 -0
- package/dist/propsStore/types.d.ts +24 -0
- package/dist/propsStore/types.d.ts.map +1 -0
- package/dist/propsStore/usePropsSelector.d.ts +67 -0
- package/dist/propsStore/usePropsSelector.d.ts.map +1 -0
- package/dist/propsStore/usePropsSelector.js +92 -0
- package/dist/propsStore/usePropsSelector.js.map +1 -0
- package/dist/screenLock/screenLocker.d.ts +60 -0
- package/dist/screenLock/screenLocker.d.ts.map +1 -0
- package/dist/screenLock/screenLocker.js +95 -0
- package/dist/screenLock/screenLocker.js.map +1 -0
- package/dist/states/useDebouncedState.d.ts +10 -0
- package/dist/states/useDebouncedState.d.ts.map +1 -0
- package/dist/states/useDebouncedState.js +22 -0
- package/dist/states/useDebouncedState.js.map +1 -0
- package/dist/states/useDomState.d.ts +86 -0
- package/dist/states/useDomState.d.ts.map +1 -0
- package/dist/states/useDomState.js +35 -0
- package/dist/states/useDomState.js.map +1 -0
- package/dist/storage/StatefulStore.d.ts +205 -0
- package/dist/storage/StatefulStore.d.ts.map +1 -0
- package/dist/storage/StatefulStore.js +301 -0
- package/dist/storage/StatefulStore.js.map +1 -0
- package/dist/storage/persistentStorage.d.ts +12 -0
- package/dist/storage/persistentStorage.d.ts.map +1 -0
- package/dist/storage/persistentStorage.js +28 -0
- package/dist/storage/persistentStorage.js.map +1 -0
- package/dist/storage/useLocalStorage.d.ts +7 -0
- package/dist/storage/useLocalStorage.d.ts.map +1 -0
- package/dist/storage/useLocalStorage.js +40 -0
- package/dist/storage/useLocalStorage.js.map +1 -0
- package/dist/string/alignment.d.ts +25 -0
- package/dist/string/alignment.d.ts.map +1 -0
- package/dist/string/alignment.js +26 -0
- package/dist/string/alignment.js.map +1 -0
- package/dist/string/ucfirst.d.ts +4 -0
- package/dist/string/ucfirst.d.ts.map +1 -0
- package/dist/string/ucfirst.js +6 -0
- package/dist/string/ucfirst.js.map +1 -0
- package/dist/typeGuards/toBoolean.d.ts +26 -0
- package/dist/typeGuards/toBoolean.d.ts.map +1 -0
- package/dist/typeGuards/toBoolean.js +11 -0
- package/dist/typeGuards/toBoolean.js.map +1 -0
- package/dist/types/apia/common.d.ts +114 -0
- package/dist/types/apia/common.d.ts.map +1 -0
- package/dist/types/apia/date.d.ts +4 -0
- package/dist/types/apia/date.d.ts.map +1 -0
- package/dist/types/apia/forms.d.ts +221 -0
- package/dist/types/apia/forms.d.ts.map +1 -0
- package/dist/types/misc.d.ts +9 -0
- package/dist/types/misc.d.ts.map +1 -0
- package/dist/xml/parseXmlAsync.d.ts +4 -0
- package/dist/xml/parseXmlAsync.d.ts.map +1 -0
- package/dist/xml/parseXmlAsync.js +58 -0
- package/dist/xml/parseXmlAsync.js.map +1 -0
- package/package.json +24 -35
- package/LICENSE.md +0 -21
- package/README.md +0 -18
- package/cleanDist.json +0 -3
- package/entries.json +0 -1
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { useMemo, useState, useEffect, useCallback } from 'react';
|
|
2
|
+
import { EventEmitter } from '../events/EventEmitter.js';
|
|
3
|
+
|
|
4
|
+
const localStorageController = new class LocalSctorageController extends EventEmitter {
|
|
5
|
+
}();
|
|
6
|
+
function useLocalStorage(prop, defaultValue) {
|
|
7
|
+
const actualProp = useMemo(() => prop, []);
|
|
8
|
+
const storageValue = useMemo(
|
|
9
|
+
() => localStorage.getItem(actualProp),
|
|
10
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
11
|
+
[]
|
|
12
|
+
);
|
|
13
|
+
const [value, setValue] = useState(
|
|
14
|
+
storageValue ? JSON.parse(storageValue) : defaultValue
|
|
15
|
+
);
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
setValue(JSON.parse(storageValue));
|
|
18
|
+
return localStorageController.on("update", (ev) => {
|
|
19
|
+
if (ev.prop === actualProp) {
|
|
20
|
+
setValue(ev.value);
|
|
21
|
+
localStorage.setItem(actualProp, JSON.stringify(ev.value));
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
}, []);
|
|
25
|
+
return [
|
|
26
|
+
value,
|
|
27
|
+
useCallback(
|
|
28
|
+
(newValue) => {
|
|
29
|
+
localStorageController.emit("update", {
|
|
30
|
+
prop: actualProp,
|
|
31
|
+
value: newValue
|
|
32
|
+
});
|
|
33
|
+
},
|
|
34
|
+
[actualProp]
|
|
35
|
+
)
|
|
36
|
+
];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export { useLocalStorage };
|
|
40
|
+
//# sourceMappingURL=useLocalStorage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLocalStorage.js","sources":["../../src/storage/useLocalStorage.ts"],"sourcesContent":["import { useCallback, useEffect, useMemo, useState } from 'react';\nimport { EventEmitter } from '../events/EventEmitter';\n\nconst localStorageController =\n new (class LocalSctorageController extends EventEmitter<{\n update: {\n prop: string;\n value: unknown;\n };\n }> {})();\n\n/**\n * @param prop este nombre define el nombre del localStorage, las modificaciones a este parametro no van a tener efecto.\n */\nexport function useLocalStorage<T>(\n prop: string,\n defaultValue?: T,\n): [T, (newValue: T) => void] {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const actualProp = useMemo(() => prop, []);\n const storageValue = useMemo(\n () => localStorage.getItem(actualProp) as string,\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [],\n );\n\n const [value, setValue] = useState<T>(\n storageValue ? (JSON.parse(storageValue) as T) : (defaultValue as T),\n );\n useEffect(() => {\n setValue(JSON.parse(storageValue) as T);\n return localStorageController.on('update', (ev) => {\n if (ev.prop === actualProp) {\n setValue(ev.value as T);\n localStorage.setItem(actualProp, JSON.stringify(ev.value));\n }\n });\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n return [\n value,\n useCallback(\n (newValue: T) => {\n localStorageController.emit('update', {\n prop: actualProp,\n value: newValue,\n });\n },\n [actualProp],\n ),\n ];\n}\n"],"names":[],"mappings":";;;AAGA,MAAM,sBACJ,GAAA,IAAK,MAAM,uBAAA,SAAgC,YAKxC,CAAA;AAAC,CAAG,EAAA,CAAA;AAKO,SAAA,eAAA,CACd,MACA,YAC4B,EAAA;AAE5B,EAAA,MAAM,UAAa,GAAA,OAAA,CAAQ,MAAM,IAAA,EAAM,EAAE,CAAA,CAAA;AACzC,EAAA,MAAM,YAAe,GAAA,OAAA;AAAA,IACnB,MAAM,YAAa,CAAA,OAAA,CAAQ,UAAU,CAAA;AAAA;AAAA,IAErC,EAAC;AAAA,GACH,CAAA;AAEA,EAAM,MAAA,CAAC,KAAO,EAAA,QAAQ,CAAI,GAAA,QAAA;AAAA,IACxB,YAAgB,GAAA,IAAA,CAAK,KAAM,CAAA,YAAY,CAAW,GAAA,YAAA;AAAA,GACpD,CAAA;AACA,EAAA,SAAA,CAAU,MAAM;AACd,IAAS,QAAA,CAAA,IAAA,CAAK,KAAM,CAAA,YAAY,CAAM,CAAA,CAAA;AACtC,IAAA,OAAO,sBAAuB,CAAA,EAAA,CAAG,QAAU,EAAA,CAAC,EAAO,KAAA;AACjD,MAAI,IAAA,EAAA,CAAG,SAAS,UAAY,EAAA;AAC1B,QAAA,QAAA,CAAS,GAAG,KAAU,CAAA,CAAA;AACtB,QAAA,YAAA,CAAa,QAAQ,UAAY,EAAA,IAAA,CAAK,SAAU,CAAA,EAAA,CAAG,KAAK,CAAC,CAAA,CAAA;AAAA,OAC3D;AAAA,KACD,CAAA,CAAA;AAAA,GAEH,EAAG,EAAE,CAAA,CAAA;AAEL,EAAO,OAAA;AAAA,IACL,KAAA;AAAA,IACA,WAAA;AAAA,MACE,CAAC,QAAgB,KAAA;AACf,QAAA,sBAAA,CAAuB,KAAK,QAAU,EAAA;AAAA,UACpC,IAAM,EAAA,UAAA;AAAA,UACN,KAAO,EAAA,QAAA;AAAA,SACR,CAAA,CAAA;AAAA,OACH;AAAA,MACA,CAAC,UAAU,CAAA;AAAA,KACb;AAAA,GACF,CAAA;AACF;;;;"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Calculates the alignment distance between two strings using the Levenshtein
|
|
3
|
+
* distance algorithm. This distance is defined as the minimum number of
|
|
4
|
+
* single-character edits (insertions, deletions, or substitutions) required to
|
|
5
|
+
* change one string into the other. The function implements a dynamic
|
|
6
|
+
* programming approach to efficiently compute this metric.
|
|
7
|
+
*
|
|
8
|
+
* @param {string} a - The first string to compare.
|
|
9
|
+
* @param {string} b - The second string to compare.
|
|
10
|
+
* @returns {number} The alignment distance between the two strings. This is a non-negative integer where
|
|
11
|
+
* a value of 0 indicates that the strings are identical, and a larger value
|
|
12
|
+
* indicates a greater degree of difference.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* // returns 3
|
|
16
|
+
* alignment("kitten", "sitting");
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* // returns 2
|
|
20
|
+
* alignment("flaw", "lawn");
|
|
21
|
+
*/
|
|
22
|
+
declare function alignment(a: string, b: string): number;
|
|
23
|
+
|
|
24
|
+
export { alignment };
|
|
25
|
+
//# sourceMappingURL=alignment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alignment.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
function alignment(a, b) {
|
|
2
|
+
const m = a.length;
|
|
3
|
+
const n = b.length;
|
|
4
|
+
const dp = Array.from({ length: m + 1 }, () => Array(n + 1).fill(0));
|
|
5
|
+
for (let i = 0; i <= m; i++)
|
|
6
|
+
dp[i][0] = i;
|
|
7
|
+
for (let j = 0; j <= n; j++)
|
|
8
|
+
dp[0][j] = j;
|
|
9
|
+
for (let i = 1; i <= m; i++) {
|
|
10
|
+
for (let j = 1; j <= n; j++) {
|
|
11
|
+
const cost = a[i - 1] === b[j - 1] ? 0 : 1;
|
|
12
|
+
dp[i][j] = Math.min(
|
|
13
|
+
dp[i - 1][j] + 1,
|
|
14
|
+
// deletion
|
|
15
|
+
dp[i][j - 1] + 1,
|
|
16
|
+
// insertion
|
|
17
|
+
dp[i - 1][j - 1] + cost
|
|
18
|
+
// substitution
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return dp[m][n];
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export { alignment };
|
|
26
|
+
//# sourceMappingURL=alignment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alignment.js","sources":["../../src/string/alignment.ts"],"sourcesContent":["/**\n * Calculates the alignment distance between two strings using the Levenshtein\n * distance algorithm. This distance is defined as the minimum number of\n * single-character edits (insertions, deletions, or substitutions) required to\n * change one string into the other. The function implements a dynamic\n * programming approach to efficiently compute this metric.\n *\n * @param {string} a - The first string to compare.\n * @param {string} b - The second string to compare.\n * @returns {number} The alignment distance between the two strings. This is a non-negative integer where\n * a value of 0 indicates that the strings are identical, and a larger value\n * indicates a greater degree of difference.\n *\n * @example\n * // returns 3\n * alignment(\"kitten\", \"sitting\");\n *\n * @example\n * // returns 2\n * alignment(\"flaw\", \"lawn\");\n */\nexport function alignment(a: string, b: string) {\n const m = a.length;\n const n = b.length;\n const dp = Array.from({ length: m + 1 }, () => Array<number>(n + 1).fill(0));\n\n // Initialize the first column and the first row of the matrix\n for (let i = 0; i <= m; i++) dp[i][0] = i;\n for (let j = 0; j <= n; j++) dp[0][j] = j;\n\n // Fill dp matrix\n for (let i = 1; i <= m; i++) {\n for (let j = 1; j <= n; j++) {\n const cost = a[i - 1] === b[j - 1] ? 0 : 1;\n dp[i][j] = Math.min(\n dp[i - 1][j] + 1, // deletion\n dp[i][j - 1] + 1, // insertion\n dp[i - 1][j - 1] + cost, // substitution\n );\n }\n }\n\n // Return the value in the bottom right corner\n return dp[m][n];\n}\n"],"names":[],"mappings":"AAqBgB,SAAA,SAAA,CAAU,GAAW,CAAW,EAAA;AAC9C,EAAA,MAAM,IAAI,CAAE,CAAA,MAAA,CAAA;AACZ,EAAA,MAAM,IAAI,CAAE,CAAA,MAAA,CAAA;AACZ,EAAA,MAAM,EAAK,GAAA,KAAA,CAAM,IAAK,CAAA,EAAE,QAAQ,CAAI,GAAA,CAAA,EAAK,EAAA,MAAM,MAAc,CAAI,GAAA,CAAC,CAAE,CAAA,IAAA,CAAK,CAAC,CAAC,CAAA,CAAA;AAG3E,EAAS,KAAA,IAAA,CAAA,GAAI,CAAG,EAAA,CAAA,IAAK,CAAG,EAAA,CAAA,EAAA;AAAK,IAAG,EAAA,CAAA,CAAC,CAAE,CAAA,CAAC,CAAI,GAAA,CAAA,CAAA;AACxC,EAAS,KAAA,IAAA,CAAA,GAAI,CAAG,EAAA,CAAA,IAAK,CAAG,EAAA,CAAA,EAAA;AAAK,IAAG,EAAA,CAAA,CAAC,CAAE,CAAA,CAAC,CAAI,GAAA,CAAA,CAAA;AAGxC,EAAA,KAAA,IAAS,CAAI,GAAA,CAAA,EAAG,CAAK,IAAA,CAAA,EAAG,CAAK,EAAA,EAAA;AAC3B,IAAA,KAAA,IAAS,CAAI,GAAA,CAAA,EAAG,CAAK,IAAA,CAAA,EAAG,CAAK,EAAA,EAAA;AAC3B,MAAM,MAAA,IAAA,GAAO,EAAE,CAAI,GAAA,CAAC,MAAM,CAAE,CAAA,CAAA,GAAI,CAAC,CAAA,GAAI,CAAI,GAAA,CAAA,CAAA;AACzC,MAAA,EAAA,CAAG,CAAC,CAAA,CAAE,CAAC,CAAA,GAAI,IAAK,CAAA,GAAA;AAAA,QACd,EAAG,CAAA,CAAA,GAAI,CAAC,CAAA,CAAE,CAAC,CAAI,GAAA,CAAA;AAAA;AAAA,QACf,EAAG,CAAA,CAAC,CAAE,CAAA,CAAA,GAAI,CAAC,CAAI,GAAA,CAAA;AAAA;AAAA,QACf,GAAG,CAAI,GAAA,CAAC,CAAE,CAAA,CAAA,GAAI,CAAC,CAAI,GAAA,IAAA;AAAA;AAAA,OACrB,CAAA;AAAA,KACF;AAAA,GACF;AAGA,EAAO,OAAA,EAAA,CAAG,CAAC,CAAA,CAAE,CAAC,CAAA,CAAA;AAChB;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ucfirst.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ucfirst.js","sources":["../../src/string/ucfirst.ts"],"sourcesContent":["export function ucfirst(word: string) {\n return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();\n}\n"],"names":[],"mappings":"AAAO,SAAS,QAAQ,IAAc,EAAA;AACpC,EAAO,OAAA,IAAA,CAAK,MAAO,CAAA,CAAC,CAAE,CAAA,WAAA,KAAgB,IAAK,CAAA,KAAA,CAAM,CAAC,CAAA,CAAE,WAAY,EAAA,CAAA;AAClE;;;;"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Toma un valor y devuelve true o false según las
|
|
3
|
+
* siguientes condiciones:
|
|
4
|
+
*
|
|
5
|
+
* Si es string, ['',
|
|
6
|
+
* 'false'].includes(value.toLowerCase()) => false, todo lo
|
|
7
|
+
* demás => true.
|
|
8
|
+
*
|
|
9
|
+
* Si es array, [] => false, [...] => true.
|
|
10
|
+
*
|
|
11
|
+
* Todo lo demás !!value
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
*
|
|
15
|
+
* toBoolean('true') // true
|
|
16
|
+
* toBoolean('TrUE') // true
|
|
17
|
+
* toBoolean('FAlSe') // false
|
|
18
|
+
* toBoolean(0) // false
|
|
19
|
+
* toBoolean(1) // true
|
|
20
|
+
* toBoolean([0]) // true
|
|
21
|
+
* toBoolean([]) // false
|
|
22
|
+
*/
|
|
23
|
+
declare function toBoolean(value: unknown): boolean;
|
|
24
|
+
|
|
25
|
+
export { toBoolean };
|
|
26
|
+
//# sourceMappingURL=toBoolean.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toBoolean.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
function toBoolean(value) {
|
|
2
|
+
if (typeof value === "string") {
|
|
3
|
+
return !["false", ""].includes(value.toLowerCase());
|
|
4
|
+
}
|
|
5
|
+
if (Array.isArray(value))
|
|
6
|
+
return value.length > 0;
|
|
7
|
+
return !!value;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export { toBoolean };
|
|
11
|
+
//# sourceMappingURL=toBoolean.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toBoolean.js","sources":["../../src/typeGuards/toBoolean.ts"],"sourcesContent":["/**\n * Toma un valor y devuelve true o false según las\n * siguientes condiciones:\n *\n * Si es string, ['',\n * 'false'].includes(value.toLowerCase()) => false, todo lo\n * demás => true.\n *\n * Si es array, [] => false, [...] => true.\n *\n * Todo lo demás !!value\n *\n * @example\n *\n * toBoolean('true') // true\n * toBoolean('TrUE') // true\n * toBoolean('FAlSe') // false\n * toBoolean(0) // false\n * toBoolean(1) // true\n * toBoolean([0]) // true\n * toBoolean([]) // false\n */\nexport function toBoolean(value: unknown): boolean {\n if (typeof value === 'string') {\n return !['false', ''].includes(value.toLowerCase());\n }\n\n if (Array.isArray(value)) return value.length > 0;\n\n return !!value;\n}\n"],"names":[],"mappings":"AAsBO,SAAS,UAAU,KAAyB,EAAA;AACjD,EAAI,IAAA,OAAO,UAAU,QAAU,EAAA;AAC7B,IAAO,OAAA,CAAC,CAAC,OAAS,EAAA,EAAE,EAAE,QAAS,CAAA,KAAA,CAAM,aAAa,CAAA,CAAA;AAAA,GACpD;AAEA,EAAI,IAAA,KAAA,CAAM,QAAQ,KAAK,CAAA;AAAG,IAAA,OAAO,MAAM,MAAS,GAAA,CAAA,CAAA;AAEhD,EAAA,OAAO,CAAC,CAAC,KAAA,CAAA;AACX;;;;"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { TApiaLoadForm } from './forms.js';
|
|
2
|
+
|
|
3
|
+
interface TApiaAction {
|
|
4
|
+
toDo?: string;
|
|
5
|
+
param: string | string[];
|
|
6
|
+
}
|
|
7
|
+
interface TApiaActions {
|
|
8
|
+
action: TApiaAction | TApiaAction[];
|
|
9
|
+
}
|
|
10
|
+
interface TApiaMessage {
|
|
11
|
+
text: string;
|
|
12
|
+
label?: string;
|
|
13
|
+
}
|
|
14
|
+
type TApiaComplexCell = {
|
|
15
|
+
label: string;
|
|
16
|
+
classToAdd?: string;
|
|
17
|
+
isHTML?: boolean;
|
|
18
|
+
docName?: string;
|
|
19
|
+
forceTitle?: string;
|
|
20
|
+
[key: string]: unknown;
|
|
21
|
+
};
|
|
22
|
+
type TApiaCellDefinition = TApiaComplexCell | string;
|
|
23
|
+
type TApiaRowDefinition = {
|
|
24
|
+
'data-selected'?: boolean;
|
|
25
|
+
selected?: boolean;
|
|
26
|
+
dblclic: boolean;
|
|
27
|
+
id: string;
|
|
28
|
+
classToAdd?: string;
|
|
29
|
+
rowSeparator?: boolean;
|
|
30
|
+
suspended?: boolean;
|
|
31
|
+
unselectableTR?: boolean;
|
|
32
|
+
headName?: string;
|
|
33
|
+
isLocked?: boolean;
|
|
34
|
+
cell: TApiaCellDefinition | TApiaCellDefinition[];
|
|
35
|
+
boldType?: boolean;
|
|
36
|
+
'expired-doc': true;
|
|
37
|
+
};
|
|
38
|
+
type TApiaFunctionPageInfo = {
|
|
39
|
+
amount: string;
|
|
40
|
+
currentPage: string;
|
|
41
|
+
hasMore: boolean;
|
|
42
|
+
pageCount: string;
|
|
43
|
+
prefix: string;
|
|
44
|
+
reachedMax: boolean;
|
|
45
|
+
selectOnlyOne: boolean;
|
|
46
|
+
totalRecords: string;
|
|
47
|
+
};
|
|
48
|
+
type TApiaSystemMessageObj<Structure = Record<string, unknown>> = Structure & {
|
|
49
|
+
onClose?: string;
|
|
50
|
+
sysMessages?: {
|
|
51
|
+
message: TApiaMessage | TApiaMessage[];
|
|
52
|
+
};
|
|
53
|
+
sysExceptions?: {
|
|
54
|
+
exception: TApiaMessage | TApiaMessage[];
|
|
55
|
+
};
|
|
56
|
+
exceptions?: {
|
|
57
|
+
exception: TApiaMessage | TApiaMessage[];
|
|
58
|
+
};
|
|
59
|
+
actions?: TApiaActions;
|
|
60
|
+
code?: unknown;
|
|
61
|
+
load?: Structure;
|
|
62
|
+
};
|
|
63
|
+
type TApiaTableFunction = {
|
|
64
|
+
result: {
|
|
65
|
+
pageInfo: TApiaFunctionPageInfo;
|
|
66
|
+
table?: {
|
|
67
|
+
row: TApiaRowDefinition | TApiaRowDefinition[];
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
type TApiaFunction<T = TApiaTableFunction, HasMessages = true> = HasMessages extends true ? {
|
|
72
|
+
function: {
|
|
73
|
+
dropLastMessage?: boolean;
|
|
74
|
+
name: string;
|
|
75
|
+
messages: T;
|
|
76
|
+
};
|
|
77
|
+
} : {
|
|
78
|
+
function: {
|
|
79
|
+
name: string;
|
|
80
|
+
} & T;
|
|
81
|
+
};
|
|
82
|
+
type TApiaLoadText = {
|
|
83
|
+
text: {
|
|
84
|
+
closeAll: boolean;
|
|
85
|
+
title: string;
|
|
86
|
+
addClass: string;
|
|
87
|
+
content: string;
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
type TApiaLoad<T extends Record<string, unknown> = TApiaLoadForm> = {
|
|
91
|
+
canClose: boolean;
|
|
92
|
+
type: string;
|
|
93
|
+
} & T;
|
|
94
|
+
interface TMessage {
|
|
95
|
+
text: string;
|
|
96
|
+
content?: string;
|
|
97
|
+
title?: string;
|
|
98
|
+
type?: string;
|
|
99
|
+
}
|
|
100
|
+
interface TNotificationMessage {
|
|
101
|
+
onClose?: string;
|
|
102
|
+
sysMessages?: {
|
|
103
|
+
message: TMessage | TMessage[];
|
|
104
|
+
};
|
|
105
|
+
sysExceptions?: {
|
|
106
|
+
exception: TMessage | TMessage[];
|
|
107
|
+
};
|
|
108
|
+
exceptions?: {
|
|
109
|
+
exception: TMessage | TMessage[];
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export type { TApiaAction, TApiaActions, TApiaCellDefinition, TApiaComplexCell, TApiaFunction, TApiaFunctionPageInfo, TApiaLoad, TApiaLoadText, TApiaMessage, TApiaRowDefinition, TApiaSystemMessageObj, TApiaTableFunction, TMessage, TNotificationMessage };
|
|
114
|
+
//# sourceMappingURL=common.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
interface TFncParams {
|
|
2
|
+
type: 'V' | 'P' | 'E';
|
|
3
|
+
value?: string;
|
|
4
|
+
attId?: number;
|
|
5
|
+
}
|
|
6
|
+
type TApiaFormButton = {
|
|
7
|
+
onclick: string;
|
|
8
|
+
text: string;
|
|
9
|
+
id: string;
|
|
10
|
+
type: string;
|
|
11
|
+
};
|
|
12
|
+
interface TApiaSelectPossibleValue {
|
|
13
|
+
value: string | number;
|
|
14
|
+
label: string;
|
|
15
|
+
selected?: boolean;
|
|
16
|
+
}
|
|
17
|
+
interface TApiaMultiplePossibleValue {
|
|
18
|
+
value: string | number;
|
|
19
|
+
label: string;
|
|
20
|
+
selected?: boolean;
|
|
21
|
+
}
|
|
22
|
+
interface TApiaRadioPossibleValue {
|
|
23
|
+
value: string | number;
|
|
24
|
+
label: string;
|
|
25
|
+
selected?: boolean;
|
|
26
|
+
}
|
|
27
|
+
type TApiaPossibleValue = TApiaRadioPossibleValue & TApiaMultiplePossibleValue & TApiaSelectPossibleValue;
|
|
28
|
+
type TFieldEvent = 'onLoad' | 'onReload' | 'onSubmit' | 'onChange' | 'onModalReturn' | 'onClick' | 'onPopulate' | 'populate' | 'gridAdd' | 'gridSort' | 'gridSortUp' | 'gridSortDown' | 'gridDelete' | 'gridColumnSelect' | 'JSApiaUpdate' | 'onSubmit';
|
|
29
|
+
interface TFieldScriptEvent {
|
|
30
|
+
fncName: string;
|
|
31
|
+
evtName: Readonly<TFieldEvent>;
|
|
32
|
+
evtId: number | string;
|
|
33
|
+
fncParams: TFncParams[];
|
|
34
|
+
}
|
|
35
|
+
type TFieldScriptEvents = TFieldScriptEvent[];
|
|
36
|
+
interface TFieldServerEvent {
|
|
37
|
+
evtId: number;
|
|
38
|
+
evtName: Readonly<TFieldEvent>;
|
|
39
|
+
isAjax: boolean;
|
|
40
|
+
}
|
|
41
|
+
type TFieldServerEvents = TFieldServerEvent[];
|
|
42
|
+
interface TApiaFieldPropsObj {
|
|
43
|
+
alignment?: string;
|
|
44
|
+
alt?: string;
|
|
45
|
+
bold?: string;
|
|
46
|
+
checked?: boolean;
|
|
47
|
+
colspan?: number;
|
|
48
|
+
cssClass?: string;
|
|
49
|
+
disabled?: boolean;
|
|
50
|
+
docType?: string;
|
|
51
|
+
dontBreakRadio?: boolean;
|
|
52
|
+
fontColor?: string;
|
|
53
|
+
gridHeight?: number;
|
|
54
|
+
gridColTitle?: string;
|
|
55
|
+
gridTitle?: string;
|
|
56
|
+
height?: string;
|
|
57
|
+
hideAddButton?: boolean;
|
|
58
|
+
hideDelButton?: boolean;
|
|
59
|
+
hideDocMetadata?: boolean;
|
|
60
|
+
hideDocPermissions?: boolean;
|
|
61
|
+
hideGridButtons?: boolean;
|
|
62
|
+
hideIncludeButton?: boolean;
|
|
63
|
+
hideOrderButton?: boolean;
|
|
64
|
+
hideSignButtons?: boolean;
|
|
65
|
+
pagedGridSize?: number;
|
|
66
|
+
paged?: boolean;
|
|
67
|
+
includeFirstRow?: boolean;
|
|
68
|
+
imageUrl?: string;
|
|
69
|
+
inputAsText?: boolean;
|
|
70
|
+
isActuallyReadonly?: boolean;
|
|
71
|
+
multiselect?: boolean;
|
|
72
|
+
name?: string;
|
|
73
|
+
noPrint?: boolean;
|
|
74
|
+
readonly?: boolean;
|
|
75
|
+
readOnly?: boolean;
|
|
76
|
+
regExpMessage?: string;
|
|
77
|
+
reqSign?: boolean;
|
|
78
|
+
reqTrad?: boolean;
|
|
79
|
+
required?: boolean;
|
|
80
|
+
rowspan?: number;
|
|
81
|
+
selParent?: boolean;
|
|
82
|
+
size?: string;
|
|
83
|
+
storeMdlQryResult?: boolean;
|
|
84
|
+
tooltip?: string;
|
|
85
|
+
tooltipHelp?: boolean;
|
|
86
|
+
transient?: boolean;
|
|
87
|
+
underlined?: boolean;
|
|
88
|
+
url?: string;
|
|
89
|
+
value?: unknown;
|
|
90
|
+
updateValueWithoutSynchronize?: unknown;
|
|
91
|
+
valueColor?: string;
|
|
92
|
+
visibilityHidden?: boolean;
|
|
93
|
+
possibleValue?: TApiaSelectPossibleValue[] | TApiaSelectPossibleValue | TApiaRadioPossibleValue[] | TApiaMultiplePossibleValue[] | TApiaMultiplePossibleValue;
|
|
94
|
+
leafIcon?: string;
|
|
95
|
+
parentIcon?: string;
|
|
96
|
+
props?: string;
|
|
97
|
+
id?: string;
|
|
98
|
+
noLock?: boolean;
|
|
99
|
+
noErase?: boolean;
|
|
100
|
+
noModify?: boolean;
|
|
101
|
+
noDownload?: boolean;
|
|
102
|
+
allowEdition?: boolean;
|
|
103
|
+
hideDocDownload?: boolean;
|
|
104
|
+
qryId?: string;
|
|
105
|
+
startIndex?: number;
|
|
106
|
+
curPage?: number;
|
|
107
|
+
pages?: number;
|
|
108
|
+
rowCount?: number;
|
|
109
|
+
maxRecords?: number;
|
|
110
|
+
colWidth?: string;
|
|
111
|
+
gridForm?: string;
|
|
112
|
+
documentMonitorCus?: number;
|
|
113
|
+
fileCollapseFldStrc?: boolean;
|
|
114
|
+
fileCollapseMetadata?: boolean;
|
|
115
|
+
fileCollapsePermission?: boolean;
|
|
116
|
+
fileDefFolder?: number;
|
|
117
|
+
fileDntShwDocMdlOnDrop?: boolean;
|
|
118
|
+
fileExpDate?: boolean;
|
|
119
|
+
fileNoAllwDnD?: boolean;
|
|
120
|
+
fileNotShowDocMon?: boolean;
|
|
121
|
+
fileShowDesc?: boolean;
|
|
122
|
+
fileShwFoldTreeBtn?: boolean;
|
|
123
|
+
fileShwFoldTreeStr?: boolean;
|
|
124
|
+
oneClickUpload?: boolean;
|
|
125
|
+
fieldId?: string;
|
|
126
|
+
hasFinishedLoading?: boolean;
|
|
127
|
+
}
|
|
128
|
+
type TApiaFormElementOption = {
|
|
129
|
+
content: string;
|
|
130
|
+
value: string;
|
|
131
|
+
};
|
|
132
|
+
type TApiaFormElement = {
|
|
133
|
+
class: string;
|
|
134
|
+
disabled: boolean;
|
|
135
|
+
html: boolean;
|
|
136
|
+
id: string;
|
|
137
|
+
isADate: boolean;
|
|
138
|
+
mandatory: boolean;
|
|
139
|
+
maxlength?: string;
|
|
140
|
+
modalFunction?: string;
|
|
141
|
+
name: string;
|
|
142
|
+
normalWhiteSpace: boolean;
|
|
143
|
+
onChange: string;
|
|
144
|
+
options: {
|
|
145
|
+
option: TApiaFormElementOption | TApiaFormElementOption[];
|
|
146
|
+
};
|
|
147
|
+
readonly: boolean;
|
|
148
|
+
regExp?: string;
|
|
149
|
+
regExpMessage?: string;
|
|
150
|
+
selected: boolean;
|
|
151
|
+
size: string;
|
|
152
|
+
text: string;
|
|
153
|
+
title: string;
|
|
154
|
+
type: string;
|
|
155
|
+
value: string;
|
|
156
|
+
valueAsAttribute: boolean;
|
|
157
|
+
};
|
|
158
|
+
type TApiaLoadForm = {
|
|
159
|
+
form: {
|
|
160
|
+
closeOnSubmit: boolean;
|
|
161
|
+
multiPart: boolean;
|
|
162
|
+
ajaxNewPanel: boolean;
|
|
163
|
+
showErrors: boolean;
|
|
164
|
+
doEscape: boolean;
|
|
165
|
+
action: string;
|
|
166
|
+
onLoad: string;
|
|
167
|
+
ajaxsubmit: boolean;
|
|
168
|
+
closeAll: boolean;
|
|
169
|
+
title: string;
|
|
170
|
+
autoExpand: boolean;
|
|
171
|
+
titleClass: string;
|
|
172
|
+
addClass: string;
|
|
173
|
+
elements?: {
|
|
174
|
+
label: string;
|
|
175
|
+
element: TApiaFormElement | TApiaFormElement[];
|
|
176
|
+
};
|
|
177
|
+
buttons?: {
|
|
178
|
+
button: TApiaFormButton | TApiaFormButton[];
|
|
179
|
+
};
|
|
180
|
+
};
|
|
181
|
+
};
|
|
182
|
+
type TApiaFilterValue = string | number;
|
|
183
|
+
type TApiaFilterOption = {
|
|
184
|
+
label: string;
|
|
185
|
+
value: TApiaFilterValue;
|
|
186
|
+
selected?: boolean;
|
|
187
|
+
id?: string;
|
|
188
|
+
name?: string;
|
|
189
|
+
};
|
|
190
|
+
type TApiaFilter = {
|
|
191
|
+
asAdditional?: boolean;
|
|
192
|
+
column?: string;
|
|
193
|
+
currentValue: TApiaFilterValue;
|
|
194
|
+
deleteFiltersTimestamp?: number;
|
|
195
|
+
error?: string;
|
|
196
|
+
id: string | number;
|
|
197
|
+
isMeta?: boolean;
|
|
198
|
+
placeholder?: string;
|
|
199
|
+
runAutomatically?: boolean;
|
|
200
|
+
title?: string;
|
|
201
|
+
toolTip?: string;
|
|
202
|
+
detectOnChange?: boolean;
|
|
203
|
+
readonly?: boolean;
|
|
204
|
+
required?: boolean;
|
|
205
|
+
sortCombo?: boolean;
|
|
206
|
+
/**
|
|
207
|
+
* Con esta propiedad se permite agupar los filtros para mostrarlos en un
|
|
208
|
+
* panel especifico.
|
|
209
|
+
*/
|
|
210
|
+
group?: string;
|
|
211
|
+
options?: TApiaFilterOption[];
|
|
212
|
+
type?: 'date' | 'D' | 'S' | 'number' | 'N' | 'apiaNumber';
|
|
213
|
+
hide?: boolean;
|
|
214
|
+
hideToFilter?: boolean;
|
|
215
|
+
filterToId?: string;
|
|
216
|
+
filterToValue?: TApiaFilterValue;
|
|
217
|
+
isRange?: boolean;
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
export type { TApiaFieldPropsObj, TApiaFilter, TApiaFilterOption, TApiaFilterValue, TApiaFormButton, TApiaFormElement, TApiaFormElementOption, TApiaLoadForm, TApiaMultiplePossibleValue, TApiaPossibleValue, TApiaRadioPossibleValue, TApiaSelectPossibleValue, TFieldEvent, TFieldScriptEvent, TFieldScriptEvents, TFieldServerEvent, TFieldServerEvents, TFncParams };
|
|
221
|
+
//# sourceMappingURL=forms.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"forms.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
type TId = string | number;
|
|
2
|
+
type TModify<T, R> = Omit<T, keyof R> & R;
|
|
3
|
+
type TMap<T> = Record<string | number, T>;
|
|
4
|
+
type TRequireOnlyOne<T, Keys extends keyof T = keyof T> = Pick<T, Exclude<keyof T, Keys>> & {
|
|
5
|
+
[K in Keys]-?: Required<Pick<T, K>> & Partial<Record<Exclude<Keys, K>, undefined>>;
|
|
6
|
+
}[Keys];
|
|
7
|
+
|
|
8
|
+
export type { TId, TMap, TModify, TRequireOnlyOne };
|
|
9
|
+
//# sourceMappingURL=misc.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"misc.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parseXmlAsync.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import xml2js from 'xml2js';
|
|
2
|
+
import { parseBooleans, parseNumbers } from 'xml2js/lib/processors';
|
|
3
|
+
|
|
4
|
+
const processAjaxEventTagNames = (name) => {
|
|
5
|
+
return name;
|
|
6
|
+
};
|
|
7
|
+
const processAjaxEventAttrNames = (name) => {
|
|
8
|
+
return name;
|
|
9
|
+
};
|
|
10
|
+
const processAjaxEventResponse = (value, name) => {
|
|
11
|
+
if (name === "v" && value === "T")
|
|
12
|
+
return true;
|
|
13
|
+
if (name === "v" && value === "F")
|
|
14
|
+
return false;
|
|
15
|
+
return value;
|
|
16
|
+
};
|
|
17
|
+
const processStringObj = (value, key) => {
|
|
18
|
+
if (key === "value" && typeof value === "number" && Number.isNaN(value)) {
|
|
19
|
+
return "";
|
|
20
|
+
}
|
|
21
|
+
if (key === "valueType" && typeof value === "string" && value === "null") {
|
|
22
|
+
return "";
|
|
23
|
+
}
|
|
24
|
+
if ((key === "cols" || key === "rows" || key === "x" || key === "y" || key === "length") && typeof value === "string") {
|
|
25
|
+
return parseNumbers(value);
|
|
26
|
+
}
|
|
27
|
+
return value;
|
|
28
|
+
};
|
|
29
|
+
const parseXmlAsync = async (xml) => {
|
|
30
|
+
const parser = new xml2js.Parser({
|
|
31
|
+
trim: true,
|
|
32
|
+
normalize: true,
|
|
33
|
+
explicitRoot: false,
|
|
34
|
+
mergeAttrs: true,
|
|
35
|
+
explicitArray: false,
|
|
36
|
+
charkey: "content",
|
|
37
|
+
attrValueProcessors: [
|
|
38
|
+
parseBooleans,
|
|
39
|
+
processStringObj,
|
|
40
|
+
processAjaxEventResponse
|
|
41
|
+
],
|
|
42
|
+
tagNameProcessors: [processAjaxEventTagNames],
|
|
43
|
+
attrNameProcessors: [processAjaxEventAttrNames]
|
|
44
|
+
});
|
|
45
|
+
const result = await new Promise((resolve, reject) => {
|
|
46
|
+
parser.parseString(xml, (err, innerResult) => {
|
|
47
|
+
if (err)
|
|
48
|
+
reject(err);
|
|
49
|
+
else {
|
|
50
|
+
resolve(innerResult);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
return result;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export { parseXmlAsync, processAjaxEventAttrNames, processAjaxEventResponse, processAjaxEventTagNames, processStringObj };
|
|
58
|
+
//# sourceMappingURL=parseXmlAsync.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parseXmlAsync.js","sources":["../../src/xml/parseXmlAsync.ts"],"sourcesContent":["import xml2js, { ParserOptions } from 'xml2js';\nimport { parseBooleans, parseNumbers } from 'xml2js/lib/processors';\nimport {\n TApiaFieldPropsObj,\n TFieldScriptEvents,\n TFieldServerEvents,\n TNotificationMessage,\n} from '../types';\n\nexport const processAjaxEventTagNames = (name: string): string => {\n return name;\n};\n\nexport const processAjaxEventAttrNames = (name: string): string => {\n return name;\n};\n\nexport interface TSessionExceptions {\n exception: {\n content: string;\n text: string;\n };\n}\n\nexport const processAjaxEventResponse = (\n value: unknown,\n name: string,\n): string | unknown => {\n if (name === 'v' && value === 'T') return true;\n if (name === 'v' && value === 'F') return false;\n return value;\n};\n\nexport const getJSObjfromXML = (\n xml: XMLDocument | string,\n): Record<string, unknown> => {\n let objJS: TNotificationMessage | null = null;\n\n const parser = new xml2js.Parser({\n trim: true,\n normalize: true,\n explicitRoot: false,\n mergeAttrs: true,\n explicitArray: false,\n charkey: 'content',\n attrValueProcessors: [\n parseBooleans,\n processStringObj,\n processAjaxEventResponse,\n ],\n tagNameProcessors: [processAjaxEventTagNames],\n attrNameProcessors: [processAjaxEventAttrNames],\n } as ParserOptions);\n\n parser.parseString(\n xml,\n (err: Error | null, result: Record<string, unknown>) => {\n if (err) {\n console.warn('Error Parsing XML data', err);\n } else {\n objJS = result;\n }\n },\n );\n if (objJS) {\n return objJS;\n }\n return {};\n};\n\nexport const processStringObj = (\n value: string,\n key: string,\n):\n | TApiaFieldPropsObj\n | string\n | number\n | TFieldScriptEvents\n | TFieldServerEvents => {\n /*\n\n * ESTAS ENTRADAS VAN A SER NECESARIAS CUANDO SE INCORPORE MODULO DE\n * EJECUCION AL MONOREPO\n\n if (key === 'properties') {\n return parseFieldPropertiesObj(jsonDecode(value)) as TApiaFieldPropsObj;\n }\n if (key === 'scriptEvents') {\n return JSON.parse(value) as TFieldScriptEvents;\n }\n if (key === 'serverEvents') {\n return JSON.parse(value) as TFieldServerEvents;\n }\n if (key === 'gridXml') {\n return getJSObjfromXML(he.decode(value).replaceAll('&', '&'));\n } */\n if (key === 'value' && typeof value === 'number' && Number.isNaN(value)) {\n return '';\n }\n if (key === 'valueType' && typeof value === 'string' && value === 'null') {\n return '';\n }\n if (\n (key === 'cols' ||\n key === 'rows' ||\n key === 'x' ||\n key === 'y' ||\n key === 'length') &&\n typeof value === 'string'\n ) {\n return parseNumbers(value);\n }\n return value;\n};\n\nexport const parseXmlAsync = async <T>(xml: string): Promise<T> => {\n const parser = new xml2js.Parser({\n trim: true,\n normalize: true,\n explicitRoot: false,\n mergeAttrs: true,\n explicitArray: false,\n charkey: 'content',\n attrValueProcessors: [\n parseBooleans,\n processStringObj,\n processAjaxEventResponse,\n ],\n tagNameProcessors: [processAjaxEventTagNames],\n attrNameProcessors: [processAjaxEventAttrNames],\n } as ParserOptions);\n\n const result = await new Promise<T>((resolve, reject) => {\n parser.parseString(xml, (err: Error | null, innerResult: T) => {\n if (err) reject(err);\n else {\n resolve(innerResult);\n }\n });\n });\n\n return result;\n};\n"],"names":[],"mappings":";;;AASa,MAAA,wBAAA,GAA2B,CAAC,IAAyB,KAAA;AAChE,EAAO,OAAA,IAAA,CAAA;AACT,EAAA;AAEa,MAAA,yBAAA,GAA4B,CAAC,IAAyB,KAAA;AACjE,EAAO,OAAA,IAAA,CAAA;AACT,EAAA;AASa,MAAA,wBAAA,GAA2B,CACtC,KAAA,EACA,IACqB,KAAA;AACrB,EAAI,IAAA,IAAA,KAAS,OAAO,KAAU,KAAA,GAAA;AAAK,IAAO,OAAA,IAAA,CAAA;AAC1C,EAAI,IAAA,IAAA,KAAS,OAAO,KAAU,KAAA,GAAA;AAAK,IAAO,OAAA,KAAA,CAAA;AAC1C,EAAO,OAAA,KAAA,CAAA;AACT,EAAA;AAuCa,MAAA,gBAAA,GAAmB,CAC9B,KAAA,EACA,GAMwB,KAAA;AAkBxB,EAAI,IAAA,GAAA,KAAQ,WAAW,OAAO,KAAA,KAAU,YAAY,MAAO,CAAA,KAAA,CAAM,KAAK,CAAG,EAAA;AACvE,IAAO,OAAA,EAAA,CAAA;AAAA,GACT;AACA,EAAA,IAAI,QAAQ,WAAe,IAAA,OAAO,KAAU,KAAA,QAAA,IAAY,UAAU,MAAQ,EAAA;AACxE,IAAO,OAAA,EAAA,CAAA;AAAA,GACT;AACA,EAAA,IAAA,CACG,GAAQ,KAAA,MAAA,IACP,GAAQ,KAAA,MAAA,IACR,GAAQ,KAAA,GAAA,IACR,GAAQ,KAAA,GAAA,IACR,GAAQ,KAAA,QAAA,KACV,OAAO,KAAA,KAAU,QACjB,EAAA;AACA,IAAA,OAAO,aAAa,KAAK,CAAA,CAAA;AAAA,GAC3B;AACA,EAAO,OAAA,KAAA,CAAA;AACT,EAAA;AAEa,MAAA,aAAA,GAAgB,OAAU,GAA4B,KAAA;AACjE,EAAM,MAAA,MAAA,GAAS,IAAI,MAAA,CAAO,MAAO,CAAA;AAAA,IAC/B,IAAM,EAAA,IAAA;AAAA,IACN,SAAW,EAAA,IAAA;AAAA,IACX,YAAc,EAAA,KAAA;AAAA,IACd,UAAY,EAAA,IAAA;AAAA,IACZ,aAAe,EAAA,KAAA;AAAA,IACf,OAAS,EAAA,SAAA;AAAA,IACT,mBAAqB,EAAA;AAAA,MACnB,aAAA;AAAA,MACA,gBAAA;AAAA,MACA,wBAAA;AAAA,KACF;AAAA,IACA,iBAAA,EAAmB,CAAC,wBAAwB,CAAA;AAAA,IAC5C,kBAAA,EAAoB,CAAC,yBAAyB,CAAA;AAAA,GAC9B,CAAA,CAAA;AAElB,EAAA,MAAM,SAAS,MAAM,IAAI,OAAW,CAAA,CAAC,SAAS,MAAW,KAAA;AACvD,IAAA,MAAA,CAAO,WAAY,CAAA,GAAA,EAAK,CAAC,GAAA,EAAmB,WAAmB,KAAA;AAC7D,MAAI,IAAA,GAAA;AAAK,QAAA,MAAA,CAAO,GAAG,CAAA,CAAA;AAAA,WACd;AACH,QAAA,OAAA,CAAQ,WAAW,CAAA,CAAA;AAAA,OACrB;AAAA,KACD,CAAA,CAAA;AAAA,GACF,CAAA,CAAA;AAED,EAAO,OAAA,MAAA,CAAA;AACT;;;;"}
|