corekit-ui 0.1.14 → 0.1.16
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/animations/Transiciones.d.ts +9 -0
- package/dist/animations/index.d.ts +1 -0
- package/dist/badge/Badge.d.ts +3 -0
- package/dist/badge/index.d.ts +2 -0
- package/dist/badge/types.d.ts +62 -0
- package/dist/boton/Boton.d.ts +2 -0
- package/dist/boton/index.d.ts +2 -0
- package/dist/boton/typesButton.d.ts +35 -0
- package/dist/checkbox/Checkbox.d.ts +24 -0
- package/dist/checkbox/CheckboxContext.d.ts +3 -0
- package/dist/checkbox/CheckboxGroup.d.ts +2 -0
- package/dist/checkbox/index.d.ts +4 -0
- package/dist/checkbox/types.d.ts +57 -0
- package/dist/corekit-ui.css +1 -1
- package/dist/drawer/Drawer.d.ts +2 -0
- package/dist/drawer/index.d.ts +2 -0
- package/dist/drawer/types.d.ts +140 -0
- package/dist/firma_manual/FirmaManual.d.ts +3 -0
- package/dist/firma_manual/Iconografia.d.ts +16 -0
- package/dist/firma_manual/TypesFirma.d.ts +22 -0
- package/dist/firma_manual/index.d.ts +2 -0
- package/dist/firma_manual/useFirmaLogica.d.ts +10 -0
- package/dist/hablar_escuchar/BadgeVoz.d.ts +6 -0
- package/dist/hablar_escuchar/Iconografia.d.ts +10 -0
- package/dist/hablar_escuchar/index.d.ts +3 -0
- package/dist/hablar_escuchar/useReconocimientoVoz.d.ts +21 -0
- package/dist/index.d.ts +20 -3744
- package/dist/index.js +4944 -4879
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +6 -6
- package/dist/index.umd.cjs.map +1 -1
- package/dist/input_date/InputDate.d.ts +342 -0
- package/dist/input_date/funciones.d.ts +27 -0
- package/dist/input_date/index.d.ts +3 -0
- package/dist/input_date/types.d.ts +70 -0
- package/dist/input_numeric/Iconografia.d.ts +5 -0
- package/dist/input_numeric/InputNumeric.d.ts +353 -0
- package/dist/input_numeric/funciones.d.ts +64 -0
- package/dist/input_numeric/index.d.ts +3 -0
- package/dist/input_numeric/types.d.ts +96 -0
- package/dist/input_text/Iconografia.d.ts +9 -0
- package/dist/input_text/InputText.d.ts +347 -0
- package/dist/input_text/index.d.ts +2 -0
- package/dist/input_text/types.d.ts +77 -0
- package/dist/input_types_compartidos/index.d.ts +1 -0
- package/dist/input_types_compartidos/types.d.ts +11 -0
- package/dist/modal/Modal.d.ts +2 -0
- package/dist/modal/index.d.ts +2 -0
- package/dist/modal/types.d.ts +115 -0
- package/dist/modal_stack/ModalStack.d.ts +14 -0
- package/dist/modal_stack/index.d.ts +2 -0
- package/dist/panel_filtros/Iconografia.d.ts +5 -0
- package/dist/panel_filtros/PanelFiltros.d.ts +49 -0
- package/dist/panel_filtros/index.d.ts +3 -0
- package/dist/radio/Radio.d.ts +16 -0
- package/dist/radio/RadioContext.d.ts +3 -0
- package/dist/radio/RadioGroup.d.ts +11 -0
- package/dist/radio/index.d.ts +3 -0
- package/dist/radio/types.d.ts +195 -0
- package/dist/select/Iconografia.d.ts +10 -0
- package/dist/select/Select.d.ts +42 -0
- package/dist/select/SelectBase.d.ts +17 -0
- package/dist/select/SelectNativo.d.ts +57 -0
- package/dist/select/Types.d.ts +629 -0
- package/dist/select/funciones.d.ts +229 -0
- package/dist/select/index.d.ts +4 -0
- package/dist/tabla_datos/TablaDatos.d.ts +80 -0
- package/dist/tabla_datos/components/Iconografia.d.ts +17 -0
- package/dist/tabla_datos/components/TablaCards.d.ts +1 -0
- package/dist/tabla_datos/components/TablaEscritorio.d.ts +1 -0
- package/dist/tabla_datos/components/configuraciones/ConfigColumnas.d.ts +1 -0
- package/dist/tabla_datos/components/configuraciones/ConfigEncabezado.d.ts +6 -0
- package/dist/tabla_datos/components/configuraciones/ConfigFilas.d.ts +1 -0
- package/dist/tabla_datos/components/configuraciones/ConfigOpciones.d.ts +6 -0
- package/dist/tabla_datos/components/configuraciones/MenuConfiguraciones.d.ts +1 -0
- package/dist/tabla_datos/components/skeletons/SkeletonCargando.d.ts +4 -0
- package/dist/tabla_datos/components/skeletons/SkeletonCargandoCards.d.ts +2 -0
- package/dist/tabla_datos/components/tabla/BarraHerramientas.d.ts +1 -0
- package/dist/tabla_datos/components/tabla/BarraSeleccion.d.ts +9 -0
- package/dist/tabla_datos/components/tabla/Paginacion.d.ts +1 -0
- package/dist/tabla_datos/components/tabla/SinDatos.d.ts +1 -0
- package/dist/tabla_datos/components/tabla/tabla_cards/AccionesCards.d.ts +3 -0
- package/dist/tabla_datos/components/tabla/tabla_cards/ContenidoCards.d.ts +3 -0
- package/dist/tabla_datos/components/tabla/tabla_cards/EncabezadoCards.d.ts +3 -0
- package/dist/tabla_datos/constantes/ConstGenerales.d.ts +18 -0
- package/dist/tabla_datos/context/ContextTypes.d.ts +23 -0
- package/dist/tabla_datos/context/TablaDatosContext.d.ts +3 -0
- package/dist/tabla_datos/context/hooks.d.ts +10 -0
- package/dist/tabla_datos/hooks/useClickOutside.d.ts +8 -0
- package/dist/tabla_datos/hooks/useEscapeKey.d.ts +1 -0
- package/dist/tabla_datos/hooks/usePopoverPosition.d.ts +15 -0
- package/dist/tabla_datos/hooks/useScrollLock.d.ts +1 -0
- package/dist/tabla_datos/index.d.ts +5 -0
- package/dist/tabla_datos/types/TablaTypes.d.ts +85 -0
- package/dist/tabla_datos/types/tanstack-table.d.ts +6 -0
- package/dist/tabla_datos/utils/FuncionesColumnas.d.ts +9 -0
- package/dist/tabla_datos/utils/FuncionesPaginacion.d.ts +12 -0
- package/dist/tabla_datos/utils/FuncionesTabla.d.ts +30 -0
- package/dist/text_area/Iconografia.d.ts +6 -0
- package/dist/text_area/TextArea.d.ts +333 -0
- package/dist/text_area/index.d.ts +2 -0
- package/dist/text_area/types.d.ts +76 -0
- package/dist/texts/Texts.d.ts +19 -0
- package/dist/toggle/Toggle.d.ts +21 -0
- package/dist/toggle/index.d.ts +2 -0
- package/dist/toggle/types.d.ts +90 -0
- package/dist/tooltip/Tooltip.d.ts +2 -0
- package/dist/tooltip/index.d.ts +2 -0
- package/dist/tooltip/types.d.ts +83 -0
- package/package.json +1 -8
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Funciones utilitarias para el componente Select
|
|
3
|
+
* @module Select/funciones
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Opción de grupo para categorización
|
|
7
|
+
*/
|
|
8
|
+
export type OpcionGrupo<T> = {
|
|
9
|
+
/** Nombre del grupo */
|
|
10
|
+
grupo: string;
|
|
11
|
+
/** Opciones dentro del grupo */
|
|
12
|
+
opciones: T[];
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Opción plana con información de grupo
|
|
16
|
+
*/
|
|
17
|
+
export type OpcionPlana<T> = {
|
|
18
|
+
/** Tipo: 'grupo' para encabezado, 'opcion' para ítem */
|
|
19
|
+
tipo: 'grupo' | 'opcion';
|
|
20
|
+
/** Datos de la opción (null si es encabezado de grupo) */
|
|
21
|
+
datos: T | null;
|
|
22
|
+
/** Nombre del grupo (para encabezados) */
|
|
23
|
+
nombreGrupo?: string;
|
|
24
|
+
/** Índice real en la lista plana */
|
|
25
|
+
indice: number;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Obtiene el label de una opción
|
|
29
|
+
* @template T - Tipo de la opción
|
|
30
|
+
* @param opcion - La opción de la cual extraer el label
|
|
31
|
+
* @param claveLabel - Campo del objeto a usar como label
|
|
32
|
+
* @returns El texto del label
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```ts
|
|
36
|
+
* // Con string
|
|
37
|
+
* obtenerLabelOpcion('Manzana', 'label') // 'Manzana'
|
|
38
|
+
*
|
|
39
|
+
* // Con objeto
|
|
40
|
+
* obtenerLabelOpcion({ nombre: 'Colombia', id: 'co' }, 'nombre') // 'Colombia'
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export declare function obtenerLabelOpcion<T>(opcion: T, claveLabel: string): string;
|
|
44
|
+
/**
|
|
45
|
+
* Obtiene el valor único de una opción
|
|
46
|
+
* @template T - Tipo de la opción
|
|
47
|
+
* @param opcion - La opción de la cual extraer el valor
|
|
48
|
+
* @param claveValor - Campo del objeto a usar como valor
|
|
49
|
+
* @returns El valor único de la opción
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```ts
|
|
53
|
+
* // Con string
|
|
54
|
+
* obtenerValorOpcion('Manzana', 'id') // 'Manzana'
|
|
55
|
+
*
|
|
56
|
+
* // Con objeto
|
|
57
|
+
* obtenerValorOpcion({ nombre: 'Colombia', id: 'co' }, 'id') // 'co'
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
export declare function obtenerValorOpcion<T>(opcion: T, claveValor: string): string;
|
|
61
|
+
/**
|
|
62
|
+
* Verifica si una opción está deshabilitada
|
|
63
|
+
* @template T - Tipo de la opción
|
|
64
|
+
* @param opcion - La opción a verificar
|
|
65
|
+
* @returns true si la opción tiene disabled: true
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```ts
|
|
69
|
+
* estaDeshabilitada({ label: 'Opción', disabled: true }) // true
|
|
70
|
+
* estaDeshabilitada({ label: 'Opción' }) // false
|
|
71
|
+
* estaDeshabilitada('Texto simple') // false
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
74
|
+
export declare function estaDeshabilitada<T>(opcion: T): boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Verifica si una opción está seleccionada
|
|
77
|
+
* @template T - Tipo de la opción
|
|
78
|
+
* @param opcion - La opción a verificar
|
|
79
|
+
* @param valorActual - El valor actual (puede ser single o array para multi)
|
|
80
|
+
* @param esMultiple - Si el select permite múltiple selección
|
|
81
|
+
* @param claveValor - Campo a usar para comparación
|
|
82
|
+
* @returns true si la opción está seleccionada
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* ```ts
|
|
86
|
+
* // Selección simple
|
|
87
|
+
* estaSeleccionada('Manzana', 'Manzana', false, 'id') // true
|
|
88
|
+
*
|
|
89
|
+
* // Selección múltiple
|
|
90
|
+
* estaSeleccionada('Manzana', ['Manzana', 'Pera'], true, 'id') // true
|
|
91
|
+
* ```
|
|
92
|
+
*/
|
|
93
|
+
export declare function estaSeleccionada<T>(opcion: T, valorActual: T | T[] | null, esMultiple: boolean, claveValor: string): boolean;
|
|
94
|
+
/**
|
|
95
|
+
* Filtra las opciones según el texto de búsqueda
|
|
96
|
+
* @template T - Tipo de las opciones
|
|
97
|
+
* @param opciones - Lista de opciones a filtrar
|
|
98
|
+
* @param textoBusqueda - Texto a buscar
|
|
99
|
+
* @param claveLabel - Campo a usar para la búsqueda
|
|
100
|
+
* @param funcionFiltro - Función de filtro personalizada (opcional)
|
|
101
|
+
* @returns Lista de opciones filtradas
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* ```ts
|
|
105
|
+
* const frutas = ['Manzana', 'Mandarina', 'Pera'];
|
|
106
|
+
* filtrarOpciones(frutas, 'man', 'label') // ['Manzana', 'Mandarina']
|
|
107
|
+
* ```
|
|
108
|
+
*/
|
|
109
|
+
export declare function filtrarOpciones<T>(opciones: T[], textoBusqueda: string, claveLabel: string, funcionFiltro?: (opcion: T, busqueda: string) => boolean): T[];
|
|
110
|
+
/**
|
|
111
|
+
* Verifica si las opciones están agrupadas
|
|
112
|
+
* @template T - Tipo de las opciones
|
|
113
|
+
* @param opciones - Lista de opciones
|
|
114
|
+
* @returns true si las opciones tienen estructura de grupo
|
|
115
|
+
*
|
|
116
|
+
* @example
|
|
117
|
+
* ```ts
|
|
118
|
+
* esOpcionesAgrupadas([{ grupo: 'Frutas', opciones: ['Manzana'] }]) // true
|
|
119
|
+
* esOpcionesAgrupadas(['Manzana', 'Pera']) // false
|
|
120
|
+
* ```
|
|
121
|
+
*/
|
|
122
|
+
export declare function esOpcionesAgrupadas<T>(opciones: (T | OpcionGrupo<T>)[]): opciones is OpcionGrupo<T>[];
|
|
123
|
+
/**
|
|
124
|
+
* Aplana opciones agrupadas a una lista lineal con metadatos
|
|
125
|
+
* @template T - Tipo de las opciones
|
|
126
|
+
* @param opcionesAgrupadas - Lista de grupos de opciones
|
|
127
|
+
* @returns Lista plana con encabezados de grupo y opciones
|
|
128
|
+
*
|
|
129
|
+
* @example
|
|
130
|
+
* ```ts
|
|
131
|
+
* const grupos = [
|
|
132
|
+
* { grupo: 'Frutas', opciones: ['Manzana', 'Pera'] },
|
|
133
|
+
* { grupo: 'Verduras', opciones: ['Zanahoria'] }
|
|
134
|
+
* ];
|
|
135
|
+
* aplanarOpcionesAgrupadas(grupos)
|
|
136
|
+
* // [
|
|
137
|
+
* // { tipo: 'grupo', datos: null, nombreGrupo: 'Frutas', indice: 0 },
|
|
138
|
+
* // { tipo: 'opcion', datos: 'Manzana', indice: 1 },
|
|
139
|
+
* // { tipo: 'opcion', datos: 'Pera', indice: 2 },
|
|
140
|
+
* // { tipo: 'grupo', datos: null, nombreGrupo: 'Verduras', indice: 3 },
|
|
141
|
+
* // { tipo: 'opcion', datos: 'Zanahoria', indice: 4 }
|
|
142
|
+
* // ]
|
|
143
|
+
* ```
|
|
144
|
+
*/
|
|
145
|
+
export declare function aplanarOpcionesAgrupadas<T>(opcionesAgrupadas: OpcionGrupo<T>[]): OpcionPlana<T>[];
|
|
146
|
+
/**
|
|
147
|
+
* Filtra opciones agrupadas manteniendo la estructura de grupos
|
|
148
|
+
* @template T - Tipo de las opciones
|
|
149
|
+
* @param grupos - Lista de grupos de opciones
|
|
150
|
+
* @param textoBusqueda - Texto a buscar
|
|
151
|
+
* @param claveLabel - Campo a usar para la búsqueda
|
|
152
|
+
* @param funcionFiltro - Función de filtro personalizada (opcional)
|
|
153
|
+
* @returns Grupos filtrados (elimina grupos vacíos)
|
|
154
|
+
*
|
|
155
|
+
* @example
|
|
156
|
+
* ```ts
|
|
157
|
+
* const grupos = [
|
|
158
|
+
* { grupo: 'Frutas', opciones: ['Manzana', 'Pera'] },
|
|
159
|
+
* { grupo: 'Verduras', opciones: ['Zanahoria'] }
|
|
160
|
+
* ];
|
|
161
|
+
* filtrarOpcionesAgrupadas(grupos, 'man', 'label')
|
|
162
|
+
* // [{ grupo: 'Frutas', opciones: ['Manzana'] }]
|
|
163
|
+
* ```
|
|
164
|
+
*/
|
|
165
|
+
export declare function filtrarOpcionesAgrupadas<T>(grupos: OpcionGrupo<T>[], textoBusqueda: string, claveLabel: string, funcionFiltro?: (opcion: T, busqueda: string) => boolean): OpcionGrupo<T>[];
|
|
166
|
+
/**
|
|
167
|
+
* Obtiene los índices de opciones deshabilitadas (excluyendo encabezados de grupo)
|
|
168
|
+
* @template T - Tipo de las opciones
|
|
169
|
+
* @param opcionesPlanas - Lista plana de opciones con metadatos
|
|
170
|
+
* @returns Array de índices de opciones deshabilitadas
|
|
171
|
+
*/
|
|
172
|
+
export declare function obtenerIndicesDeshabilitados<T>(opcionesPlanas: OpcionPlana<T>[]): number[];
|
|
173
|
+
/**
|
|
174
|
+
* Ejecuta la validación y obtiene el mensaje de error
|
|
175
|
+
* @template T - Tipo del valor
|
|
176
|
+
* @param valor - Valor a validar
|
|
177
|
+
* @param funcionValidar - Función de validación
|
|
178
|
+
* @returns Mensaje de error o null si es válido
|
|
179
|
+
*
|
|
180
|
+
* @example
|
|
181
|
+
* ```ts
|
|
182
|
+
* ejecutarValidacion(null, (v) => v ? true : 'Requerido') // 'Requerido'
|
|
183
|
+
* ejecutarValidacion('Manzana', (v) => v ? true : 'Requerido') // null
|
|
184
|
+
* ```
|
|
185
|
+
*/
|
|
186
|
+
export declare function ejecutarValidacion<T>(valor: T | T[] | null, funcionValidar?: (valor: T | T[] | null) => boolean | string | {
|
|
187
|
+
message?: string;
|
|
188
|
+
} | null | undefined): string | null;
|
|
189
|
+
/**
|
|
190
|
+
* Determina si el campo está en estado inválido
|
|
191
|
+
* @param esInvalidoProp - Prop isInvalid
|
|
192
|
+
* @param estadoValidacion - Prop validationState
|
|
193
|
+
* @param errorInterno - Error de validación interna
|
|
194
|
+
* @returns true si el campo es inválido
|
|
195
|
+
*/
|
|
196
|
+
export declare function determinarEsInvalido(esInvalidoProp: boolean | undefined, estadoValidacion: 'valid' | 'invalid' | undefined, errorInterno: string | null): boolean;
|
|
197
|
+
/**
|
|
198
|
+
* Genera una lista de opciones aleatorias para pruebas
|
|
199
|
+
* @param cantidad - Número de opciones a generar
|
|
200
|
+
* @param prefijo - Prefijo para el texto de cada opción
|
|
201
|
+
* @returns Lista de strings con las opciones generadas
|
|
202
|
+
*
|
|
203
|
+
* @example
|
|
204
|
+
* ```ts
|
|
205
|
+
* generarOpcionesAleatorias(3, 'Usuario')
|
|
206
|
+
* // ['Usuario 1', 'Usuario 2', 'Usuario 3']
|
|
207
|
+
* ```
|
|
208
|
+
*/
|
|
209
|
+
export declare function generarOpcionesAleatorias(cantidad: number, prefijo?: string): string[];
|
|
210
|
+
/**
|
|
211
|
+
* Genera objetos de prueba con id y nombre
|
|
212
|
+
* @param cantidad - Número de objetos a generar
|
|
213
|
+
* @param prefijo - Prefijo para el nombre
|
|
214
|
+
* @returns Lista de objetos { id, nombre, email }
|
|
215
|
+
*
|
|
216
|
+
* @example
|
|
217
|
+
* ```ts
|
|
218
|
+
* generarUsuariosPrueba(2)
|
|
219
|
+
* // [
|
|
220
|
+
* // { id: 'usr-1', nombre: 'Usuario 1', email: 'usuario1@test.com' },
|
|
221
|
+
* // { id: 'usr-2', nombre: 'Usuario 2', email: 'usuario2@test.com' }
|
|
222
|
+
* // ]
|
|
223
|
+
* ```
|
|
224
|
+
*/
|
|
225
|
+
export declare function generarUsuariosPrueba(cantidad: number): Array<{
|
|
226
|
+
id: string;
|
|
227
|
+
nombre: string;
|
|
228
|
+
email: string;
|
|
229
|
+
}>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { Select, default } from './Select';
|
|
2
|
+
export type { SelectProps, SelectRef, SelectOption, SelectOptionState, SmartSelectProps, SelectStringProps, SelectMultiStringProps, SelectObjectIdProps, SelectMultiObjectIdProps, SelectObjectFullProps, SelectMultiObjectFullProps, } from './Types';
|
|
3
|
+
export type { OpcionGrupo, OpcionPlana } from './funciones';
|
|
4
|
+
export { generarOpcionesAleatorias, generarUsuariosPrueba } from './funciones';
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { TablaDatosProps } from './types/TablaTypes';
|
|
2
|
+
/**
|
|
3
|
+
* Componente principal de tabla de datos
|
|
4
|
+
*
|
|
5
|
+
* Características:
|
|
6
|
+
* - Vista adaptativa: tabla tradicional en escritorio, cards en dispositivos móviles
|
|
7
|
+
* - Búsqueda global con debounce
|
|
8
|
+
* - Paginación automática
|
|
9
|
+
* - Ordenamiento de columnas
|
|
10
|
+
* - Acciones personalizables por fila
|
|
11
|
+
* - Botones de filtros, actualizar y exportar Excel
|
|
12
|
+
* - Visualización resumida de los filtros aplicados
|
|
13
|
+
* - Acciones personalizables al seleccionar varias filas
|
|
14
|
+
* - Textos personalizables cuando no hay datos
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```tsx
|
|
18
|
+
* <TablaDatos
|
|
19
|
+
* id="tabla-empleados"
|
|
20
|
+
* data={empleados}
|
|
21
|
+
* columns={[
|
|
22
|
+
* { accessorKey: 'nombre', header: 'Nombre' },
|
|
23
|
+
* { accessorKey: 'cargo', header: 'Cargo' },
|
|
24
|
+
* ]}
|
|
25
|
+
* controls={[
|
|
26
|
+
* {
|
|
27
|
+
* id: 'editar',
|
|
28
|
+
* name: 'Editar',
|
|
29
|
+
* icon: <IconoEditar />,
|
|
30
|
+
* event: (empleado) => console.log('Editar', empleado),
|
|
31
|
+
* },
|
|
32
|
+
* ]}
|
|
33
|
+
* filtros={{
|
|
34
|
+
* filtrosAplicados: [{
|
|
35
|
+
* id: 'cedula',
|
|
36
|
+
* nombre: 'Cédula',
|
|
37
|
+
* valor: '1234567890',
|
|
38
|
+
* }],
|
|
39
|
+
* abrirFiltros: () => setAbrirFiltros(true),
|
|
40
|
+
* }}
|
|
41
|
+
* primerasColumnas={['nombre', 'cargo']}
|
|
42
|
+
* loading={false}
|
|
43
|
+
* selectorFilas={[
|
|
44
|
+
* {
|
|
45
|
+
* id: 'descargar-reporte',
|
|
46
|
+
* componente(filas) {
|
|
47
|
+
* return (
|
|
48
|
+
* <Boton
|
|
49
|
+
* variant="light"
|
|
50
|
+
* color="default"
|
|
51
|
+
* size="md"
|
|
52
|
+
* radius="md"
|
|
53
|
+
* onClick={() => descargarReportes(filas.map(f => f.id))}
|
|
54
|
+
* >
|
|
55
|
+
* <IconoPdf /> Descargar reporte
|
|
56
|
+
* </Boton>
|
|
57
|
+
* );
|
|
58
|
+
* },
|
|
59
|
+
* },
|
|
60
|
+
* {
|
|
61
|
+
* id: 'eliminar',
|
|
62
|
+
* componente(filas) {
|
|
63
|
+
* return (
|
|
64
|
+
* <Boton
|
|
65
|
+
* variant="light"
|
|
66
|
+
* color="danger"
|
|
67
|
+
* size="md"
|
|
68
|
+
* radius="md"
|
|
69
|
+
* onClick={() => eliminarRegistros(filas.map(f => f.id))}
|
|
70
|
+
* >
|
|
71
|
+
* <IconoEliminar /> Eliminar
|
|
72
|
+
* </Boton>
|
|
73
|
+
* );
|
|
74
|
+
* },
|
|
75
|
+
* },
|
|
76
|
+
* ]}
|
|
77
|
+
* />
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
export declare function TablaDatos<TData extends object>({ id, ...providerProps }: TablaDatosProps<TData>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { SVGProps } from 'react';
|
|
2
|
+
export declare function IconoFlechaIzq(props: SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare function IconoEliminar(props: SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export declare function IconoFlechaDer(props: SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export declare function LupaBuscar(props: SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare function IconoExcel(props: SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare function IconoPdf(props: SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare function IconoFiltros(props: SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare function IconoActualizar(props: SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare function IconoConfig(props: SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare function IconoRestaurar(props: SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare function IconoArrastrar(props: SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export declare function IconoColumnas(props: SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export declare function IconoFilas(props: SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export declare function IconoMas(props: SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export declare function IconoMenos(props: SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export declare function IconoCerrar(props: SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function TablaCards(): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function TablaEscritorio(): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function ConfigColumnas(): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function ConfigFilas(): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function MenuConfiguraciones(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function BarraHerramientas(): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AccionFila } from '../../types/TablaTypes';
|
|
2
|
+
type Props<TData> = {
|
|
3
|
+
totalSeleccionadas: number;
|
|
4
|
+
acciones: AccionFila<TData>[];
|
|
5
|
+
filasSeleccionadas: TData[];
|
|
6
|
+
onLimpiarSeleccion: () => void;
|
|
7
|
+
};
|
|
8
|
+
export declare function BarraSeleccion<TData>({ totalSeleccionadas, acciones, filasSeleccionadas, onLimpiarSeleccion, }: Props<TData>): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function Paginacion(): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function SinDatos(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { IconoColumnas } from '../components/Iconografia';
|
|
2
|
+
import { SeccionMenuConfigType } from '../types/TablaTypes';
|
|
3
|
+
export declare const MIN_PAGE_SIZE = 1;
|
|
4
|
+
export declare const MAX_PAGE_SIZE = 200;
|
|
5
|
+
export declare const POPOVER_WIDTH = 250;
|
|
6
|
+
export declare const POPOVER_DURACION_ANIMACION = 200;
|
|
7
|
+
export declare const COMPONENTES_CONFIG: Record<SeccionMenuConfigType, {
|
|
8
|
+
component: React.ComponentType<{
|
|
9
|
+
navegar: (s: SeccionMenuConfigType) => void;
|
|
10
|
+
}>;
|
|
11
|
+
titulo?: string;
|
|
12
|
+
}>;
|
|
13
|
+
export declare const OPCIONES_MENU_CONFIG: {
|
|
14
|
+
id: SeccionMenuConfigType;
|
|
15
|
+
icono: typeof IconoColumnas;
|
|
16
|
+
nombre: string;
|
|
17
|
+
descripcion: string;
|
|
18
|
+
}[];
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Table, ColumnDef, Column, ColumnOrderState } from '@tanstack/react-table';
|
|
2
|
+
import { TablaDatosProps } from '../types/TablaTypes';
|
|
3
|
+
export type TablaProviderProps<TData extends object> = Omit<TablaDatosProps<TData>, 'id'> & {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
tamanioPaginaInicial?: number;
|
|
6
|
+
};
|
|
7
|
+
export type TablaState<TData extends object = object> = {
|
|
8
|
+
ordenColumnas: ColumnOrderState;
|
|
9
|
+
table: Table<TData>;
|
|
10
|
+
columns: ColumnDef<TData>[];
|
|
11
|
+
primerasColumnas: [string, string];
|
|
12
|
+
inputBusqueda: string;
|
|
13
|
+
setInputBusqueda: (valor: string) => void;
|
|
14
|
+
} & Omit<TablaDatosProps<TData>, 'data' | 'columns' | 'primerasColumnas' | 'id'>;
|
|
15
|
+
export type TablaContextType<TData extends object = object> = {
|
|
16
|
+
state: TablaState<TData>;
|
|
17
|
+
todasLasColumnas: Column<TData, unknown>[];
|
|
18
|
+
etiquetaColumna: (id: string) => string;
|
|
19
|
+
restaurarConfiguracion: () => void;
|
|
20
|
+
cambiarPageSize: (valor: number) => void;
|
|
21
|
+
cambiarOrdenColumnas: (actualizador: ColumnOrderState | ((prev: ColumnOrderState) => ColumnOrderState)) => void;
|
|
22
|
+
};
|
|
23
|
+
export type TablaContextValue = TablaContextType<object>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { TablaProviderProps, TablaContextValue } from './ContextTypes';
|
|
2
|
+
export declare const TablaDatosContext: import('react').Context<TablaContextValue | null>;
|
|
3
|
+
export declare function TablaDatosProvider<TData extends object>({ children, data, columns, controls, loading, primerasColumnas, tamanioPaginaInicial, filtros, descargarExcel, actualizarTabla, selectorFilas, sinDatosProps, }: TablaProviderProps<TData>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { TablaContextType } from './ContextTypes';
|
|
2
|
+
/**
|
|
3
|
+
* Hook para acceder al contexto de TablaDatos con tipado genérico
|
|
4
|
+
* @throws Error si se usa fuera de TablaDatosProvider
|
|
5
|
+
*/
|
|
6
|
+
export declare function useTablaContext<TData extends object>(): TablaContextType<TData>;
|
|
7
|
+
/**
|
|
8
|
+
* Hook para acceder al contexto de forma segura (puede ser null)
|
|
9
|
+
*/
|
|
10
|
+
export declare function useTablaContextSafe<TData extends object>(): TablaContextType<TData> | null;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Hook para detectar clicks fuera de elementos referenciados
|
|
4
|
+
* @param handler - Función a ejecutar cuando se hace click fuera
|
|
5
|
+
* @param isOpen - Si el detector está activo
|
|
6
|
+
* @param refs - Array de refs de elementos a excluir
|
|
7
|
+
*/
|
|
8
|
+
export declare function useClickOutside(handler: () => void, isOpen: boolean, refs: RefObject<HTMLElement | null>[]): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useEscapeKey(handler: () => void, isOpen: boolean): void;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
type Position = {
|
|
3
|
+
top: number;
|
|
4
|
+
left: number;
|
|
5
|
+
};
|
|
6
|
+
type UsePopoverPositionOptions = {
|
|
7
|
+
width: number;
|
|
8
|
+
margin?: number;
|
|
9
|
+
offsetRight?: number;
|
|
10
|
+
offsetLeft?: number;
|
|
11
|
+
offsetTop?: number;
|
|
12
|
+
offsetBottom?: number;
|
|
13
|
+
};
|
|
14
|
+
export declare function usePopoverPosition(anchorRef: RefObject<HTMLElement | null>, popoverRef: RefObject<HTMLElement | null>, isOpen: boolean, { width, margin, offsetRight, offsetLeft, offsetTop, offsetBottom }: UsePopoverPositionOptions): Position;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useScrollLock(isOpen: boolean): void;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { TablaDatos } from './TablaDatos';
|
|
2
|
+
export { useTablaContext, useTablaContextSafe } from './context/hooks';
|
|
3
|
+
export type { TablaDatosProps } from './types/TablaTypes';
|
|
4
|
+
export type { TablaContextType, TablaState } from './context/ContextTypes';
|
|
5
|
+
export type { ColumnDef } from '@tanstack/react-table';
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { Cell, ColumnDef, Row, Table } from '@tanstack/react-table';
|
|
2
|
+
import { JSX } from 'react/jsx-runtime';
|
|
3
|
+
export type TablaDatosProps<TData extends object> = {
|
|
4
|
+
/** Identificador único de la tabla */
|
|
5
|
+
id: string;
|
|
6
|
+
/** Datos a mostrar en la tabla */
|
|
7
|
+
data: TData[];
|
|
8
|
+
/** Definición de columnas usando TanStack Table */
|
|
9
|
+
columns: ColumnDef<TData>[];
|
|
10
|
+
/** Controles/acciones disponibles por fila */
|
|
11
|
+
controls?: Control<TData>[];
|
|
12
|
+
/** Configuración de los filtros */
|
|
13
|
+
filtros?: {
|
|
14
|
+
/** Callback para abrir panel de filtros */
|
|
15
|
+
abrirFiltros?: () => void;
|
|
16
|
+
/** Filtros aplicados */
|
|
17
|
+
filtrosAplicados?: FiltrosAplicadosType[];
|
|
18
|
+
};
|
|
19
|
+
/** Callback para descargar Excel */
|
|
20
|
+
descargarExcel?: () => void;
|
|
21
|
+
/** Indica si la tabla está cargando */
|
|
22
|
+
loading?: boolean;
|
|
23
|
+
/** Configuración del botón actualizar */
|
|
24
|
+
actualizarTabla?: ActualizarTablaConfig;
|
|
25
|
+
/** Llaves de las primeras columnas para vista móvil (máximo 2) */
|
|
26
|
+
primerasColumnas: (keyof TData)[];
|
|
27
|
+
/** Configuración del selector de filas con acciones masivas, se muestra en la tabla cuando se selecciona al menos una fila */
|
|
28
|
+
selectorFilas?: AccionFila<TData>[];
|
|
29
|
+
/** Configuración del estado "sin datos" */
|
|
30
|
+
sinDatosProps?: SinDatosProps;
|
|
31
|
+
};
|
|
32
|
+
export type Control<TData> = {
|
|
33
|
+
id: string;
|
|
34
|
+
nombre: string;
|
|
35
|
+
icono: JSX.Element;
|
|
36
|
+
evento: (data: TData) => void;
|
|
37
|
+
};
|
|
38
|
+
export type ActualizarTablaConfig = {
|
|
39
|
+
cargando: boolean;
|
|
40
|
+
onClick: () => void;
|
|
41
|
+
};
|
|
42
|
+
export type AccionFila<TData> = {
|
|
43
|
+
/** Identificador único de la acción */
|
|
44
|
+
id: string;
|
|
45
|
+
/**
|
|
46
|
+
* Componente que se renderiza en la barra de selección.
|
|
47
|
+
* Recibe las filas seleccionadas como parámetro para ejecutar acciones sobre ellas.
|
|
48
|
+
* @param filasSeleccionadas - Arreglo de datos de las filas seleccionadas (proporcionado automáticamente por la tabla)
|
|
49
|
+
* @returns Componente React (usualmente un botón con onClick)
|
|
50
|
+
*/ componente: (filasSeleccionadas: TData[]) => React.ReactNode;
|
|
51
|
+
};
|
|
52
|
+
export type SeccionMenuConfigType = 'panelPrincipal' | 'panelColumnas' | 'panelFilas';
|
|
53
|
+
export type AccionesCardsProps<TData> = {
|
|
54
|
+
fila: Row<TData>;
|
|
55
|
+
controls?: Control<TData>[];
|
|
56
|
+
};
|
|
57
|
+
export type ContenidoCardProps<TData> = {
|
|
58
|
+
columnasRestantes: Cell<TData, unknown>[];
|
|
59
|
+
table: Table<TData>;
|
|
60
|
+
};
|
|
61
|
+
export type EncabezadoCardsProps<TData> = {
|
|
62
|
+
fila: Row<TData>;
|
|
63
|
+
table: Table<TData>;
|
|
64
|
+
idPrimeraColumna?: string;
|
|
65
|
+
idSegundaColumna?: string;
|
|
66
|
+
};
|
|
67
|
+
export type SkeletonCardsProps<TData> = {
|
|
68
|
+
filas: number;
|
|
69
|
+
cantidadControles?: number;
|
|
70
|
+
table: Table<TData>;
|
|
71
|
+
idPrimeraColumna?: string;
|
|
72
|
+
idSegundaColumna?: string;
|
|
73
|
+
};
|
|
74
|
+
export type SinDatosProps = {
|
|
75
|
+
alAgregarRegistro?: () => void;
|
|
76
|
+
titulo?: string;
|
|
77
|
+
descripcion?: string;
|
|
78
|
+
etiquetaAccion?: string;
|
|
79
|
+
};
|
|
80
|
+
export type FiltrosAplicadosType = {
|
|
81
|
+
/** Nombre del filtro aplicado */
|
|
82
|
+
nombre: string;
|
|
83
|
+
/** Valor del filtro aplicado */
|
|
84
|
+
valor: string;
|
|
85
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ColumnDef } from '@tanstack/react-table';
|
|
2
|
+
/**
|
|
3
|
+
* Obtiene una columna por su llave de acceso
|
|
4
|
+
*/
|
|
5
|
+
export declare function obtenerColumnaPorLlave<TData extends object>(columnas: ColumnDef<TData>[], llave?: keyof TData | string): (import('@tanstack/react-table').ColumnDefBase<TData, unknown> & import('@tanstack/react-table').StringHeaderIdentifier) | (import('@tanstack/react-table').ColumnDefBase<TData, unknown> & import('@tanstack/react-table').IdIdentifier<TData, unknown>) | (import('@tanstack/react-table').AccessorKeyColumnDefBase<TData, unknown> & Partial<import('@tanstack/react-table').IdIdentifier<TData, unknown>>) | undefined;
|
|
6
|
+
/**
|
|
7
|
+
* Obtiene el ID de una columna
|
|
8
|
+
*/
|
|
9
|
+
export declare function obtenerIdColumna<TData extends object>(columna?: ColumnDef<TData>): string | undefined;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Calcula las páginas visibles para el componente de paginación
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* calcularPaginasVisibles(5, 10, 3) // [4, 5, 6]
|
|
6
|
+
* calcularPaginasVisibles(1, 10, 3) // [1, 2, 3]
|
|
7
|
+
*/
|
|
8
|
+
export declare function calcularPaginasVisibles(paginaActual: number, totalPaginas: number, maxPaginasVisibles?: number): number[];
|
|
9
|
+
/**
|
|
10
|
+
* Valida y ajusta el índice de página actual
|
|
11
|
+
*/
|
|
12
|
+
export declare function validarIndicePagina(indiceActual: number, totalPaginas: number): number;
|