laif-ds 1.0.2-app-data-grid.80 → 1.0.2-app-data-grid.82

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.
@@ -1,9 +1,9 @@
1
1
  "use client";
2
2
  import { jsx as n, jsxs as H } from "react/jsx-runtime";
3
- import { useMemo as ae, useRef as m, useEffect as He, useLayoutEffect as nt, useState as _e, useId as je, useCallback as D } from "react";
3
+ import { useMemo as le, useRef as m, useEffect as He, useLayoutEffect as nt, useState as _e, useId as je, useCallback as D } from "react";
4
4
  import { Icon as Qe } from "../icon.js";
5
5
  import { Input as it } from "../input.js";
6
- import { cn as le } from "../../../lib/utils.js";
6
+ import { cn as de } from "../../../lib/utils.js";
7
7
  import { useGridEngine as st } from "./engine/use-grid-engine.js";
8
8
  import { useGridInfiniteLoader as at } from "./engine/use-grid-infinite-loader.js";
9
9
  import { useGridVirtualizer as lt } from "./engine/use-grid-virtualizer.js";
@@ -11,7 +11,7 @@ import { GRID_VALUELESS_OPERATOR_SET as dt, isGridFilterValueEmpty as ct } from
11
11
  import { flattenGridColumns as Ue } from "./grid-header-matrix.js";
12
12
  import { defaultGridI18n as s } from "./grid-i18n.js";
13
13
  import { registerGridMount as ut } from "./grid-mount-count.js";
14
- import { gridResultScope as pt, GRID_PAGE_SIZE_OPTIONS as gt } from "./grid-result-scope.js";
14
+ import { gridResultScope as gt, GRID_PAGE_SIZE_OPTIONS as pt } from "./grid-result-scope.js";
15
15
  import { gridRowHeight as W, gridZ as ft, gridFrameGapClass as mt } from "./grid-tokens.js";
16
16
  import { readGridViewPreset as wt } from "./grid-view-preset.js";
17
17
  import { GridActionsRow as ht } from "./parts/grid-actions-row.js";
