@apia/util 0.1.0 → 0.2.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/LICENSE.md +20 -20
- package/README.md +18 -18
- package/dist/index.d.ts +92 -244
- package/dist/index.js +259 -245
- package/dist/index.js.map +1 -1
- package/dist/watchChanges.js +10 -0
- package/entries.json +1 -1
- package/package.json +3 -3
- package/cleanDist.json +0 -3
package/LICENSE.md
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) [year] [fullname]
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) [year] [fullname]
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
21
|
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
# Initiator
|
|
2
|
-
|
|
3
|
-
Este package se creó con la única utilidad de copiarlo entero y pegarlo a la hora de crear un nuevo package.
|
|
4
|
-
|
|
5
|
-
Este iniciador permite crear un paquete que compila typescript y puede ser importado desde otros packages.
|
|
6
|
-
|
|
7
|
-
## Procedimiento
|
|
8
|
-
|
|
9
|
-
- Copiar la carpeta initiator y pegarla con otro nombre dentro de packages.
|
|
10
|
-
- Modificar el package.json:
|
|
11
|
-
- Eliminar la línea ```private: true```.
|
|
12
|
-
- Cambiar el nombre del package en la propiedad "name".
|
|
13
|
-
- Cambiar el repositorio en "repository".
|
|
14
|
-
- Ejecutar el comando lerna bootstrap desde la carpeta raíz.
|
|
15
|
-
|
|
16
|
-
Luego de ejecutar estos pasos, el package estaría listo para comenzar a usarse.
|
|
17
|
-
|
|
18
|
-
Este package trae como dependencias por defecto theme-ui y react. Si se desea agregar más dependencias se debe ejecutar el comando ```lerna add --scope="@apia/packageName" dependencyName```. Ejemplo, si creamos un paquete con el nombre @apia/myPackage y queremos agregar lodash como dependencia, ejecutamos el comando ```lerna add --scope="@apia/myPackage" lodash```. **Importante**: lerna no permite instalar de a varias dependencias a la vez como lo hace npm, por lo tanto, si se desea agregar varias dependencias se debe ejecutar el comando anterior tantas veces como dependencias se quiera agregar.
|
|
1
|
+
# Initiator
|
|
2
|
+
|
|
3
|
+
Este package se creó con la única utilidad de copiarlo entero y pegarlo a la hora de crear un nuevo package.
|
|
4
|
+
|
|
5
|
+
Este iniciador permite crear un paquete que compila typescript y puede ser importado desde otros packages.
|
|
6
|
+
|
|
7
|
+
## Procedimiento
|
|
8
|
+
|
|
9
|
+
- Copiar la carpeta initiator y pegarla con otro nombre dentro de packages.
|
|
10
|
+
- Modificar el package.json:
|
|
11
|
+
- Eliminar la línea ```private: true```.
|
|
12
|
+
- Cambiar el nombre del package en la propiedad "name".
|
|
13
|
+
- Cambiar el repositorio en "repository".
|
|
14
|
+
- Ejecutar el comando lerna bootstrap desde la carpeta raíz.
|
|
15
|
+
|
|
16
|
+
Luego de ejecutar estos pasos, el package estaría listo para comenzar a usarse.
|
|
17
|
+
|
|
18
|
+
Este package trae como dependencias por defecto theme-ui y react. Si se desea agregar más dependencias se debe ejecutar el comando ```lerna add --scope="@apia/packageName" dependencyName```. Ejemplo, si creamos un paquete con el nombre @apia/myPackage y queremos agregar lodash como dependencia, ejecutamos el comando ```lerna add --scope="@apia/myPackage" lodash```. **Importante**: lerna no permite instalar de a varias dependencias a la vez como lo hace npm, por lo tanto, si se desea agregar varias dependencias se debe ejecutar el comando anterior tantas veces como dependencias se quiera agregar.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import * as React
|
|
1
|
+
import * as React from 'react';
|
|
2
2
|
import React__default, { EffectCallback, Dispatch, SetStateAction, MutableRefObject, DependencyList, FC, HTMLAttributes } from 'react';
|
|
3
3
|
import { AxiosResponse } from 'axios';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import { TId as TId$1 } from '@apia/util';
|
|
4
|
+
|
|
5
|
+
declare function animate(duration: number, callback: (progress: number) => unknown, onFinish?: () => unknown): () => void;
|
|
7
6
|
|
|
8
7
|
declare function arrayOrArray<T>(o: T | T[] | undefined): T[];
|
|
9
8
|
|
|
@@ -181,114 +180,6 @@ declare function usePanAndZoom<ContainerType extends HTMLElement = HTMLElement,
|
|
|
181
180
|
elementRef: React__default.RefObject<ChildType>;
|
|
182
181
|
};
|
|
183
182
|
|
|
184
|
-
type TEventMap = Record<string, any>;
|
|
185
|
-
type TEventKey<T extends TEventMap> = string & keyof T;
|
|
186
|
-
type TEventReceiver<T> = (params: T) => unknown;
|
|
187
|
-
type TFun = () => unknown;
|
|
188
|
-
interface IEmitter<T extends TEventMap> {
|
|
189
|
-
on<K extends TEventKey<T>>(eventName: K, fn: TEventReceiver<T[K]>): TFun;
|
|
190
|
-
off<K extends TEventKey<T>>(eventName: K, fn: TEventReceiver<T[K]>): unknown;
|
|
191
|
-
emit<K extends TEventKey<T>>(eventName: K, params?: T[K]): unknown;
|
|
192
|
-
}
|
|
193
|
-
/**
|
|
194
|
-
* EventEmitter muy sencillo.
|
|
195
|
-
*
|
|
196
|
-
* El siguiente ejemplo es un fragmento de una clase
|
|
197
|
-
* perteneciente al grupo de wai-aria helpers. Ver que el método #shout nada
|
|
198
|
-
* tiene que ver con la clase EventEmitter, sino que es un método interno de la
|
|
199
|
-
* clase WaiTypeAhead.
|
|
200
|
-
*
|
|
201
|
-
* Lo que realmente importa en el ejemplo es el tipado (Lo que va luego de
|
|
202
|
-
* extends EventEmitter) y el this.emit en la creación del emitter; por otra
|
|
203
|
-
* parte es importante el (instance).on(...) que se muestra al final del
|
|
204
|
-
* ejemplo, que permite realizar suscripciones al EventEmitter creado.
|
|
205
|
-
*
|
|
206
|
-
* Además, es notable que cuando se realiza una suscripción mediante
|
|
207
|
-
* (instance).on, este método devuelve un método que al ser llamado rompe la
|
|
208
|
-
* suscripción; esto nos da la firma del método on como:
|
|
209
|
-
*
|
|
210
|
-
* on(eventName: string, callback: (ev: eventType) => unknown): Unsuscriptor;
|
|
211
|
-
*
|
|
212
|
-
* @example
|
|
213
|
-
*
|
|
214
|
-
* // Event emitter creation
|
|
215
|
-
*
|
|
216
|
-
* class WaiTypeAhead extends EventEmitter<{
|
|
217
|
-
multipleKeys: string;
|
|
218
|
-
singleKey: string;
|
|
219
|
-
}> {
|
|
220
|
-
// ...
|
|
221
|
-
#shout({ clear } = { clear: true }) {
|
|
222
|
-
if (this.typing.length === 1) {
|
|
223
|
-
this.emit('singleKey', this.typing);
|
|
224
|
-
} else if (this.typing.length > 1) {
|
|
225
|
-
this.emit('multipleKeys', this.typing);
|
|
226
|
-
}
|
|
227
|
-
// ...
|
|
228
|
-
}
|
|
229
|
-
// ...
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
// Usage
|
|
233
|
-
|
|
234
|
-
const wtype = new WaiTypeAhead();
|
|
235
|
-
wtype.on('multipleKeys', (typing) => {
|
|
236
|
-
write(`Multiple: ${typing}`);
|
|
237
|
-
});
|
|
238
|
-
*/
|
|
239
|
-
declare class EventEmitter<T extends TEventMap> implements IEmitter<T> {
|
|
240
|
-
#private;
|
|
241
|
-
on<K extends TEventKey<T>>(eventName: K, fn: TEventReceiver<T[K]>): () => void;
|
|
242
|
-
off<K extends TEventKey<T>>(eventName: K, fn: TEventReceiver<T[K]>): void;
|
|
243
|
-
emit<K extends TEventKey<T>>(eventName: K, params?: T[K]): void;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
type TLiveEvent = {
|
|
247
|
-
message: string;
|
|
248
|
-
type: 'polite' | 'assertive' | 'reset';
|
|
249
|
-
};
|
|
250
|
-
/**
|
|
251
|
-
* Este método se utiliza para emitir mensajes
|
|
252
|
-
* a los usuarios con discapacidades. **IMPORTANTE:
|
|
253
|
-
* El empleo de esta herramienta debe ser analizado
|
|
254
|
-
* a conciencia**.
|
|
255
|
-
*
|
|
256
|
-
* **La forma que considero correcta de analizar el
|
|
257
|
-
* problema es:**
|
|
258
|
-
*
|
|
259
|
-
* Si yo fuera un usuario ciego o discapacitado, qué
|
|
260
|
-
* tipo de mensaje me gustaría recibir para entender
|
|
261
|
-
* el uso de las herramientas en el contexto actual.
|
|
262
|
-
*
|
|
263
|
-
* Si se encuentra que esta forma de analizar el
|
|
264
|
-
* problema tiene fallos o carencias, por favor
|
|
265
|
-
* iniciar la discusión correspondiente ya que la idea
|
|
266
|
-
* es ir mejorando esta herramienta.
|
|
267
|
-
*
|
|
268
|
-
* **El uso es muy sencillo:**
|
|
269
|
-
*
|
|
270
|
-
* Al llamar al método
|
|
271
|
-
* AriaLiveEmitter.emit({ live: 'polite' | 'assertive',
|
|
272
|
-
* message: 'un mensaje' }), se actualiza un div para
|
|
273
|
-
* que contenta estas características, lo que termina
|
|
274
|
-
* leyendo dicho mensaje al usuario.
|
|
275
|
-
*/
|
|
276
|
-
declare const AriaLiveEmitter: {
|
|
277
|
-
"__#1@#emitter": IEmitter<{
|
|
278
|
-
live: TLiveEvent;
|
|
279
|
-
}>;
|
|
280
|
-
on<K extends "live">(eventName: K, fn: TEventReceiver<{
|
|
281
|
-
live: TLiveEvent;
|
|
282
|
-
}[K]>): () => void;
|
|
283
|
-
off<K_1 extends "live">(eventName: K_1, fn: TEventReceiver<{
|
|
284
|
-
live: TLiveEvent;
|
|
285
|
-
}[K_1]>): void;
|
|
286
|
-
emit<K_2 extends "live">(eventName: K_2, params?: {
|
|
287
|
-
live: TLiveEvent;
|
|
288
|
-
}[K_2] | undefined): void;
|
|
289
|
-
};
|
|
290
|
-
declare const LiveRegion: () => theme_ui_jsx_runtime.JSX.Element;
|
|
291
|
-
|
|
292
183
|
/**
|
|
293
184
|
* Existen algunos eventos que se disparan en la
|
|
294
185
|
* aplicación con la finalidad de desencadenar
|
|
@@ -414,6 +305,68 @@ declare function disableChildrenFocus(parent: HTMLElement): void;
|
|
|
414
305
|
*/
|
|
415
306
|
declare function enableChildrenFocus(parent: HTMLElement): void;
|
|
416
307
|
|
|
308
|
+
type TEventMap = Record<string, any>;
|
|
309
|
+
type TEventKey<T extends TEventMap> = string & keyof T;
|
|
310
|
+
type TEventReceiver<T> = (params: T) => unknown;
|
|
311
|
+
type TFun = () => unknown;
|
|
312
|
+
interface IEmitter<T extends TEventMap> {
|
|
313
|
+
on<K extends TEventKey<T>>(eventName: K, fn: TEventReceiver<T[K]>): TFun;
|
|
314
|
+
off<K extends TEventKey<T>>(eventName: K, fn: TEventReceiver<T[K]>): unknown;
|
|
315
|
+
emit<K extends TEventKey<T>>(eventName: K, params?: T[K]): unknown;
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* EventEmitter muy sencillo.
|
|
319
|
+
*
|
|
320
|
+
* El siguiente ejemplo es un fragmento de una clase
|
|
321
|
+
* perteneciente al grupo de wai-aria helpers. Ver que el método #shout nada
|
|
322
|
+
* tiene que ver con la clase EventEmitter, sino que es un método interno de la
|
|
323
|
+
* clase WaiTypeAhead.
|
|
324
|
+
*
|
|
325
|
+
* Lo que realmente importa en el ejemplo es el tipado (Lo que va luego de
|
|
326
|
+
* extends EventEmitter) y el this.emit en la creación del emitter; por otra
|
|
327
|
+
* parte es importante el (instance).on(...) que se muestra al final del
|
|
328
|
+
* ejemplo, que permite realizar suscripciones al EventEmitter creado.
|
|
329
|
+
*
|
|
330
|
+
* Además, es notable que cuando se realiza una suscripción mediante
|
|
331
|
+
* (instance).on, este método devuelve un método que al ser llamado rompe la
|
|
332
|
+
* suscripción; esto nos da la firma del método on como:
|
|
333
|
+
*
|
|
334
|
+
* on(eventName: string, callback: (ev: eventType) => unknown): Unsuscriptor;
|
|
335
|
+
*
|
|
336
|
+
* @example
|
|
337
|
+
*
|
|
338
|
+
* // Event emitter creation
|
|
339
|
+
*
|
|
340
|
+
* class WaiTypeAhead extends EventEmitter<{
|
|
341
|
+
multipleKeys: string;
|
|
342
|
+
singleKey: string;
|
|
343
|
+
}> {
|
|
344
|
+
// ...
|
|
345
|
+
#shout({ clear } = { clear: true }) {
|
|
346
|
+
if (this.typing.length === 1) {
|
|
347
|
+
this.emit('singleKey', this.typing);
|
|
348
|
+
} else if (this.typing.length > 1) {
|
|
349
|
+
this.emit('multipleKeys', this.typing);
|
|
350
|
+
}
|
|
351
|
+
// ...
|
|
352
|
+
}
|
|
353
|
+
// ...
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
// Usage
|
|
357
|
+
|
|
358
|
+
const wtype = new WaiTypeAhead();
|
|
359
|
+
wtype.on('multipleKeys', (typing) => {
|
|
360
|
+
write(`Multiple: ${typing}`);
|
|
361
|
+
});
|
|
362
|
+
*/
|
|
363
|
+
declare class EventEmitter<T extends TEventMap> implements IEmitter<T> {
|
|
364
|
+
#private;
|
|
365
|
+
on<K extends TEventKey<T>>(eventName: K, fn: TEventReceiver<T[K]>): () => void;
|
|
366
|
+
off<K extends TEventKey<T>>(eventName: K, fn: TEventReceiver<T[K]>): void;
|
|
367
|
+
emit<K extends TEventKey<T>>(eventName: K, params?: T[K]): void;
|
|
368
|
+
}
|
|
369
|
+
|
|
417
370
|
/**
|
|
418
371
|
* Esta clase ofrece la posibilidad de crear una variable que al ser
|
|
419
372
|
* actualizada avisa sobre la actualización.
|
|
@@ -854,10 +807,11 @@ declare const focus: {
|
|
|
854
807
|
id: string;
|
|
855
808
|
name: string;
|
|
856
809
|
selector: string;
|
|
857
|
-
}, "
|
|
810
|
+
}, "name" | "className" | "id" | "selector">): void;
|
|
858
811
|
/**
|
|
859
812
|
* Da la instrucción de colocar el foco el elemento pasado como parámetro.
|
|
860
|
-
* Se puede pasar también una función que devuelva HTMLElement | false |
|
|
813
|
+
* Se puede pasar también una función que devuelva HTMLElement | false |
|
|
814
|
+
* null.
|
|
861
815
|
*
|
|
862
816
|
* El segundo parámetro del método on es un objeto de tipo
|
|
863
817
|
* ScrollIntoViewOptions, que permite modificar el comportamiento del scroll
|
|
@@ -903,7 +857,7 @@ declare const globalFocus: {
|
|
|
903
857
|
*
|
|
904
858
|
* return <Box ref={assignRefs} ...
|
|
905
859
|
*/
|
|
906
|
-
declare function useCombinedRefs<RefType = HTMLInputElement>(...refs: (React
|
|
860
|
+
declare function useCombinedRefs<RefType = HTMLInputElement>(...refs: (React.ForwardedRef<unknown> | undefined)[]): React.Dispatch<React.SetStateAction<RefType | undefined>>;
|
|
907
861
|
|
|
908
862
|
declare const useDebouncedCallback: <Params extends any[]>(callback: (...params: Params) => unknown, { runWhenTriggered, timeout }?: {
|
|
909
863
|
runWhenTriggered: boolean;
|
|
@@ -917,13 +871,13 @@ declare const useDebouncedCallback: <Params extends any[]>(callback: (...params:
|
|
|
917
871
|
*
|
|
918
872
|
* *Investigar qué es 'react stale state'*
|
|
919
873
|
*/
|
|
920
|
-
declare function useLatest<T>(value: T): React
|
|
874
|
+
declare function useLatest<T>(value: T): React.MutableRefObject<T>;
|
|
921
875
|
|
|
922
876
|
declare function useMount(effect: EffectCallback): void;
|
|
923
877
|
|
|
924
878
|
declare function useUnmount(unmountCallback: () => void): void;
|
|
925
879
|
|
|
926
|
-
declare function usePrevious<T>(value: T): React
|
|
880
|
+
declare function usePrevious<T>(value: T): React.MutableRefObject<T | undefined>;
|
|
927
881
|
|
|
928
882
|
declare function useStateRef<T>(initialState?: T): [
|
|
929
883
|
typeof initialState extends undefined ? T | undefined : T,
|
|
@@ -946,7 +900,10 @@ type TEventsMap<OriginalEvents extends TMap> = {
|
|
|
946
900
|
[Name in keyof OriginalEvents]: (args: OriginalEvents[Name]) => unknown;
|
|
947
901
|
};
|
|
948
902
|
type TEventsHandlers<OriginalEvents extends TMap> = Record<TId, {
|
|
949
|
-
[Name in keyof OriginalEvents]?:
|
|
903
|
+
[Name in keyof OriginalEvents]?: {
|
|
904
|
+
cb: (args?: OriginalEvents[Name]) => unknown;
|
|
905
|
+
uniqueHookId: string;
|
|
906
|
+
}[];
|
|
950
907
|
}>;
|
|
951
908
|
type TMap = Record<string, any>;
|
|
952
909
|
type TStateManager<State> = (newState: Partial<State>) => void;
|
|
@@ -1007,7 +964,7 @@ declare function makeSingleImperativeComponent<ComponentProps extends TMap, Even
|
|
|
1007
964
|
Component: FC<Omit<ComponentProps, "id"> & State>;
|
|
1008
965
|
}) => [TSingleMethodsMap<Methods, TMethodsMap<Methods>>, <K extends keyof Events>(ev: K, args: Events[K]) => void, FC<ComponentProps>];
|
|
1009
966
|
|
|
1010
|
-
declare const useImperativeComponentEvents: <Events extends TMap = TMap>(handlers: Partial<TEventsMap<Events>>) =>
|
|
967
|
+
declare const useImperativeComponentEvents: <Events extends TMap = TMap>(handlers: Partial<TEventsMap<Events>>) => string;
|
|
1011
968
|
|
|
1012
969
|
/**
|
|
1013
970
|
* Permite el uso de eventos en herederos directos o no del imperativeComponent
|
|
@@ -1018,23 +975,14 @@ declare function useImperativeComponentContext<Events extends TMap = TMap>(): {
|
|
|
1018
975
|
eventsStore: TEventsHandlers<Events>;
|
|
1019
976
|
};
|
|
1020
977
|
|
|
1021
|
-
declare global {
|
|
1022
|
-
interface Window {
|
|
1023
|
-
labels: {
|
|
1024
|
-
[key: string]: {
|
|
1025
|
-
text: string;
|
|
1026
|
-
tooltip: string;
|
|
1027
|
-
};
|
|
1028
|
-
};
|
|
1029
|
-
}
|
|
1030
|
-
}
|
|
1031
978
|
/**
|
|
1032
979
|
* Dado un nombre de etiqueta, devuelve el texto que esa etiqueta contiene en
|
|
1033
980
|
* el idioma actual. En este momento, lo único que hace realmente esta función
|
|
1034
|
-
* es devolver la variable del window con el mismo nombre que se está
|
|
981
|
+
* es devolver la variable del window con el mismo nombre que se está
|
|
982
|
+
* pidiendo.
|
|
1035
983
|
*
|
|
1036
|
-
* La idea de implementar esta función, es que en un futuro la fuente de la
|
|
1037
|
-
* provienen las labels pueda ser más diversa.
|
|
984
|
+
* La idea de implementar esta función, es que en un futuro la fuente de la
|
|
985
|
+
* que provienen las labels pueda ser más diversa.
|
|
1038
986
|
*
|
|
1039
987
|
* Permite el pasaje de tokens para el reemplazo automático de los mismos.
|
|
1040
988
|
*
|
|
@@ -1076,99 +1024,6 @@ declare const formatMessage: (str: string, obj: {
|
|
|
1076
1024
|
[key: string]: string;
|
|
1077
1025
|
}) => string;
|
|
1078
1026
|
|
|
1079
|
-
type TTabRenderer<AdditionalPropsType extends Record<string, unknown> = Record<string, unknown>> = (props: {
|
|
1080
|
-
tab: TTab<AdditionalPropsType>;
|
|
1081
|
-
}) => React.ReactElement;
|
|
1082
|
-
type TApiaTabProps = {
|
|
1083
|
-
originalUrl: string;
|
|
1084
|
-
url: string;
|
|
1085
|
-
};
|
|
1086
|
-
type TTab<AdditionalPropsType extends Record<string, unknown> = Record<string, unknown>> = {
|
|
1087
|
-
content: React.FunctionComponent<{
|
|
1088
|
-
tab: TTab<AdditionalPropsType>;
|
|
1089
|
-
}>;
|
|
1090
|
-
icon?: TIconName | TIconType;
|
|
1091
|
-
/**
|
|
1092
|
-
* El id es importante ya que se utiliza por temas de accesibilidad. Es
|
|
1093
|
-
* importante asegurarse de que sea único.*/
|
|
1094
|
-
id: TId;
|
|
1095
|
-
isClosable?: boolean;
|
|
1096
|
-
isDisabled?: boolean;
|
|
1097
|
-
/**
|
|
1098
|
-
* Los tabs que estén marcados como fixed aparecerán al inicio del listado.
|
|
1099
|
-
*/
|
|
1100
|
-
isFixed?: boolean;
|
|
1101
|
-
isFocused?: boolean;
|
|
1102
|
-
/**
|
|
1103
|
-
* Si se marca como iconTab, se oculta el label y solamente se muestra el
|
|
1104
|
-
* ícono.
|
|
1105
|
-
*/
|
|
1106
|
-
isIconTab?: boolean;
|
|
1107
|
-
isLoading?: boolean;
|
|
1108
|
-
isOpen?: boolean;
|
|
1109
|
-
/**
|
|
1110
|
-
* Cuando se cierra un tab que tiene un método onBeforeClose, el mismo será
|
|
1111
|
-
* llamado y deberá devolver un boolean o un string. Si devuelve true, se
|
|
1112
|
-
* cierra. Si devuelve false, se muestra un cartel de confirmación genérico y
|
|
1113
|
-
* si se devuelve un string, se muestra un cartel de confirmación con el
|
|
1114
|
-
* string devuelto. En caso de que el usuario confirme el cuadro de diálogo,
|
|
1115
|
-
* el tab será cerrado de todas formas. Es decir, no hay forma de evitar que
|
|
1116
|
-
* el tab sea cerrado si el usuario decide continuar con la acción. Para
|
|
1117
|
-
* evitar que un tab sea cerrado, debe pasarse isClosable=false
|
|
1118
|
-
*/
|
|
1119
|
-
onBeforeClose?: () => boolean | string | Promise<boolean | string>;
|
|
1120
|
-
/**
|
|
1121
|
-
* Este callback será llamado cada vez que el tab sea abierto
|
|
1122
|
-
*/
|
|
1123
|
-
onFocus?: (ev: TTab<AdditionalPropsType>) => unknown;
|
|
1124
|
-
/**
|
|
1125
|
-
* Es el texto que se va a mostrar en el tab
|
|
1126
|
-
*/
|
|
1127
|
-
label: string;
|
|
1128
|
-
labelRenderer?: TTabRenderer;
|
|
1129
|
-
/**
|
|
1130
|
-
* Se pueden pasar propiedades adicionales que serán recibidas en cada
|
|
1131
|
-
* evento, de forma de poder compartir piezas de información útiles en las
|
|
1132
|
-
* distintas partes de la aplicación.
|
|
1133
|
-
*/
|
|
1134
|
-
tabAdditionalProps: AdditionalPropsType;
|
|
1135
|
-
title?: string;
|
|
1136
|
-
};
|
|
1137
|
-
interface IMainTabsController<AdditionalPropsType extends Record<string, unknown> = Record<string, unknown>, TabType extends TTab<AdditionalPropsType> = TTab<AdditionalPropsType>> {
|
|
1138
|
-
activeTabs: TabType[];
|
|
1139
|
-
tabsList: TId[];
|
|
1140
|
-
append(tab: Omit<TabType, 'tabAdditionalProps'> & Partial<Pick<TabType, 'tabAdditionalProps'>>): void;
|
|
1141
|
-
closeAll(closeFixedTabsAsWell?: boolean, force?: boolean): Promise<void>;
|
|
1142
|
-
closeToRight(targetId: TId): Promise<void>;
|
|
1143
|
-
closeToLeft(targetId: TId): Promise<void>;
|
|
1144
|
-
closeOthers(targetId: TId): Promise<void>;
|
|
1145
|
-
closeTab(tabId: TId, force?: boolean): Promise<boolean>;
|
|
1146
|
-
focusNextTab(): TId | null;
|
|
1147
|
-
focusPreviousTab(): TId | null;
|
|
1148
|
-
focusTab(tabId: TId): void;
|
|
1149
|
-
getTabById(tabId: TId): TabType;
|
|
1150
|
-
getTabElement(tabId: TId): Element | null;
|
|
1151
|
-
handleKeyDown(ev: React.KeyboardEvent): void;
|
|
1152
|
-
openNextTab(): TId | null;
|
|
1153
|
-
openPreviousTab(): TId | null;
|
|
1154
|
-
openTab(tabId: TId, justThis?: boolean): void;
|
|
1155
|
-
}
|
|
1156
|
-
interface ITabsController {
|
|
1157
|
-
handler: IMainTabsController<TApiaTabProps>;
|
|
1158
|
-
handlerSet: boolean;
|
|
1159
|
-
closeActiveTab(force?: boolean): void;
|
|
1160
|
-
closeAll(closeFixedTabsAsWell?: boolean, force?: boolean): void;
|
|
1161
|
-
openMainMenu(): void;
|
|
1162
|
-
openTabByUrl(title: string, url: string, options?: IOpenTabOptions): void;
|
|
1163
|
-
setHandler(handler: IMainTabsController<TApiaTabProps>): void;
|
|
1164
|
-
changeTabState(): void;
|
|
1165
|
-
}
|
|
1166
|
-
interface IOpenTabOptions {
|
|
1167
|
-
funcId?: TId;
|
|
1168
|
-
keepMenuOpen?: boolean;
|
|
1169
|
-
parentTabId?: string;
|
|
1170
|
-
}
|
|
1171
|
-
|
|
1172
1027
|
interface ISetBoundary {
|
|
1173
1028
|
number?: number | string;
|
|
1174
1029
|
min?: number;
|
|
@@ -1276,31 +1131,31 @@ interface IPropsStoreConf {
|
|
|
1276
1131
|
propsLog?: string;
|
|
1277
1132
|
};
|
|
1278
1133
|
}
|
|
1279
|
-
declare class PropsStore<PropsType extends Record<TId
|
|
1134
|
+
declare class PropsStore<PropsType extends Record<TId, unknown> = Record<TId, unknown>> {
|
|
1280
1135
|
private configuration?;
|
|
1281
1136
|
log: unknown;
|
|
1282
|
-
fields: Record<TId
|
|
1283
|
-
suscriptors: Record<TId
|
|
1137
|
+
fields: Record<TId, PropsType>;
|
|
1138
|
+
suscriptors: Record<TId, TPropsSuscriptor<PropsType>[]>;
|
|
1284
1139
|
loggers: Record<string, (props: unknown[]) => void>;
|
|
1285
1140
|
constructor(configuration?: IPropsStoreConf | undefined);
|
|
1286
1141
|
destructor(): void;
|
|
1287
|
-
getAllFields(): Record<TId
|
|
1142
|
+
getAllFields(): Record<TId, PropsType>;
|
|
1288
1143
|
/**
|
|
1289
1144
|
* Devuelve los props actuales de un campo.
|
|
1290
1145
|
*/
|
|
1291
|
-
getFieldProps<ParsedPropsType = PropsType>(fieldId: TId
|
|
1292
|
-
removeField(fieldId: TId
|
|
1146
|
+
getFieldProps<ParsedPropsType = PropsType>(fieldId: TId): ParsedPropsType;
|
|
1147
|
+
removeField(fieldId: TId): void;
|
|
1293
1148
|
/**
|
|
1294
1149
|
* Permite establecer un suscriptor que será llamado
|
|
1295
1150
|
* cada vez que las props del campo especificado cambien.
|
|
1296
1151
|
*/
|
|
1297
|
-
suscribe(fieldId: TId
|
|
1152
|
+
suscribe(fieldId: TId, callback: TPropsSuscriptor<PropsType>): () => void;
|
|
1298
1153
|
/**
|
|
1299
1154
|
* Actualiza o crea las props de un campo.
|
|
1300
1155
|
*
|
|
1301
1156
|
* La tercera prop está relacionada
|
|
1302
1157
|
*/
|
|
1303
|
-
updateField<NewPropsType extends Record<TId
|
|
1158
|
+
updateField<NewPropsType extends Record<TId, unknown> = Partial<PropsType>>(fieldId: TId, props: Partial<NewPropsType>, conf?: TUpdateFieldConfiguration): void;
|
|
1304
1159
|
}
|
|
1305
1160
|
declare const propsStore: PropsStore<TProperties>;
|
|
1306
1161
|
|
|
@@ -1338,7 +1193,7 @@ declare function isPropsConfigurationObject<Selected, PropsType extends Record<s
|
|
|
1338
1193
|
* en el store.
|
|
1339
1194
|
* @returns
|
|
1340
1195
|
*/
|
|
1341
|
-
declare function usePropsSelector<Selected = TProperties, PropsType extends Record<string, unknown> = TProperties>(fieldId: TId
|
|
1196
|
+
declare function usePropsSelector<Selected = TProperties, PropsType extends Record<string, unknown> = TProperties>(fieldId: TId, configuration?: TPropsConfiguration<Selected, PropsType>): Selected;
|
|
1342
1197
|
/**
|
|
1343
1198
|
*
|
|
1344
1199
|
* Este hook permite escuchar los cambios en las propiedades
|
|
@@ -1364,7 +1219,7 @@ declare function usePropsSelector<Selected = TProperties, PropsType extends Reco
|
|
|
1364
1219
|
*
|
|
1365
1220
|
* @returns
|
|
1366
1221
|
*/
|
|
1367
|
-
declare function usePropsSelector<Selected = TProperties, PropsType extends Record<string, unknown> = TProperties>(fieldId: TId
|
|
1222
|
+
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;
|
|
1368
1223
|
|
|
1369
1224
|
/**
|
|
1370
1225
|
* El hook useDomState permite aplicar propiedades a un
|
|
@@ -1500,7 +1355,7 @@ declare const screenLocker: {
|
|
|
1500
1355
|
unlock(lockName?: string): void;
|
|
1501
1356
|
force(): void;
|
|
1502
1357
|
releaseForced(): void;
|
|
1503
|
-
"__#
|
|
1358
|
+
"__#2@#emitter": IEmitter<{
|
|
1504
1359
|
forcedStateChange: {
|
|
1505
1360
|
hasReleasedFirstTime: boolean;
|
|
1506
1361
|
isForced: boolean;
|
|
@@ -1633,11 +1488,4 @@ declare function toBoolean(value: unknown): boolean;
|
|
|
1633
1488
|
|
|
1634
1489
|
declare const parseXmlAsync: <T>(xml: string) => Promise<T>;
|
|
1635
1490
|
|
|
1636
|
-
|
|
1637
|
-
interface Window {
|
|
1638
|
-
[key: string]: string;
|
|
1639
|
-
}
|
|
1640
|
-
}
|
|
1641
|
-
|
|
1642
|
-
export { AriaLiveEmitter, EventEmitter, IOnFocusConfiguration, IParameter, ISetBoundary, ITabsController, LiveRegion, PropsSelectorUndefinedObject, PropsStore, TApiaAction, TApiaActions, TApiaCellDefinition, TApiaComplexCell, TApiaFieldPropsObj, TApiaFilter, TApiaFilterOption, TApiaFilterValue, TApiaFormButton, TApiaFormElement, TApiaFormElementOption, TApiaFunction, TApiaFunctionPageInfo, TApiaLoad, TApiaLoadForm, TApiaLoadText, TApiaMessage, TApiaMultiplePossibleValue, TApiaPossibleValue, TApiaRadioPossibleValue, TApiaRowDefinition, TApiaSelectPossibleValue, TApiaSystemMessageObj, TApiaTableFunction, TCallback, TDateFormat, TDispatchCallback, TFieldEvent, TFieldScriptEvent, TFieldScriptEvents, TFieldServerEvent, TFieldServerEvents, TFncParams, TFocusRetriever, TId, TKey, TMap$1 as TMap, TMessage, TModify, TNotificationMessage, TPropsComparator, TPropsConfiguration, TPropsSelector, TRequireOnlyOne, TShortcutBranch, TUpdateFieldConfiguration, Url, WithEventsValue, addBoundary, apiaDateToStandarFormat, arrayOrArray, autoDisconnectMutationObserver, cantFocusSelector, customEvents, dateToApiaFormat, debugDispatcher, decrypt, disableChildrenFocus, downloadUrl, enableChildrenFocus, enableDebugDispatcher, encrypt, findOffsetRelativeToScrollParent, findScrollContainer, focus, focusSelector, formatMessage, getDateFormat, getFocusSelector, getIndex, getLabel, getSpecificParent, getValueByPath, globalFocus, isChild, isDebugDispatcherEnabled, isPropsConfigurationObject, makeImperativeComponent, makeSingleImperativeComponent, noNaN, notificationsSelector, parseAsSize, parseXmlAsync, persistentStorage, propsStore, screenLocker, scrollParentIntoElement, setValueByPath, shortcutController, toBoolean, ucfirst, useCombinedRefs, useDebouncedCallback, useDebouncedState, useDomState, useImperativeComponentContext, useImperativeComponentEvents, useLatest, useLocalStorage, useMount, usePanAndZoom, usePrevious, usePropsSelector, useStateRef, useUnmount, useUpdateEffect };
|
|
1643
|
-
//# sourceMappingURL=index.d.ts.map
|
|
1491
|
+
export { EventEmitter, IOnFocusConfiguration, IParameter, ISetBoundary, PropsSelectorUndefinedObject, PropsStore, TApiaAction, TApiaActions, TApiaCellDefinition, TApiaComplexCell, TApiaFieldPropsObj, TApiaFilter, TApiaFilterOption, TApiaFilterValue, TApiaFormButton, TApiaFormElement, TApiaFormElementOption, TApiaFunction, TApiaFunctionPageInfo, TApiaLoad, TApiaLoadForm, TApiaLoadText, TApiaMessage, TApiaMultiplePossibleValue, TApiaPossibleValue, TApiaRadioPossibleValue, TApiaRowDefinition, TApiaSelectPossibleValue, TApiaSystemMessageObj, TApiaTableFunction, TCallback, TDateFormat, TDispatchCallback, TFieldEvent, TFieldScriptEvent, TFieldScriptEvents, TFieldServerEvent, TFieldServerEvents, TFncParams, TFocusRetriever, TId, TKey, TMap$1 as TMap, TMessage, TModify, TNotificationMessage, TPropsComparator, TPropsConfiguration, TPropsSelector, TRequireOnlyOne, TShortcutBranch, TUpdateFieldConfiguration, Url, WithEventsValue, addBoundary, animate, apiaDateToStandarFormat, arrayOrArray, autoDisconnectMutationObserver, cantFocusSelector, customEvents, dateToApiaFormat, debugDispatcher, decrypt, disableChildrenFocus, downloadUrl, enableChildrenFocus, enableDebugDispatcher, encrypt, findOffsetRelativeToScrollParent, findScrollContainer, focus, focusSelector, formatMessage, getDateFormat, getFocusSelector, getIndex, getLabel, getSpecificParent, getValueByPath, globalFocus, isChild, isDebugDispatcherEnabled, isPropsConfigurationObject, makeImperativeComponent, makeSingleImperativeComponent, noNaN, notificationsSelector, parseAsSize, parseXmlAsync, persistentStorage, propsStore, screenLocker, scrollParentIntoElement, setValueByPath, shortcutController, toBoolean, ucfirst, useCombinedRefs, useDebouncedCallback, useDebouncedState, useDomState, useImperativeComponentContext, useImperativeComponentEvents, useLatest, useLocalStorage, useMount, usePanAndZoom, usePrevious, usePropsSelector, useStateRef, useUnmount, useUpdateEffect };
|