@innertia-solutions/innertia-nuxt 0.1.94 → 0.1.96
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/CHANGELOG.md
CHANGED
|
@@ -15,6 +15,7 @@ All notable changes to `@innertia-solutions/innertia-nuxt` are documented here.
|
|
|
15
15
|
|
|
16
16
|
### Fixed
|
|
17
17
|
|
|
18
|
+
- `Forms.Select`: el desplegable se abre hacia arriba cuando no cabe abajo (`dropdownAutoPlacement`); antes quedaba cortado por el borde inferior de la ventana.
|
|
18
19
|
- Sesión: renovación deslizante del JWT en el BFF. Cuando al token le quedan menos de 10 min (o menos de 1/3 de su vida), `/api/**` y el SSR lo renuevan contra `POST auth/refresh` y reescriben la cookie sellada; refrescos concurrentes se deduplican y los requests tardíos con el token viejo reciben el nuevo; un refresh fallido no se reintenta con ese token por 30 s (timeout de 5 s). Con uso activo la sesión ya no muere a los 60 min fijos. No aplica a tokens de plataforma. Configurable con `runtimeConfig.authRefresh` (`NUXT_AUTH_REFRESH_ENABLED`, `NUXT_AUTH_REFRESH_PATH`).
|
|
19
20
|
- `useApi`: ante un 401, las mutaciones del cliente (POST/PUT/PATCH/DELETE) ahora **lanzan** un error `{ status: 401, data: { message } }` en vez de devolver `null` (antes `useMutation` lo tomaba como éxito y mostraba "Guardado" sin guardar). GET y las llamadas SSR siguen devolviendo `null`. Override por llamada con `{ throwOnUnauthorized: true|false }`. Además muestra un aviso "Tu sesión expiró" (una vez) y, al lanzar, no espera la navegación al login para que el llamador muestre el error antes de las guardas de "cambios sin guardar".
|
|
20
21
|
- `useForm`: el error de un campo se borra al cambiar su valor (antes quedaba "Este campo es obligatorio" bajo un campo ya completado hasta el siguiente envío).
|
|
@@ -73,6 +73,19 @@ const triggerId = ref(
|
|
|
73
73
|
`dropdown-trigger-${Math.random().toString(36).substr(2, 9)}`
|
|
74
74
|
);
|
|
75
75
|
|
|
76
|
+
// Self-initialize: a dropdown mounted after Preline's global autoInit (v-if, async data, client
|
|
77
|
+
// toggles) would otherwise render but never open.
|
|
78
|
+
const wrapperEl = ref(null);
|
|
79
|
+
onMounted(() => {
|
|
80
|
+
nextTick(() => {
|
|
81
|
+
const HSDropdown = window.HSDropdown;
|
|
82
|
+
if (!wrapperEl.value || !HSDropdown) return;
|
|
83
|
+
try {
|
|
84
|
+
if (!HSDropdown.getInstance?.(wrapperEl.value, true)) HSDropdown.autoInit?.();
|
|
85
|
+
} catch (_) {}
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
|
|
76
89
|
// Computed
|
|
77
90
|
const triggerSizeClasses = computed(() => {
|
|
78
91
|
const sizes = {
|
|
@@ -200,7 +213,7 @@ const handleItemClick = (item, event) => {
|
|
|
200
213
|
};
|
|
201
214
|
</script>
|
|
202
215
|
<template>
|
|
203
|
-
<div class="hs-dropdown relative inline-flex" :class="wrapperClass">
|
|
216
|
+
<div ref="wrapperEl" class="hs-dropdown relative inline-flex" :class="wrapperClass">
|
|
204
217
|
<!-- Trigger button -->
|
|
205
218
|
<button
|
|
206
219
|
:id="triggerId"
|
|
@@ -40,6 +40,8 @@ const hsConfig = computed(() => JSON.stringify({
|
|
|
40
40
|
placeholder: emptyLabel.value,
|
|
41
41
|
...(props.clearable ? { optionAllowEmptyOption: true } : {}),
|
|
42
42
|
dropdownScope: 'window',
|
|
43
|
+
// Flip upwards when there is no room below (otherwise the panel is cut by the viewport).
|
|
44
|
+
dropdownAutoPlacement: true,
|
|
43
45
|
toggleTag: '<button type="button" aria-expanded="false"></button>',
|
|
44
46
|
toggleClasses: 'innertia-field hs-select-disabled:pointer-events-none hs-select-disabled:opacity-50 relative pe-9 flex gap-x-2 items-center text-nowrap cursor-pointer text-start',
|
|
45
47
|
dropdownClasses: 'z-[10000] w-full max-h-72 py-1 bg-[color:var(--field-dropdown-bg)] border border-[color:var(--field-border)] rounded-control overflow-hidden overflow-y-auto shadow-lg',
|
|
@@ -202,5 +204,6 @@ const handleChange = (e: Event) => {
|
|
|
202
204
|
* Con `dropdownScope:'window'` Preline teletransporta el panel del dropdown al
|
|
203
205
|
* <body> y lo posiciona con floating-ui (fixed + offset). Así escapa el overflow
|
|
204
206
|
* de cualquier contenedor con scroll (modales, paneles, etc.) y flota por encima.
|
|
207
|
+
* `dropdownAutoPlacement` agrega el middleware flip: si no cabe abajo, abre hacia arriba.
|
|
205
208
|
*/
|
|
206
209
|
</style>
|
package/package.json
CHANGED
|
@@ -48,7 +48,9 @@ export default defineNuxtPlugin(async () => {
|
|
|
48
48
|
if (node.nodeType !== Node.ELEMENT_NODE) return false
|
|
49
49
|
const el = node as Element
|
|
50
50
|
return (
|
|
51
|
-
|
|
51
|
+
// Class-based components (e.g. App.Dropdown's `.hs-dropdown`) nested inside a newly added
|
|
52
|
+
// wrapper must be detected too, not only when the added node itself carries the class.
|
|
53
|
+
el.querySelector?.('[data-hs-overlay],[data-hs-dropdown],[data-hs-select],.hs-dropdown,.hs-overlay,.hs-select,.hs-tooltip,.hs-accordion,.hs-collapse') ||
|
|
52
54
|
el.hasAttribute?.('data-hs-overlay') ||
|
|
53
55
|
el.hasAttribute?.('data-hs-dropdown') ||
|
|
54
56
|
el.hasAttribute?.('data-hs-select') ||
|