@@ -70,11 +70,11 @@ const Gt = [
70
70
  sortMode: Xe = "multi",
71
71
  maxSortedColumns: Je = 2,
72
72
  density: _,
73
- onDensityChange: de,
73
+ onDensityChange: ce,
74
74
  onFullscreenChange: Ye,
75
75
  filters: S,
76
76
  columnVisibility: j,
77
- onColumnVisibilityChange: ce,
77
+ onColumnVisibilityChange: ue,
78
78
  // I DUE VERSI DELLA CATTURA DI VISTA che P10 non aveva. Si destrutturano
79
79
  // accanto alla loro sorella perché sono lo stesso mestiere — i tre tipi
80
80
  // stanno invece in `GridShellFields` per vincolo di posa, e il perché sta
@@ -96,8 +96,11 @@ const Gt = [
96
96
  toolbar: l,
97
97
  initialFullscreen: to,
98
98
  paginated: F = !1,
99
- pageSize: ro = 10,
100
- virtualized: ue = !1,
99
+ // 25 e non più 10 (decisione del proprietario, 2026-09-23): dieci righe
100
+ // riempivano mezza griglia su un monitor da gestionale. Resta dichiarabile
101
+ // dall'esterno con la prop o con `initialState.pagination.pageSize`.
102
+ pageSize: ro = 25,
103
+ virtualized: ge = !1,
101
104
  infinite: c,
102
105
  groupBy: Z,
103
106
  initialOpenGroups: no,
@@ -107,11 +110,11 @@ const Gt = [
107
110
  groupLabelPlacement: io = "grouping-column",
108
111
  preset: A,
109
112
  onPresetApplied: pe,
110
- serverMode: ge = !1,
111
- serverConfig: q,
113
+ serverMode: fe = !1,
114
+ serverConfig: E,
112
115
  initialState: so,
113
- viewportHeight: fe = 480,
114
- loading: p = !1,
116
+ viewportHeight: me = 480,
117
+ loading: g = !1,
115
118
  emptyComponent: ao,
116
119
  // GLI ESITI SENZA DATI — FASE 5. `error` è il PREDICATO (una fetch caduta è
117
120
  // distinguibile da un filtro che non pesca niente) e `onRetry` è la sola
@@ -128,22 +131,22 @@ const Gt = [
128
131
  // LA RIGA ZERO — Fase 9. `filterMode` dice DOVE vivono i filtri; le due
129
132
  // callback sono il canale di scrittura di chi solleva `filters`, e senza di
130
133
  // loro le celle restano vuote invece di offrire un comando morto.
131
- filterMode: me = "row",
132
- onAddFilter: E,
133
- onUpdateFilter: $,
134
+ filterMode: we = "row",
135
+ onAddFilter: $,
136
+ onUpdateFilter: z,
134
137
  // LA RIGA DI STATO A SCHERMO — M4, criterio 1. Default SPENTO: `sr-only` è
135
138
  // `position: absolute`, quindi da spenta la region non è un flex item della
136
139
  // radice e non porta né altezza né gap. Vedi `GridLiveRegion`.
137
- statusRowVisible: po = !1,
140
+ statusRowVisible: go = !1,
138
141
  // IL TOGGLE DELLA RIGA ZERO, OSSERVABILE — R13, criterio 4. Nessun default:
139
142
  // non passarla lascia la griglia esattamente com'era. Vedi il TSDoc.
140
- onFilterRowOpenChange: go,
143
+ onFilterRowOpenChange: po,
141
144
  // LA PORTATA DELLA SELEZIONE, OSSERVABILE — M10. Nessun default: non
142
145
  // passarla lascia la griglia esattamente com'era, ed è un canale di sola
143
146
  // LETTURA (non esiste una prop che imponga la portata da fuori). Vedi il
144
147
  // TSDoc, dove le due metà della precondizione sono separate.
145
148
  onSelectionScopeChange: fo,
146
- actions: we = [],
149
+ actions: he = [],
147
150
  hideActionsRow: mo = !1,
148
151
  checkable: wo = !1,
149
152
  rowSelection: ho,
@@ -151,11 +154,11 @@ const Gt = [
151
154
  onRowSelectionChange: vo,
152
155
  onCheckedRowsChange: Co,
153
156
  rowClassName: bo,
154
- onQueryChange: he,
157
+ onQueryChange: ye,
155
158
  debounceTime: Ro,
156
159
  className: So,
157
- id: ye,
158
- "data-testid": ve
160
+ id: ve,
161
+ "data-testid": Ce
159
162
  } = v, Io = _ !== void 0, o = st({
160
163
  columns: C,
161
164
  data: T,
@@ -187,10 +190,10 @@ const Gt = [
187
190
  // su `serverConfig.onStateChange`. Chiamarli entrambi sarebbe due refetch per
188
191
  // gesto, cioè il difetto R10 con un altro nome — e un consumer che li passa
189
192
  // tutti e due ha quasi certamente migrato a metà, non chiesto il doppio.
190
- onQueryChange: he ?? q?.onStateChange,
193
+ onQueryChange: ye ?? E?.onStateChange,
191
194
  debounceTime: Ro,
192
- serverMode: ge,
193
- serverConfig: q,
195
+ serverMode: fe,
196
+ serverConfig: E,
194
197
  initialState: so,
195
198
  groupBy: Z,
196
199
  initialOpenGroups: no,
@@ -202,9 +205,9 @@ const Gt = [
202
205
  // Le due fonti sollevate di P7: quando ci sono, comandano. Vedi le prop.
203
206
  filters: S,
204
207
  columnVisibility: j
205
- }), x = Io ? _ : o.state.view.density, z = r.toolbar ?? s.toolbar, d = o.state.view.fullscreen, Ce = (e) => {
208
+ }), x = Io ? _ : o.state.view.density, V = r.toolbar ?? s.toolbar, d = o.state.view.fullscreen, be = (e) => {
206
209
  o.applyView({ type: "view/fullscreen", fullscreen: e }), Ye?.(e);
207
- }, be = (e, t) => e?.render ? e.render() : t, xo = ae(
210
+ }, Q = (e, t) => e === !1 ? null : e?.render ? e.render() : t, xo = le(
208
211
  () => Ue(C).map((e) => ({
209
212
  id: e.id,
210
213
  // ⚠️ RIPIEGO SULL'`id` QUANDO L'ETICHETTA È VUOTA, e non è una cortesia.
@@ -240,8 +243,8 @@ const Gt = [
240
243
  pinned: e.pinned
241
244
  })),
242
245
  [C]
243
- ), To = j === void 0 || ce !== void 0, Re = o.headers.length > 1, Fo = (e, t) => {
244
- !t && !Re || (j === void 0 && o.applyView({ type: "view/column-visibility", columnId: e, visible: t }), ce?.({
246
+ ), To = j === void 0 || ue !== void 0, Re = o.headers.length > 1, Fo = (e, t) => {
247
+ !t && !Re || (j === void 0 && o.applyView({ type: "view/column-visibility", columnId: e, visible: t }), ue?.({
245
248
  ...o.state.view.columnVisibility,
246
249
  [e]: t
247
250
  }));
@@ -252,7 +255,7 @@ const Gt = [
252
255
  ...o.state.view.columnWidths,
253
256
  [e]: t
254
257
  });
255
- }, Se = v.viewportHeight !== void 0 || ue || c !== void 0 || Z !== void 0, O = m(null), Ie = m(0), xe = m(void 0);
258
+ }, Se = v.viewportHeight !== void 0 || ge || c !== void 0 || Z !== void 0, O = m(null), Ie = m(0), xe = m(void 0);
256
259
  He(() => {
257
260
  if (A === void 0 || xe.current === A) return;
258
261
  xe.current = A;
@@ -263,19 +266,19 @@ const Gt = [
263
266
  console.error(t);
264
267
  return;
265
268
  }
266
- o.applyPreset({ query: e.query, view: e.view }), de?.(e.view.density), pe?.(e);
267
- }, [A, o, pe, de]);
268
- const Q = m(null), Go = (e, t) => {
269
+ o.applyPreset({ query: e.query, view: e.view }), ce?.(e.view.density), pe?.(e);
270
+ }, [A, o, pe, ce]);
271
+ const X = m(null), Go = (e, t) => {
269
272
  const i = O.current;
270
273
  if (i !== null) {
271
274
  const a = k.findIndex(
272
275
  (We) => We.kind === "group" && We.group.path === e
273
276
  ), u = Math.floor(
274
277
  i.scrollTop / W[x]
275
- ), P = { ...o.state.view.groupExpansion };
276
- P[e] = t;
277
- const R = o.bodyRowCountWith(P) - k.length, f = a !== -1 && a < u, rt = f && R < 0 && u <= a - R;
278
- Q.current = !f || R === 0 ? null : rt ? { modo: "atterra-sul-gruppo", indiceGruppo: a } : {
278
+ ), q = { ...o.state.view.groupExpansion };
279
+ q[e] = t;
280
+ const R = o.bodyRowCountWith(q) - k.length, f = a !== -1 && a < u, rt = f && R < 0 && u <= a - R;
281
+ X.current = !f || R === 0 ? null : rt ? { modo: "atterra-sul-gruppo", indiceGruppo: a } : {
279
282
  modo: "tieni-ferma-la-vista",
280
283
  // ⚠️ SI LEGGE ADESSO, PRIMA DEL COMMIT, e non nell'effetto: è
281
284
  // l'unico istante in cui questo numero è ancora quello
@@ -287,46 +290,46 @@ const Gt = [
287
290
  o.applyView({ type: "view/group-expansion", path: e, expanded: t });
288
291
  };
289
292
  nt(() => {
290
- const e = Q.current;
291
- if (Q.current = null, e === null) return;
293
+ const e = X.current;
294
+ if (X.current = null, e === null) return;
292
295
  const t = O.current;
293
296
  t !== null && (t.scrollTop = e.modo === "atterra-sul-gruppo" ? e.indiceGruppo * W[x] : e.scrollTopPrima + e.delta * W[x]);
294
297
  });
295
- const Te = m(0), Fe = ye ?? ve ?? null, X = m(null), V = m(null), Mo = (e) => {
296
- V.current = e, e && (Ie.current += 1, e.setAttribute("data-render-count", String(Ie.current)), X.current === null && (X.current = Fe === null ? 1 : ut(Fe)), e.setAttribute("data-mount-count", String(X.current)), e.setAttribute(
298
+ const Te = m(0), Fe = ve ?? Ce ?? null, J = m(null), G = m(null), Mo = (e) => {
299
+ G.current = e, e && (Ie.current += 1, e.setAttribute("data-render-count", String(Ie.current)), J.current === null && (J.current = Fe === null ? 1 : ut(Fe)), e.setAttribute("data-mount-count", String(J.current)), e.setAttribute(
297
300
  "data-loadmore-call-count",
298
301
  String(Te.current)
299
302
  ));
300
303
  }, Ae = (e) => {
301
- const t = V.current;
304
+ const t = G.current;
302
305
  if (!t) return;
303
306
  const i = Array.from(
304
307
  t.querySelectorAll(Gt)
305
308
  ).filter((u) => u.dataset.gridFocusSentinel === void 0), a = e === "first" ? i : [...i].reverse();
306
309
  for (const u of a)
307
310
  if (u.focus(), document.activeElement === u) return;
308
- }, k = o.bodyRows, Po = k.length, w = o.state.query.requestCount, G = m(w);
309
- w < G.current && (G.current = w);
310
- const qo = c !== void 0 && w > Math.max(1, G.current);
311
+ }, k = o.bodyRows, Po = k.length, w = o.state.query.requestCount, M = m(w);
312
+ w < M.current && (M.current = w);
313
+ const qo = c !== void 0 && w > Math.max(1, M.current);
311
314
  He(() => {
312
- c === void 0 || p || w > G.current && (G.current = w);
313
- }, [c, p, w]);
314
- const Eo = c !== void 0 && p && w > 1, $o = p && !Eo, J = o.state.query.pagination.pageSize, Oe = p ? Math.min(J, 1e3) : 0, h = $o ? 0 : Po, Ge = h > 0, y = ("resultTotal" in v ? v.resultTotal : void 0) ?? q?.totalItems ?? (F && !ge && !(c !== void 0 && c.hasMore) ? o.filteredRowCount : void 0), zo = ae(
315
+ c === void 0 || g || w > M.current && (M.current = w);
316
+ }, [c, g, w]);
317
+ const Eo = c !== void 0 && g && w > 1, $o = g && !Eo, Y = o.state.query.pagination.pageSize, Oe = g ? Math.min(Y, 1e3) : 0, h = $o ? 0 : Po, Ge = h > 0, y = ("resultTotal" in v ? v.resultTotal : void 0) ?? E?.totalItems ?? (F && !fe && !(c !== void 0 && c.hasMore) ? o.filteredRowCount : void 0), zo = le(
315
318
  () => new Set(o.state.query.filters.map((e) => e.columnId)),
316
319
  [o.state.query.filters]
317
- ), Y = ae(
320
+ ), ee = le(
318
321
  // `flattenGridColumns` PRIMA, perché `columns` è l'albero e
319
322
  // `toGridFilterColumns` vuole le foglie: è lo stesso appiattimento che il
320
323
  // call-site fa per costruire le colonne dell'inventario, quindi le due liste
321
324
  // sono la stessa lista e non due liste che si somigliano.
322
325
  () => Ot(Ue(C)),
323
326
  [C]
324
- ), Vo = S === void 0 || E !== void 0 && $ !== void 0, [Me, ko] = _e(!0), Pe = m(!0), qe = je(), Ee = m(0), L = D(
327
+ ), Vo = S === void 0 || $ !== void 0 && z !== void 0, [Me, ko] = _e(!0), Pe = m(!0), qe = je(), Ee = m(0), L = D(
325
328
  (e, t) => {
326
329
  const i = o.state.query.filters, a = i.find((f) => f.columnId === e);
327
330
  if (a !== void 0) {
328
- if ($ !== void 0) {
329
- $(a.id, t);
331
+ if (z !== void 0) {
332
+ z(a.id, t);
330
333
  return;
331
334
  }
332
335
  o.applyAndEmit({
@@ -337,20 +340,20 @@ const Gt = [
337
340
  });
338
341
  return;
339
342
  }
340
- const u = Y.find(
343
+ const u = ee.find(
341
344
  (f) => f.id === e
342
345
  );
343
346
  if (u === void 0) return;
344
347
  Ee.current += 1;
345
- const P = yt(
348
+ const q = yt(
346
349
  u,
347
350
  r,
348
351
  `${qe}-${Ee.current}`
349
352
  );
350
- if (P === void 0) return;
351
- const R = { ...P, ...t };
352
- if (E !== void 0) {
353
- E(R);
353
+ if (q === void 0) return;
354
+ const R = { ...q, ...t };
355
+ if ($ !== void 0) {
356
+ $(R);
354
357
  return;
355
358
  }
356
359
  o.applyAndEmit({
@@ -360,18 +363,18 @@ const Gt = [
360
363
  },
361
364
  [
362
365
  o,
363
- Y,
366
+ ee,
364
367
  qe,
365
368
  r,
366
- E,
367
- $
369
+ $,
370
+ z
368
371
  ]
369
372
  ), Lo = D(
370
373
  (e, t) => {
371
374
  L(e, { operator: t });
372
375
  },
373
376
  [L]
374
- ), ee = D(
377
+ ), oe = D(
375
378
  (e) => {
376
379
  const t = o.state.query.filters, i = t.find((a) => a.columnId === e);
377
380
  if (i !== void 0) {
@@ -393,41 +396,41 @@ const Gt = [
393
396
  (a) => a.columnId === e
394
397
  );
395
398
  if (i !== void 0 && !dt.has(i.operator) && ct(t)) {
396
- ee(e);
399
+ oe(e);
397
400
  return;
398
401
  }
399
402
  L(e, { value: t });
400
403
  },
401
- [L, ee, o]
402
- ), Bo = S === void 0 || I !== void 0, Do = me === "row", g = pt({
404
+ [L, oe, o]
405
+ ), Bo = S === void 0 || I !== void 0, Do = we === "row", p = gt({
403
406
  badges: o.state.query.filters,
404
407
  resultTotal: y,
405
408
  rowsInPage: o.rows.length,
406
409
  pageIndex: o.state.query.pagination.pageIndex,
407
- pageSize: J
408
- }), Wo = y === void 0 ? void 0 : g, oe = r.status ?? {}, N = r.selection ?? {}, $e = o.headers.filter((e) => e.sortIndex !== null).sort((e, t) => (e.sortIndex ?? 0) - (t.sortIndex ?? 0)), Ho = $e.length === 0 ? "" : `${oe.sortedBy ?? s.status.sortedBy} ${$e.map((e) => {
410
+ pageSize: Y
411
+ }), Wo = y === void 0 ? void 0 : p, te = r.status ?? {}, N = r.selection ?? {}, $e = o.headers.filter((e) => e.sortIndex !== null).sort((e, t) => (e.sortIndex ?? 0) - (t.sortIndex ?? 0)), Ho = $e.length === 0 ? "" : `${te.sortedBy ?? s.status.sortedBy} ${$e.map((e) => {
409
412
  const t = e.sortDirection === "descending" ? r.sorting.descending : r.sorting.ascending, i = `${e.headerLabel} ${t}`;
410
413
  if (e.sortCount <= 1) return i;
411
414
  const a = r.sorting.sortPosition ?? s.sorting.sortPosition, u = r.pagination.of ?? s.pagination.of;
412
415
  return `${i}, ${a} ${e.sortIndex ?? 0} ${u} ${e.sortCount}`;
413
- }).join("; ")}`, _o = `${g.totalLabel} ${g.totalIsSingular ? r.pagination.rowOne ?? s.pagination.rowOne : r.pagination.rows}`, te = o.state.query.filters.filter(
416
+ }).join("; ")}`, _o = `${p.totalLabel} ${p.totalIsSingular ? r.pagination.rowOne ?? s.pagination.rowOne : r.pagination.rows}`, re = o.state.query.filters.filter(
414
417
  (e) => e.kind === "custom"
415
- ), jo = te.length === 0 ? "" : `, ${g.formatCount(te.length)} ${r.filters.withoutColumn ?? s.filters.withoutColumn}: ${te.map((e) => e.customLabel ?? e.customKey ?? e.id).join(", ")}`, Uo = `${g.filterCountLabel} ${g.filterCountIsSingular ? r.filters.filterOne ?? s.filters.filterOne : r.filters.filterMany ?? s.filters.filterMany} ${g.filterCountIsSingular ? oe.filterActiveOne ?? s.status.filterActiveOne : oe.filterActiveMany ?? s.status.filterActiveMany}${jo}`, b = o.selectedPageRowIds.length, ze = U?.mode === "all" && y !== void 0, [Ko, Zo] = _e("page"), re = ze ? Ko : "page", Qo = {
416
- scope: re,
418
+ ), jo = re.length === 0 ? "" : `, ${p.formatCount(re.length)} ${r.filters.withoutColumn ?? s.filters.withoutColumn}: ${re.map((e) => e.customLabel ?? e.customKey ?? e.id).join(", ")}`, Uo = `${p.filterCountLabel} ${p.filterCountIsSingular ? r.filters.filterOne ?? s.filters.filterOne : r.filters.filterMany ?? s.filters.filterMany} ${p.filterCountIsSingular ? te.filterActiveOne ?? s.status.filterActiveOne : te.filterActiveMany ?? s.status.filterActiveMany}${jo}`, b = o.selectedPageRowIds.length, ze = U?.mode === "all" && y !== void 0, [Ko, Zo] = _e("page"), ne = ze ? Ko : "page", Qo = {
419
+ scope: ne,
417
420
  rowIds: o.selectedPageRowIds,
418
- count: re === "all" ? y ?? b : b
421
+ count: ne === "all" ? y ?? b : b
419
422
  }, Ve = (e) => {
420
- e !== re && (Zo(e), fo?.({
423
+ e !== ne && (Zo(e), fo?.({
421
424
  scope: e,
422
425
  rowIds: o.selectedPageRowIds,
423
426
  count: e === "all" ? y ?? b : b
424
427
  }));
425
- }, Xo = `${g.formatCount(b)} ${b === 1 ? N.selectedOne ?? s.selection.selectedOne : N.selectedMany ?? s.selection.selectedMany}` + (b > 0 ? ` ${N.outOf ?? s.selection.outOf} ${g.rowsInPageLabel} ${N.onPage ?? s.selection.onPage}` : ""), Jo = [
428
+ }, Xo = `${p.formatCount(b)} ${b === 1 ? N.selectedOne ?? s.selection.selectedOne : N.selectedMany ?? s.selection.selectedMany}` + (b > 0 ? ` ${N.outOf ?? s.selection.outOf} ${p.rowsInPageLabel} ${N.onPage ?? s.selection.onPage}` : ""), Jo = [
426
429
  Ho,
427
430
  _o,
428
431
  Uo,
429
432
  Xo
430
- ].filter((e) => e !== "").join(". "), Yo = c !== void 0 && c.hasMore ? -1 : y ?? h, B = lo && !p, ne = !p && // ⚠️ `&& !erroreVisibile`, ED È LA RIGA CHE TIENE I DUE ESITI SEPARATI. Una
433
+ ].filter((e) => e !== "").join(". "), Yo = c !== void 0 && c.hasMore ? -1 : y ?? h, B = lo && !g, ie = !g && // ⚠️ `&& !erroreVisibile`, ED È LA RIGA CHE TIENE I DUE ESITI SEPARATI. Una
431
434
  // fetch caduta ha `dataRowCount === 0`, quindi senza questo termine i due
432
435
  // predicati sono veri insieme. Il vuoto è quello che tace, perché è l'esito
433
436
  // che l'errore SPIEGA.
@@ -447,12 +450,12 @@ const Gt = [
447
450
  // un terzo lettore che lo consumasse senza provare l'errore prima renderebbe
448
451
  // il vuoto sopra una fetch caduta. Dichiarare il termine qui è più economico
449
452
  // che ricordare l'ordine in tre punti.
450
- !B && h === 0 && !(c !== void 0 && c.hasMore), ie = lt({
453
+ !B && h === 0 && !(c !== void 0 && c.hasMore), se = lt({
451
454
  // `enabled: virtualized`, SENZA `&& !loading`: adesso è `count` a dire la
452
455
  // verità sul da farsi. Quando si sostituisce, `count` è zero e l'hook esce
453
456
  // con `null` — stesso effetto di prima, ma per la ragione giusta e in un
454
457
  // punto solo.
455
- enabled: ue,
458
+ enabled: ge,
456
459
  count: h + Oe,
457
460
  // L'altezza ESATTA della riga alla densità corrente, non una stima. Misurato
458
461
  // in Chrome: sotto `border-collapse: collapse` una `<tr>` con `height: 36px`
@@ -466,8 +469,8 @@ const Gt = [
466
469
  scrollRef: O,
467
470
  // Serve al PRIMO render, quando il ref è ancora `null`: senza di lui la
468
471
  // griglia montava tutte e 10.000 le righe prima di ridursi a 22.
469
- viewportHeight: fe
470
- }), ke = ie?.startIndex ?? 0, Le = ie?.endIndex ?? h + Oe, Ne = k.slice(
472
+ viewportHeight: me
473
+ }), ke = se?.startIndex ?? 0, Le = se?.endIndex ?? h + Oe, Ne = k.slice(
471
474
  Math.min(ke, h),
472
475
  Math.min(Le, h)
473
476
  ), Be = o.headers[0]?.columnId, et = io === "first-column" && Be !== void 0 ? Ne.map(
@@ -500,7 +503,7 @@ const Gt = [
500
503
  // una prop che tace è peggio di una che non c'è.
501
504
  enabled: c !== void 0 && !F,
502
505
  hasMore: c?.hasMore ?? !1,
503
- loading: p,
506
+ loading: g,
504
507
  // ⚠️ I DATI CONSEGNATI, non `engine.rows.length`: quello è il row model DOPO
505
508
  // il filtro client, quindi in modalità server una risposta che il filtro
506
509
  // locale scarta tutta lascerebbe la chiave immobile e la lista bloccata.
@@ -511,18 +514,18 @@ const Gt = [
511
514
  Te.current += 1, o.applyAndEmit({ type: "query/load-more" });
512
515
  }
513
516
  });
514
- const M = r.table ?? s.table, tt = B ? {
517
+ const P = r.table ?? s.table, tt = B ? {
515
518
  kind: "error",
516
519
  content: /* @__PURE__ */ n(
517
520
  Ke,
518
521
  {
519
522
  kind: "error",
520
- message: M.errorMessage ?? s.table.errorMessage,
521
- retryLabel: M.retry ?? s.table.retry,
523
+ message: P.errorMessage ?? s.table.errorMessage,
524
+ retryLabel: P.retry ?? s.table.retry,
522
525
  onRetry: co
523
526
  }
524
527
  )
525
- } : ne ? {
528
+ } : ie ? {
526
529
  kind: "empty",
527
530
  content: /* @__PURE__ */ n(
528
531
  Ke,
@@ -531,21 +534,21 @@ const Gt = [
531
534
  content: ao ?? r.notFoundMessage
532
535
  }
533
536
  )
534
- } : void 0, De = je().replace(/[^a-zA-Z0-9]/g, ""), se = {
537
+ } : void 0, De = je().replace(/[^a-zA-Z0-9]/g, ""), ae = {
535
538
  head: `adg-head-${De}`,
536
539
  rows: `adg-rows-${De}`
537
540
  };
538
541
  return /* @__PURE__ */ H(
539
542
  "div",
540
543
  {
541
- id: ye,
542
- "data-testid": ve,
544
+ id: ve,
545
+ "data-testid": Ce,
543
546
  "data-app-data-grid": "",
544
547
  ref: Mo,
545
548
  "data-emissions": o.emissions,
546
549
  "data-grid-fullscreen": d ? "true" : "false",
547
- "aria-busy": p ? !0 : void 0,
548
- className: le(
550
+ "aria-busy": g ? !0 : void 0,
551
+ className: de(
549
552
  // ⚠️ `gridFrameGapClass` E NON `gap-2` SCRITTO QUI: il px che
550
553
  // `gridFrameHeight` somma quando la barra di selezione compare e la
551
554
  // classe che lo rende devono cambiare insieme. Vivono accanto in
@@ -573,9 +576,9 @@ const Gt = [
573
576
  style: d ? { zIndex: ft.fullscreen } : void 0,
574
577
  role: d ? "dialog" : void 0,
575
578
  "aria-modal": d ? !0 : void 0,
576
- "aria-label": d ? z.fullscreenExit : void 0,
579
+ "aria-label": d ? V.fullscreenExit : void 0,
577
580
  onKeyDown: d ? (e) => {
578
- e.key === "Escape" && (e.defaultPrevented || (e.stopPropagation(), Ce(!1)));
581
+ e.key === "Escape" && (e.defaultPrevented || (e.stopPropagation(), be(!1)));
579
582
  } : void 0,
580
583
  children: [
581
584
  d && /* @__PURE__ */ n(
@@ -594,16 +597,16 @@ const Gt = [
594
597
  "data-grid-toolbar": "",
595
598
  className: "relative flex flex-wrap items-center gap-2",
596
599
  children: [
597
- /* @__PURE__ */ n("a", { href: `#${se.rows}`, className: Ze, children: M.skipToRows }),
598
- /* @__PURE__ */ n("a", { href: `#${se.head}`, className: Ze, children: M.skipToHeader }),
599
- be(
600
+ /* @__PURE__ */ n("a", { href: `#${ae.rows}`, className: Ze, children: P.skipToRows }),
601
+ /* @__PURE__ */ n("a", { href: `#${ae.head}`, className: Ze, children: P.skipToHeader }),
602
+ Q(
600
603
  l?.search,
601
604
  /* @__PURE__ */ n(
602
605
  it,
603
606
  {
604
607
  type: "search",
605
608
  "data-grid-search": "",
606
- label: z.searchLabel,
609
+ label: V.searchLabel,
607
610
  placeholder: r.searchPlaceholder,
608
611
  value: o.state.query.search,
609
612
  onChange: (e) => (
@@ -622,7 +625,7 @@ const Gt = [
622
625
  "data-grid-search-clear": "",
623
626
  "aria-label": r.clearSearch,
624
627
  onClick: () => o.applyAndEmit({ type: "query/search", value: "" }),
625
- className: le(
628
+ className: de(
626
629
  "focus-visible:ring-d-foreground",
627
630
  "text-d-muted-foreground hover:text-d-foreground flex size-6 cursor-pointer items-center justify-center rounded-md focus-visible:ring-2 focus-visible:outline-none"
628
631
  ),
@@ -645,7 +648,7 @@ const Gt = [
645
648
  xt,
646
649
  {
647
650
  badges: o.state.query.filters,
648
- scope: g,
651
+ scope: p,
649
652
  onOpen: l.filters.onOpen,
650
653
  i18n: r
651
654
  }
@@ -659,19 +662,22 @@ const Gt = [
659
662
  i18n: r
660
663
  }
661
664
  ),
662
- Do && /* @__PURE__ */ n(
663
- Ft,
664
- {
665
- open: Me,
666
- onToggle: () => {
667
- const e = !Pe.current;
668
- Pe.current = e, ko(e), go?.(e);
669
- },
670
- i18n: r
671
- }
665
+ Do && Q(
666
+ l?.filterRowToggle,
667
+ /* @__PURE__ */ n(
668
+ Ft,
669
+ {
670
+ open: Me,
671
+ onToggle: () => {
672
+ const e = !Pe.current;
673
+ Pe.current = e, ko(e), po?.(e);
674
+ },
675
+ i18n: r
676
+ }
677
+ )
672
678
  ),
673
679
  /* @__PURE__ */ H("div", { className: "ml-auto flex flex-wrap items-center gap-2", children: [
674
- l?.columns !== void 0 && (l.columns.render ? (
680
+ l?.columns !== !1 && (l?.columns?.render ? (
675
681
  // ⚠️ `render` VINCE SULLA PRECONDIZIONE, come fa lo slot `filters`
676
682
  // (che da `adg-m3` sta SOPRA questo blocco e non sotto, essendo
677
683
  // rimasto nel gruppo sinistro). `canWriteVisibility` riguarda il nodo di
@@ -689,23 +695,23 @@ const Gt = [
689
695
  onColumnOrderChange: Ao,
690
696
  columnOrder: o.state.view.columnOrder,
691
697
  puoNascondere: Re,
692
- rootRef: V,
698
+ rootRef: G,
693
699
  i18n: r
694
700
  }
695
701
  ) : null),
696
- we.length > 0 && !mo && /* @__PURE__ */ n(ht, { actions: we, i18n: r, rootRef: V }),
697
- l?.actions?.render?.() ?? null,
698
- be(
702
+ Q(
699
703
  l?.fullscreen,
700
704
  /* @__PURE__ */ n(
701
705
  vt,
702
706
  {
703
707
  fullscreen: d,
704
- onChange: Ce,
708
+ onChange: be,
705
709
  i18n: r
706
710
  }
707
711
  )
708
- )
712
+ ),
713
+ he.length > 0 && !mo && /* @__PURE__ */ n(ht, { actions: he, i18n: r, rootRef: G }),
714
+ l?.actions?.render?.() ?? null
709
715
  ] })
710
716
  ]
711
717
  }
@@ -715,7 +721,7 @@ const Gt = [
715
721
  {
716
722
  selectedRowIds: o.selectedPageRowIds,
717
723
  rowsInPage: o.rows.length,
718
- formatCount: g.formatCount,
724
+ formatCount: p.formatCount,
719
725
  density: x,
720
726
  cells: o.selectionCells,
721
727
  labelColumnId: o.footerCells.find((e) => e.content === null)?.columnId,
@@ -736,11 +742,11 @@ const Gt = [
736
742
  bt,
737
743
  {
738
744
  ref: O,
739
- className: le(
745
+ className: de(
740
746
  d && "min-h-0 flex-1",
741
747
  !d && !Se && "min-h-0 grow"
742
748
  ),
743
- style: Se && !d ? { height: fe } : void 0,
749
+ style: Se && !d ? { height: me } : void 0,
744
750
  children: /* @__PURE__ */ n(
745
751
  St,
746
752
  {
@@ -752,7 +758,7 @@ const Gt = [
752
758
  bodyHasData: Ge,
753
759
  onToggleGroup: Go,
754
760
  groupByColumnIds: o.groupByColumnIds,
755
- virtualWindow: ie,
761
+ virtualWindow: se,
756
762
  totalRowCount: Yo,
757
763
  columnTree: o.columnTree,
758
764
  onColumnResize: Oo,
@@ -770,15 +776,15 @@ const Gt = [
770
776
  onToggleRows: o.toggleRows,
771
777
  onSort: o.sort,
772
778
  filteredColumnIds: zo,
773
- filterMode: me,
774
- filterColumns: Vo ? Y : [],
779
+ filterMode: we,
780
+ filterColumns: Vo ? ee : [],
775
781
  filterBadges: o.state.query.filters,
776
782
  filtersHidden: !Me,
777
783
  onFilterRowOperatorChange: Lo,
778
784
  onFilterRowValueChange: No,
779
- onFilterRowClear: Bo ? ee : void 0,
785
+ onFilterRowClear: Bo ? oe : void 0,
780
786
  rowHeaderColumnId: o.rowHeaderColumnId,
781
- bypassIds: se
787
+ bypassIds: ae
782
788
  }
783
789
  )
784
790
  }
@@ -794,18 +800,19 @@ const Gt = [
794
800
  // sapere, quindi emette. Esattamente una volta.
795
801
  o.applyAndEmit({ type: "query/page", pageIndex: e })
796
802
  ),
797
- navigable: F || q !== void 0 || he !== void 0,
803
+ navigable: F || E !== void 0 || ye !== void 0,
798
804
  scope: Wo,
799
- pageSize: J,
800
- pageSizeOptions: K?.pageSizeOptions ?? gt,
801
- applyAndEmit: o.applyAndEmit
805
+ pageSize: Y,
806
+ pageSizeOptions: K?.pageSizeOptions ?? pt,
807
+ applyAndEmit: o.applyAndEmit,
808
+ rootRef: G
802
809
  }
803
810
  ),
804
811
  /* @__PURE__ */ n(
805
812
  Mt,
806
813
  {
807
- visible: !!(po && !p && !B && !ne),
808
- children: p ? z.loadingMore : B ? (
814
+ visible: !!(go && !g && !B && !ie),
815
+ children: g ? V.loadingMore : B ? (
809
816
  // ⚠️ IL RAMO DELL'ERRORE STA PRIMA DI QUELLO DEL VUOTO — Fase 5,
810
817
  // criterio 4. Una fetch caduta ha `dataRowCount === 0`, quindi nel
811
818
  // ternario cadrebbe nel ramo del vuoto e chi ascolta sentirebbe
@@ -817,8 +824,8 @@ const Gt = [
817
824
  // screen reader leggerebbe due volte, una nella tabella e una in
818
825
  // questa regione. Il fallback è PER FOGLIA perché la chiave è
819
826
  // opzionale nel tipo.
820
- M.errorMessage ?? s.table.errorMessage
821
- ) : ne ? (
827
+ P.errorMessage ?? s.table.errorMessage
828
+ ) : ie ? (
822
829
  // ⚠️ SEMPRE `i18n.notFoundMessage`, MAI `emptyComponent`.
823
830
  // `emptyComponent` è un `ReactNode` arbitrario — un'illustrazione,
824
831
  // un bottone, un frammento — e una live region annuncia TESTO:
@@ -857,7 +864,7 @@ const Gt = [
857
864
  // dentro, per la ragione già scritta per `appendingPage`: fuori
858
865
  // dalla modalità infinita non esiste nessuna «pagina in più» da
859
866
  // annunciare.
860
- qo ? z.loadedMore : (
867
+ qo ? V.loadedMore : (
861
868
  // IL RAMO DI RIPOSO, che fino alla Fase 5 era la stringa
862
869
  // vuota: qui vivono le quattro clausole. Sta in FONDO al
863
870
  // ternario di proposito — i tre rami sopra restano intatti,