laif-ds 1.0.2-app-data-grid.76 → 1.0.2-app-data-grid.77

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,6 +1,6 @@
1
1
  "use client";
2
- import { jsx as r, jsxs as H } from "react/jsx-runtime";
3
- import { useMemo as se, useRef as m, useEffect as We, useLayoutEffect as rt, useState as He, useId as je, useCallback as D } from "react";
2
+ import { jsx as n, jsxs as H } from "react/jsx-runtime";
3
+ import { useMemo as se, useRef as m, useEffect as We, useLayoutEffect as nt, useState as He, useId as je, useCallback as D } from "react";
4
4
  import { Icon as Ze } from "../icon.js";
5
5
  import { Input as it } from "../input.js";
6
6
  import { cn as ae } from "../../../lib/utils.js";
@@ -11,7 +11,7 @@ import { flattenGridColumns as _e } from "./grid-header-matrix.js";
11
11
  import { defaultGridI18n as i } from "./grid-i18n.js";
12
12
  import { registerGridMount as dt } from "./grid-mount-count.js";
13
13
  import { gridResultScope as ct, GRID_PAGE_SIZE_OPTIONS as ut } from "./grid-result-scope.js";
14
- import { gridRowHeight as W, gridZ as pt, gridFrameGapClass as gt } from "./grid-tokens.js";
14
+ import { gridRowHeight as W, gridZ as gt, gridFrameGapClass as pt } from "./grid-tokens.js";
15
15
  import { readGridViewPreset as ft } from "./grid-view-preset.js";
16
16
  import { GridActionsRow as mt } from "./parts/grid-actions-row.js";
17
17
  import { createGridFilterBadge as wt } from "./parts/grid-filter-panel.js";
@@ -21,8 +21,8 @@ import { GridScrollArea as vt } from "./parts/grid-scroll-area.js";
21
21
  import { GridSelectionBar as Ct } from "./parts/grid-selection-bar.js";
22
22
  import { GridStatusSurface as Ke } from "./parts/grid-status-surface.js";
23
23
  import { gridBypassLinkClass as Ue, GridTable as bt } from "./parts/grid-table.js";
24
- import { GridToolbarFiltersTrigger as Rt, GridToolbarCustomFilters as St, GridToolbarFilterRowToggle as It, GridToolbarColumnsTrigger as xt } from "./parts/grid-toolbar-slots.js";
25
- import { toGridFilterColumns as Tt } from "./use-grid-filters.js";
24
+ import { GridToolbarResetFiltersTrigger as Rt, GridToolbarFiltersTrigger as St, GridToolbarCustomFilters as It, GridToolbarFilterRowToggle as xt, GridToolbarColumnsTrigger as Tt } from "./parts/grid-toolbar-slots.js";
25
+ import { toGridFilterColumns as Ft } from "./use-grid-filters.js";
26
26
  const Mt = [
27
27
  "a[href]",
28
28
  "button:not([disabled])",
@@ -31,7 +31,7 @@ const Mt = [
31
31
  "textarea:not([disabled])",
32
32
  '[tabindex]:not([tabindex="-1"])'
33
33
  ].join(","), At = ({ visible: v, children: C }) => {
34
- const T = /* @__PURE__ */ r(
34
+ const T = /* @__PURE__ */ n(
35
35
  "div",
36
36
  {
37
37
  "data-grid-live-region": "",
@@ -48,7 +48,7 @@ const Mt = [
48
48
  "data-grid-live-region-frame": "",
49
49
  className: "flex shrink-0 items-center gap-1.5 text-xs",
50
50
  children: [
51
- /* @__PURE__ */ r(
51
+ /* @__PURE__ */ n(
52
52
  Ze,
53
53
  {
54
54
  name: "Megaphone",
@@ -61,11 +61,11 @@ const Mt = [
61
61
  ]
62
62
  }
63
63
  ) : T;
64
- }, en = (v) => {
64
+ }, or = (v) => {
65
65
  const {
66
66
  columns: C,
67
67
  data: T,
68
- i18n: n = i,
68
+ i18n: r = i,
69
69
  sortMode: Qe = "multi",
70
70
  maxSortedColumns: Xe = 2,
71
71
  density: j,
@@ -92,25 +92,25 @@ const Mt = [
92
92
  // ⚠️ `pagination` si legge da qui dalla Fase 4, per la stessa ragione.
93
93
  selection: K,
94
94
  pagination: U,
95
- toolbar: g,
95
+ toolbar: l,
96
96
  initialFullscreen: oo,
97
- paginated: M = !1,
97
+ paginated: F = !1,
98
98
  pageSize: to = 10,
99
99
  virtualized: ce = !1,
100
- infinite: d,
100
+ infinite: c,
101
101
  groupBy: Z,
102
- initialOpenGroups: no,
102
+ initialOpenGroups: ro,
103
103
  // DOVE CADE L'ETICHETTA DI UN GRUPPO — M5, criterio 2. Default
104
104
  // `"grouping-column"`, cioè il comportamento di sempre: una griglia che non
105
105
  // passa questa prop rende esattamente ciò che rendeva prima.
106
- groupLabelPlacement: ro = "grouping-column",
107
- preset: A,
106
+ groupLabelPlacement: no = "grouping-column",
107
+ preset: M,
108
108
  onPresetApplied: ue,
109
- serverMode: pe = !1,
110
- serverConfig: F,
109
+ serverMode: ge = !1,
110
+ serverConfig: q,
111
111
  initialState: io,
112
- viewportHeight: ge = 480,
113
- loading: u = !1,
112
+ viewportHeight: pe = 480,
113
+ loading: g = !1,
114
114
  emptyComponent: so,
115
115
  // GLI ESITI SENZA DATI — FASE 5. `error` è il PREDICATO (una fetch caduta è
116
116
  // distinguibile da un filtro che non pesca niente) e `onRetry` è la sola
@@ -136,12 +136,12 @@ const Mt = [
136
136
  statusRowVisible: uo = !1,
137
137
  // IL TOGGLE DELLA RIGA ZERO, OSSERVABILE — R13, criterio 4. Nessun default:
138
138
  // non passarla lascia la griglia esattamente com'era. Vedi il TSDoc.
139
- onFilterRowOpenChange: po,
139
+ onFilterRowOpenChange: go,
140
140
  // LA PORTATA DELLA SELEZIONE, OSSERVABILE — M10. Nessun default: non
141
141
  // passarla lascia la griglia esattamente com'era, ed è un canale di sola
142
142
  // LETTURA (non esiste una prop che imponga la portata da fuori). Vedi il
143
143
  // TSDoc, dove le due metà della precondizione sono separate.
144
- onSelectionScopeChange: go,
144
+ onSelectionScopeChange: po,
145
145
  actions: me = [],
146
146
  hideActionsRow: fo = !1,
147
147
  checkable: mo = !1,
@@ -166,7 +166,7 @@ const Mt = [
166
166
  // è stato morto, è il valore da cui riparte se il call-site smette di
167
167
  // controllare la prop.
168
168
  density: j ?? "default",
169
- paginated: M,
169
+ paginated: F,
170
170
  // LA TAGLIA DI PAGINA SI RISOLVE QUI, IN UN PUNTO SOLO — e la precedenza è
171
171
  // `initialState.pagination.pageSize` > `pagination.pageSize` > `pageSize`.
172
172
  //
@@ -186,13 +186,13 @@ const Mt = [
186
186
  // su `serverConfig.onStateChange`. Chiamarli entrambi sarebbe due refetch per
187
187
  // gesto, cioè il difetto R10 con un altro nome — e un consumer che li passa
188
188
  // tutti e due ha quasi certamente migrato a metà, non chiesto il doppio.
189
- onQueryChange: we ?? F?.onStateChange,
189
+ onQueryChange: we ?? q?.onStateChange,
190
190
  debounceTime: bo,
191
- serverMode: pe,
192
- serverConfig: F,
191
+ serverMode: ge,
192
+ serverConfig: q,
193
193
  initialState: io,
194
194
  groupBy: Z,
195
- initialOpenGroups: no,
195
+ initialOpenGroups: ro,
196
196
  rowSelection: wo,
197
197
  getRowId: ho,
198
198
  onRowSelectionChange: yo,
@@ -201,7 +201,7 @@ const Mt = [
201
201
  // Le due fonti sollevate di P7: quando ci sono, comandano. Vedi le prop.
202
202
  filters: S,
203
203
  columnVisibility: _
204
- }), x = So ? j : o.state.view.density, E = n.toolbar ?? i.toolbar, l = o.state.view.fullscreen, ve = (e) => {
204
+ }), x = So ? j : o.state.view.density, E = r.toolbar ?? i.toolbar, d = o.state.view.fullscreen, ve = (e) => {
205
205
  o.applyView({ type: "view/fullscreen", fullscreen: e }), Je?.(e);
206
206
  }, Ce = (e, t) => e?.render ? e.render() : t, Io = se(
207
207
  () => _e(C).map((e) => ({
@@ -244,37 +244,37 @@ const Mt = [
244
244
  ...o.state.view.columnVisibility,
245
245
  [e]: t
246
246
  }));
247
- }, Mo = (e) => {
247
+ }, Fo = (e) => {
248
248
  o.applyView({ type: "view/column-order", columnOrder: e }), eo?.([...e]);
249
- }, Ao = (e, t) => {
249
+ }, Mo = (e, t) => {
250
250
  o.applyView({ type: "view/column-width", columnId: e, width: t }), Ye?.({
251
251
  ...o.state.view.columnWidths,
252
252
  [e]: t
253
253
  });
254
- }, Re = v.viewportHeight !== void 0 || ce || d !== void 0 || Z !== void 0, O = m(null), Se = m(0), Ie = m(void 0);
254
+ }, Re = v.viewportHeight !== void 0 || ce || c !== void 0 || Z !== void 0, A = m(null), Se = m(0), Ie = m(void 0);
255
255
  We(() => {
256
- if (A === void 0 || Ie.current === A) return;
257
- Ie.current = A;
256
+ if (M === void 0 || Ie.current === M) return;
257
+ Ie.current = M;
258
258
  let e;
259
259
  try {
260
- e = ft(A);
260
+ e = ft(M);
261
261
  } catch (t) {
262
262
  console.error(t);
263
263
  return;
264
264
  }
265
265
  o.applyPreset({ query: e.query, view: e.view }), le?.(e.view.density), ue?.(e);
266
- }, [A, o, ue, le]);
267
- const Q = m(null), Oo = (e, t) => {
268
- const s = O.current;
266
+ }, [M, o, ue, le]);
267
+ const Q = m(null), Ao = (e, t) => {
268
+ const s = A.current;
269
269
  if (s !== null) {
270
270
  const a = k.findIndex(
271
271
  (De) => De.kind === "group" && De.group.path === e
272
- ), c = Math.floor(
272
+ ), u = Math.floor(
273
273
  s.scrollTop / W[x]
274
- ), G = { ...o.state.view.groupExpansion };
275
- G[e] = t;
276
- const R = o.bodyRowCountWith(G) - k.length, f = a !== -1 && a < c, nt = f && R < 0 && c <= a - R;
277
- Q.current = !f || R === 0 ? null : nt ? { modo: "atterra-sul-gruppo", indiceGruppo: a } : {
274
+ ), P = { ...o.state.view.groupExpansion };
275
+ P[e] = t;
276
+ const R = o.bodyRowCountWith(P) - k.length, f = a !== -1 && a < u, rt = f && R < 0 && u <= a - R;
277
+ Q.current = !f || R === 0 ? null : rt ? { modo: "atterra-sul-gruppo", indiceGruppo: a } : {
278
278
  modo: "tieni-ferma-la-vista",
279
279
  // ⚠️ SI LEGGE ADESSO, PRIMA DEL COMMIT, e non nell'effetto: è
280
280
  // l'unico istante in cui questo numero è ancora quello
@@ -285,32 +285,32 @@ const Mt = [
285
285
  }
286
286
  o.applyView({ type: "view/group-expansion", path: e, expanded: t });
287
287
  };
288
- rt(() => {
288
+ nt(() => {
289
289
  const e = Q.current;
290
290
  if (Q.current = null, e === null) return;
291
- const t = O.current;
291
+ const t = A.current;
292
292
  t !== null && (t.scrollTop = e.modo === "atterra-sul-gruppo" ? e.indiceGruppo * W[x] : e.scrollTopPrima + e.delta * W[x]);
293
293
  });
294
- const xe = m(0), Te = he ?? ye ?? null, X = m(null), V = m(null), Po = (e) => {
294
+ const xe = m(0), Te = he ?? ye ?? null, X = m(null), V = m(null), Oo = (e) => {
295
295
  V.current = e, e && (Se.current += 1, e.setAttribute("data-render-count", String(Se.current)), X.current === null && (X.current = Te === null ? 1 : dt(Te)), e.setAttribute("data-mount-count", String(X.current)), e.setAttribute(
296
296
  "data-loadmore-call-count",
297
297
  String(xe.current)
298
298
  ));
299
- }, Me = (e) => {
299
+ }, Fe = (e) => {
300
300
  const t = V.current;
301
301
  if (!t) return;
302
302
  const s = Array.from(
303
303
  t.querySelectorAll(Mt)
304
- ).filter((c) => c.dataset.gridFocusSentinel === void 0), a = e === "first" ? s : [...s].reverse();
305
- for (const c of a)
306
- if (c.focus(), document.activeElement === c) return;
307
- }, k = o.bodyRows, qo = k.length, w = o.state.query.requestCount, P = m(w);
308
- w < P.current && (P.current = w);
309
- const Go = d !== void 0 && w > Math.max(1, P.current);
304
+ ).filter((u) => u.dataset.gridFocusSentinel === void 0), a = e === "first" ? s : [...s].reverse();
305
+ for (const u of a)
306
+ if (u.focus(), document.activeElement === u) return;
307
+ }, k = o.bodyRows, Go = k.length, w = o.state.query.requestCount, O = m(w);
308
+ w < O.current && (O.current = w);
309
+ const Po = c !== void 0 && w > Math.max(1, O.current);
310
310
  We(() => {
311
- d === void 0 || u || w > P.current && (P.current = w);
312
- }, [d, u, w]);
313
- const Fo = d !== void 0 && u && w > 1, $o = u && !Fo, J = o.state.query.pagination.pageSize, Ae = u ? Math.min(J, 1e3) : 0, h = $o ? 0 : qo, Oe = h > 0, y = ("resultTotal" in v ? v.resultTotal : void 0) ?? F?.totalItems ?? (M && !pe && !(d !== void 0 && d.hasMore) ? o.filteredRowCount : void 0), zo = se(
311
+ c === void 0 || g || w > O.current && (O.current = w);
312
+ }, [c, g, w]);
313
+ const qo = c !== void 0 && g && w > 1, $o = g && !qo, J = o.state.query.pagination.pageSize, Me = g ? Math.min(J, 1e3) : 0, h = $o ? 0 : Go, Ae = h > 0, y = ("resultTotal" in v ? v.resultTotal : void 0) ?? q?.totalItems ?? (F && !ge && !(c !== void 0 && c.hasMore) ? o.filteredRowCount : void 0), zo = se(
314
314
  () => new Set(o.state.query.filters.map((e) => e.columnId)),
315
315
  [o.state.query.filters]
316
316
  ), Y = se(
@@ -318,9 +318,9 @@ const Mt = [
318
318
  // `toGridFilterColumns` vuole le foglie: è lo stesso appiattimento che il
319
319
  // call-site fa per costruire le colonne dell'inventario, quindi le due liste
320
320
  // sono la stessa lista e non due liste che si somigliano.
321
- () => Tt(_e(C)),
321
+ () => Ft(_e(C)),
322
322
  [C]
323
- ), Eo = S === void 0 || $ !== void 0 && z !== void 0, [Pe, Vo] = He(!0), qe = m(!0), Ge = je(), Fe = m(0), L = D(
323
+ ), Eo = S === void 0 || $ !== void 0 && z !== void 0, [Oe, Vo] = He(!0), Ge = m(!0), Pe = je(), qe = m(0), L = D(
324
324
  (e, t) => {
325
325
  const s = o.state.query.filters, a = s.find((f) => f.columnId === e);
326
326
  if (a !== void 0) {
@@ -336,18 +336,18 @@ const Mt = [
336
336
  });
337
337
  return;
338
338
  }
339
- const c = Y.find(
339
+ const u = Y.find(
340
340
  (f) => f.id === e
341
341
  );
342
- if (c === void 0) return;
343
- Fe.current += 1;
344
- const G = wt(
345
- c,
346
- n,
347
- `${Ge}-${Fe.current}`
342
+ if (u === void 0) return;
343
+ qe.current += 1;
344
+ const P = wt(
345
+ u,
346
+ r,
347
+ `${Pe}-${qe.current}`
348
348
  );
349
- if (G === void 0) return;
350
- const R = { ...G, ...t };
349
+ if (P === void 0) return;
350
+ const R = { ...P, ...t };
351
351
  if ($ !== void 0) {
352
352
  $(R);
353
353
  return;
@@ -360,8 +360,8 @@ const Mt = [
360
360
  [
361
361
  o,
362
362
  Y,
363
- Ge,
364
- n,
363
+ Pe,
364
+ r,
365
365
  $,
366
366
  z
367
367
  ]
@@ -397,19 +397,19 @@ const Mt = [
397
397
  rowsInPage: o.rows.length,
398
398
  pageIndex: o.state.query.pagination.pageIndex,
399
399
  pageSize: J
400
- }), Wo = y === void 0 ? void 0 : p, ee = n.status ?? {}, N = n.selection ?? {}, $e = o.headers.filter((e) => e.sortIndex !== null).sort((e, t) => (e.sortIndex ?? 0) - (t.sortIndex ?? 0)), Ho = $e.length === 0 ? "" : `${ee.sortedBy ?? i.status.sortedBy} ${$e.map((e) => {
401
- const t = e.sortDirection === "descending" ? n.sorting.descending : n.sorting.ascending, s = `${e.headerLabel} ${t}`;
400
+ }), Wo = y === void 0 ? void 0 : p, ee = 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 ? "" : `${ee.sortedBy ?? i.status.sortedBy} ${$e.map((e) => {
401
+ const t = e.sortDirection === "descending" ? r.sorting.descending : r.sorting.ascending, s = `${e.headerLabel} ${t}`;
402
402
  if (e.sortCount <= 1) return s;
403
- const a = n.sorting.sortPosition ?? i.sorting.sortPosition, c = n.pagination.of ?? i.pagination.of;
404
- return `${s}, ${a} ${e.sortIndex ?? 0} ${c} ${e.sortCount}`;
405
- }).join("; ")}`, jo = `${p.totalLabel} ${p.totalIsSingular ? n.pagination.rowOne ?? i.pagination.rowOne : n.pagination.rows}`, oe = o.state.query.filters.filter(
403
+ const a = r.sorting.sortPosition ?? i.sorting.sortPosition, u = r.pagination.of ?? i.pagination.of;
404
+ return `${s}, ${a} ${e.sortIndex ?? 0} ${u} ${e.sortCount}`;
405
+ }).join("; ")}`, jo = `${p.totalLabel} ${p.totalIsSingular ? r.pagination.rowOne ?? i.pagination.rowOne : r.pagination.rows}`, oe = o.state.query.filters.filter(
406
406
  (e) => e.kind === "custom"
407
- ), _o = oe.length === 0 ? "" : `, ${p.formatCount(oe.length)} ${n.filters.withoutColumn ?? i.filters.withoutColumn}: ${oe.map((e) => e.customLabel ?? e.customKey ?? e.id).join(", ")}`, Ko = `${p.filterCountLabel} ${p.filterCountIsSingular ? n.filters.filterOne ?? i.filters.filterOne : n.filters.filterMany ?? i.filters.filterMany} ${p.filterCountIsSingular ? ee.filterActiveOne ?? i.status.filterActiveOne : ee.filterActiveMany ?? i.status.filterActiveMany}${_o}`, b = o.selectedPageRowIds.length, ze = K?.mode === "all" && y !== void 0, [Uo, Zo] = He("page"), te = ze ? Uo : "page", Qo = {
407
+ ), _o = oe.length === 0 ? "" : `, ${p.formatCount(oe.length)} ${r.filters.withoutColumn ?? i.filters.withoutColumn}: ${oe.map((e) => e.customLabel ?? e.customKey ?? e.id).join(", ")}`, Ko = `${p.filterCountLabel} ${p.filterCountIsSingular ? r.filters.filterOne ?? i.filters.filterOne : r.filters.filterMany ?? i.filters.filterMany} ${p.filterCountIsSingular ? ee.filterActiveOne ?? i.status.filterActiveOne : ee.filterActiveMany ?? i.status.filterActiveMany}${_o}`, b = o.selectedPageRowIds.length, ze = K?.mode === "all" && y !== void 0, [Uo, Zo] = He("page"), te = ze ? Uo : "page", Qo = {
408
408
  scope: te,
409
409
  rowIds: o.selectedPageRowIds,
410
410
  count: te === "all" ? y ?? b : b
411
411
  }, Ee = (e) => {
412
- e !== te && (Zo(e), go?.({
412
+ e !== te && (Zo(e), po?.({
413
413
  scope: e,
414
414
  rowIds: o.selectedPageRowIds,
415
415
  count: e === "all" ? y ?? b : b
@@ -419,7 +419,7 @@ const Mt = [
419
419
  jo,
420
420
  Ko,
421
421
  Xo
422
- ].filter((e) => e !== "").join(". "), Yo = d !== void 0 && d.hasMore ? -1 : y ?? h, B = ao && !u, ne = !u && // ⚠️ `&& !erroreVisibile`, ED È LA RIGA CHE TIENE I DUE ESITI SEPARATI. Una
422
+ ].filter((e) => e !== "").join(". "), Yo = c !== void 0 && c.hasMore ? -1 : y ?? h, B = ao && !g, re = !g && // ⚠️ `&& !erroreVisibile`, ED È LA RIGA CHE TIENE I DUE ESITI SEPARATI. Una
423
423
  // fetch caduta ha `dataRowCount === 0`, quindi senza questo termine i due
424
424
  // predicati sono veri insieme. Il vuoto è quello che tace, perché è l'esito
425
425
  // che l'errore SPIEGA.
@@ -439,13 +439,13 @@ const Mt = [
439
439
  // un terzo lettore che lo consumasse senza provare l'errore prima renderebbe
440
440
  // il vuoto sopra una fetch caduta. Dichiarare il termine qui è più economico
441
441
  // che ricordare l'ordine in tre punti.
442
- !B && h === 0 && !(d !== void 0 && d.hasMore), re = lt({
442
+ !B && h === 0 && !(c !== void 0 && c.hasMore), ne = lt({
443
443
  // `enabled: virtualized`, SENZA `&& !loading`: adesso è `count` a dire la
444
444
  // verità sul da farsi. Quando si sostituisce, `count` è zero e l'hook esce
445
445
  // con `null` — stesso effetto di prima, ma per la ragione giusta e in un
446
446
  // punto solo.
447
447
  enabled: ce,
448
- count: h + Ae,
448
+ count: h + Me,
449
449
  // L'altezza ESATTA della riga alla densità corrente, non una stima. Misurato
450
450
  // in Chrome: sotto `border-collapse: collapse` una `<tr>` con `height: 36px`
451
451
  // e `border-bottom: 1px` è alta esattamente 36 — il bordo collassato non si
@@ -455,14 +455,14 @@ const Mt = [
455
455
  // resa è zero, e non serve nessuna misurazione dinamica (quindi nessun
456
456
  // `ResizeObserver` da mandare in loop).
457
457
  rowHeight: W[x],
458
- scrollRef: O,
458
+ scrollRef: A,
459
459
  // Serve al PRIMO render, quando il ref è ancora `null`: senza di lui la
460
460
  // griglia montava tutte e 10.000 le righe prima di ridursi a 22.
461
- viewportHeight: ge
462
- }), Ve = re?.startIndex ?? 0, ke = re?.endIndex ?? h + Ae, Le = k.slice(
461
+ viewportHeight: pe
462
+ }), Ve = ne?.startIndex ?? 0, ke = ne?.endIndex ?? h + Me, Le = k.slice(
463
463
  Math.min(Ve, h),
464
464
  Math.min(ke, h)
465
- ), Ne = o.headers[0]?.columnId, et = ro === "first-column" && Ne !== void 0 ? Le.map(
465
+ ), Ne = o.headers[0]?.columnId, et = no === "first-column" && Ne !== void 0 ? Le.map(
466
466
  (e) => e.kind === "group" ? {
467
467
  ...e,
468
468
  group: { ...e.group, columnId: Ne }
@@ -490,37 +490,37 @@ const Mt = [
490
490
  // costo è che `infinite` con `paginated` non faccia NIENTE, ed è per questo
491
491
  // che il limite è scritto in `AppDataGrid.md` invece di essere taciuto —
492
492
  // una prop che tace è peggio di una che non c'è.
493
- enabled: d !== void 0 && !M,
494
- hasMore: d?.hasMore ?? !1,
495
- loading: u,
493
+ enabled: c !== void 0 && !F,
494
+ hasMore: c?.hasMore ?? !1,
495
+ loading: g,
496
496
  // ⚠️ I DATI CONSEGNATI, non `engine.rows.length`: quello è il row model DOPO
497
497
  // il filtro client, quindi in modalità server una risposta che il filtro
498
498
  // locale scarta tutta lascerebbe la chiave immobile e la lista bloccata.
499
499
  rowCount: T.length,
500
500
  querySignature: o.querySignature,
501
- scrollRef: O,
501
+ scrollRef: A,
502
502
  onLoadMore: () => {
503
503
  xe.current += 1, o.applyAndEmit({ type: "query/load-more" });
504
504
  }
505
505
  });
506
- const q = n.table ?? i.table, tt = B ? {
506
+ const G = r.table ?? i.table, tt = B ? {
507
507
  kind: "error",
508
- content: /* @__PURE__ */ r(
508
+ content: /* @__PURE__ */ n(
509
509
  Ke,
510
510
  {
511
511
  kind: "error",
512
- message: q.errorMessage ?? i.table.errorMessage,
513
- retryLabel: q.retry ?? i.table.retry,
512
+ message: G.errorMessage ?? i.table.errorMessage,
513
+ retryLabel: G.retry ?? i.table.retry,
514
514
  onRetry: lo
515
515
  }
516
516
  )
517
- } : ne ? {
517
+ } : re ? {
518
518
  kind: "empty",
519
- content: /* @__PURE__ */ r(
519
+ content: /* @__PURE__ */ n(
520
520
  Ke,
521
521
  {
522
522
  kind: "empty",
523
- content: so ?? n.notFoundMessage
523
+ content: so ?? r.notFoundMessage
524
524
  }
525
525
  )
526
526
  } : void 0, Be = je().replace(/[^a-zA-Z0-9]/g, ""), ie = {
@@ -533,17 +533,17 @@ const Mt = [
533
533
  id: he,
534
534
  "data-testid": ye,
535
535
  "data-app-data-grid": "",
536
- ref: Po,
536
+ ref: Oo,
537
537
  "data-emissions": o.emissions,
538
- "data-grid-fullscreen": l ? "true" : "false",
539
- "aria-busy": u ? !0 : void 0,
538
+ "data-grid-fullscreen": d ? "true" : "false",
539
+ "aria-busy": g ? !0 : void 0,
540
540
  className: ae(
541
541
  // ⚠️ `gridFrameGapClass` E NON `gap-2` SCRITTO QUI: il px che
542
542
  // `gridFrameHeight` somma quando la barra di selezione compare e la
543
543
  // classe che lo rende devono cambiare insieme. Vivono accanto in
544
544
  // `grid-tokens.ts`, come `gridRowHeight`/`gridRowHeightClass`.
545
545
  "border-d-border bg-d-background text-d-foreground flex w-full flex-col rounded-md border p-2",
546
- gt,
546
+ pt,
547
547
  // LO SCHERMO INTERO È UNA PROMOZIONE DELLO STESSO NODO — P6, criteri 2-4.
548
548
  //
549
549
  // Non un portale, non un secondo albero, non `requestFullscreen`: le
@@ -559,25 +559,25 @@ const Mt = [
559
559
  // rilievo della review, ed era l'unica classe del ramo senza una ragione.
560
560
  // `rounded-none` invece serve: a tutto schermo gli angoli arrotondati
561
561
  // lascerebbero quattro triangoli della pagina visibili negli spigoli.
562
- l && "fixed inset-0 rounded-none border-0",
562
+ d && "fixed inset-0 rounded-none border-0",
563
563
  Ro
564
564
  ),
565
- style: l ? { zIndex: pt.fullscreen } : void 0,
566
- role: l ? "dialog" : void 0,
567
- "aria-modal": l ? !0 : void 0,
568
- "aria-label": l ? E.fullscreenExit : void 0,
569
- onKeyDown: l ? (e) => {
565
+ style: d ? { zIndex: gt.fullscreen } : void 0,
566
+ role: d ? "dialog" : void 0,
567
+ "aria-modal": d ? !0 : void 0,
568
+ "aria-label": d ? E.fullscreenExit : void 0,
569
+ onKeyDown: d ? (e) => {
570
570
  e.key === "Escape" && (e.defaultPrevented || (e.stopPropagation(), ve(!1)));
571
571
  } : void 0,
572
572
  children: [
573
- l && /* @__PURE__ */ r(
573
+ d && /* @__PURE__ */ n(
574
574
  "div",
575
575
  {
576
576
  "data-grid-focus-sentinel": "head",
577
577
  tabIndex: 0,
578
578
  "aria-hidden": "true",
579
579
  className: "sr-only",
580
- onFocus: () => Me("last")
580
+ onFocus: () => Fe("last")
581
581
  }
582
582
  ),
583
583
  /* @__PURE__ */ H(
@@ -586,17 +586,17 @@ const Mt = [
586
586
  "data-grid-toolbar": "",
587
587
  className: "relative flex flex-wrap items-center gap-2",
588
588
  children: [
589
- /* @__PURE__ */ r("a", { href: `#${ie.rows}`, className: Ue, children: q.skipToRows }),
590
- /* @__PURE__ */ r("a", { href: `#${ie.head}`, className: Ue, children: q.skipToHeader }),
589
+ /* @__PURE__ */ n("a", { href: `#${ie.rows}`, className: Ue, children: G.skipToRows }),
590
+ /* @__PURE__ */ n("a", { href: `#${ie.head}`, className: Ue, children: G.skipToHeader }),
591
591
  Ce(
592
- g?.search,
593
- /* @__PURE__ */ r(
592
+ l?.search,
593
+ /* @__PURE__ */ n(
594
594
  it,
595
595
  {
596
596
  type: "search",
597
597
  "data-grid-search": "",
598
598
  label: E.searchLabel,
599
- placeholder: n.searchPlaceholder,
599
+ placeholder: r.searchPlaceholder,
600
600
  value: o.state.query.search,
601
601
  onChange: (e) => (
602
602
  // Un'azione della slice QUERY: passa dal dispatcher che emette.
@@ -607,18 +607,18 @@ const Mt = [
607
607
  ),
608
608
  iconLeft: "Search",
609
609
  size: "sm",
610
- endContent: o.state.query.search === "" ? void 0 : /* @__PURE__ */ r(
610
+ endContent: o.state.query.search === "" ? void 0 : /* @__PURE__ */ n(
611
611
  "button",
612
612
  {
613
613
  type: "button",
614
614
  "data-grid-search-clear": "",
615
- "aria-label": n.clearSearch,
615
+ "aria-label": r.clearSearch,
616
616
  onClick: () => o.applyAndEmit({ type: "query/search", value: "" }),
617
617
  className: ae(
618
618
  "focus-visible:ring-d-foreground",
619
619
  "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"
620
620
  ),
621
- children: /* @__PURE__ */ r(Ze, { name: "X", size: "xs", "aria-hidden": "true" })
621
+ children: /* @__PURE__ */ n(Ze, { name: "X", size: "xs", "aria-hidden": "true" })
622
622
  }
623
623
  ),
624
624
  labelClassName: "shrink-0 text-xs font-normal whitespace-nowrap",
@@ -626,37 +626,44 @@ const Mt = [
626
626
  }
627
627
  )
628
628
  ),
629
- g?.filters?.render ? g.filters.render() : g?.filters?.onOpen !== void 0 && /* @__PURE__ */ r(
629
+ l?.resetFilters?.render ? l.resetFilters.render() : l?.resetFilters?.onReset !== void 0 && /* @__PURE__ */ n(
630
630
  Rt,
631
+ {
632
+ onReset: l.resetFilters.onReset,
633
+ i18n: r
634
+ }
635
+ ),
636
+ l?.filters?.render ? l.filters.render() : l?.filters?.onOpen !== void 0 && /* @__PURE__ */ n(
637
+ St,
631
638
  {
632
639
  badges: o.state.query.filters,
633
640
  scope: p,
634
- onOpen: g.filters.onOpen,
635
- i18n: n
641
+ onOpen: l.filters.onOpen,
642
+ i18n: r
636
643
  }
637
644
  ),
638
- I !== void 0 && S !== void 0 && /* @__PURE__ */ r(
639
- St,
645
+ I !== void 0 && S !== void 0 && /* @__PURE__ */ n(
646
+ It,
640
647
  {
641
648
  badges: o.state.query.filters,
642
649
  onRemove: I,
643
650
  controls: co,
644
- i18n: n
651
+ i18n: r
645
652
  }
646
653
  ),
647
- Do && /* @__PURE__ */ r(
648
- It,
654
+ Do && /* @__PURE__ */ n(
655
+ xt,
649
656
  {
650
- open: Pe,
657
+ open: Oe,
651
658
  onToggle: () => {
652
- const e = !qe.current;
653
- qe.current = e, Vo(e), po?.(e);
659
+ const e = !Ge.current;
660
+ Ge.current = e, Vo(e), go?.(e);
654
661
  },
655
- i18n: n
662
+ i18n: r
656
663
  }
657
664
  ),
658
665
  /* @__PURE__ */ H("div", { className: "ml-auto flex flex-wrap items-center gap-2", children: [
659
- g?.columns !== void 0 && (g.columns.render ? (
666
+ l?.columns !== void 0 && (l.columns.render ? (
660
667
  // ⚠️ `render` VINCE SULLA PRECONDIZIONE, come fa lo slot `filters`
661
668
  // (che da `adg-m3` sta SOPRA questo blocco e non sotto, essendo
662
669
  // rimasto nel gruppo sinistro). `canWriteVisibility` riguarda il nodo di
@@ -664,30 +671,30 @@ const Mt = [
664
671
  // parte — non lo slot: sopprimere anche il nodo del consumer significa
665
672
  // spegnere un pannello suo, che magari scrive la mappa dal proprio
666
673
  // riduttore. Trovato da una review delle riparazioni.
667
- g.columns.render()
668
- ) : xo ? /* @__PURE__ */ r(
669
- xt,
674
+ l.columns.render()
675
+ ) : xo ? /* @__PURE__ */ n(
676
+ Tt,
670
677
  {
671
678
  columns: Io,
672
679
  columnVisibility: o.state.view.columnVisibility,
673
680
  onColumnVisibleChange: To,
674
- onColumnOrderChange: Mo,
681
+ onColumnOrderChange: Fo,
675
682
  columnOrder: o.state.view.columnOrder,
676
683
  puoNascondere: be,
677
684
  rootRef: V,
678
- i18n: n
685
+ i18n: r
679
686
  }
680
687
  ) : null),
681
- me.length > 0 && !fo && /* @__PURE__ */ r(mt, { actions: me, i18n: n, rootRef: V }),
682
- g?.actions?.render?.() ?? null,
688
+ me.length > 0 && !fo && /* @__PURE__ */ n(mt, { actions: me, i18n: r, rootRef: V }),
689
+ l?.actions?.render?.() ?? null,
683
690
  Ce(
684
- g?.fullscreen,
685
- /* @__PURE__ */ r(
691
+ l?.fullscreen,
692
+ /* @__PURE__ */ n(
686
693
  ht,
687
694
  {
688
- fullscreen: l,
695
+ fullscreen: d,
689
696
  onChange: ve,
690
- i18n: n
697
+ i18n: r
691
698
  }
692
699
  )
693
700
  )
@@ -695,7 +702,7 @@ const Mt = [
695
702
  ]
696
703
  }
697
704
  ),
698
- /* @__PURE__ */ r(
705
+ /* @__PURE__ */ n(
699
706
  Ct,
700
707
  {
701
708
  selectedRowIds: o.selectedPageRowIds,
@@ -714,19 +721,19 @@ const Mt = [
714
721
  allRowsSelected: o.allRowsSelected,
715
722
  onDismiss: () => o.toggleRows(o.selectedPageRowIds, !1),
716
723
  summary: K?.summary?.render,
717
- i18n: n
724
+ i18n: r
718
725
  }
719
726
  ),
720
- /* @__PURE__ */ r(
727
+ /* @__PURE__ */ n(
721
728
  vt,
722
729
  {
723
- ref: O,
730
+ ref: A,
724
731
  className: ae(
725
- l && "min-h-0 flex-1",
726
- !l && !Re && "min-h-0 grow"
732
+ d && "min-h-0 flex-1",
733
+ !d && !Re && "min-h-0 grow"
727
734
  ),
728
- style: Re && !l ? { height: ge } : void 0,
729
- children: /* @__PURE__ */ r(
735
+ style: Re && !d ? { height: pe } : void 0,
736
+ children: /* @__PURE__ */ n(
730
737
  bt,
731
738
  {
732
739
  headers: o.headers,
@@ -734,16 +741,16 @@ const Mt = [
734
741
  statusSurface: tt,
735
742
  footerCells: o.footerCells,
736
743
  hasAggregates: o.hasAggregates,
737
- bodyHasData: Oe,
738
- onToggleGroup: Oo,
744
+ bodyHasData: Ae,
745
+ onToggleGroup: Ao,
739
746
  groupByColumnIds: o.groupByColumnIds,
740
- virtualWindow: re,
747
+ virtualWindow: ne,
741
748
  totalRowCount: Yo,
742
749
  columnTree: o.columnTree,
743
- onColumnResize: Ao,
750
+ onColumnResize: Mo,
744
751
  density: x,
745
- fullscreen: l,
746
- i18n: n,
752
+ fullscreen: d,
753
+ i18n: r,
747
754
  columnWidths: o.state.view.columnWidths,
748
755
  skeletonRowCount: ot,
749
756
  checkable: mo,
@@ -758,7 +765,7 @@ const Mt = [
758
765
  filterMode: fe,
759
766
  filterColumns: Eo ? Y : [],
760
767
  filterBadges: o.state.query.filters,
761
- filtersHidden: !Pe,
768
+ filtersHidden: !Oe,
762
769
  onFilterRowOperatorChange: ko,
763
770
  onFilterRowValueChange: Lo,
764
771
  onFilterRowClear: Bo ? No : void 0,
@@ -768,29 +775,29 @@ const Mt = [
768
775
  )
769
776
  }
770
777
  ),
771
- Oe && (M || U?.pageSize !== void 0 && Z === void 0) && /* @__PURE__ */ r(
778
+ Ae && (F || U?.pageSize !== void 0 && Z === void 0) && /* @__PURE__ */ n(
772
779
  yt,
773
780
  {
774
781
  pageIndex: o.state.query.pagination.pageIndex,
775
782
  pageCount: o.pageCount,
776
- i18n: n,
783
+ i18n: r,
777
784
  onPageChange: (e) => (
778
785
  // Un'azione della slice QUERY: cambia ciò che il server deve
779
786
  // sapere, quindi emette. Esattamente una volta.
780
787
  o.applyAndEmit({ type: "query/page", pageIndex: e })
781
788
  ),
782
- navigable: M || F !== void 0 || we !== void 0,
789
+ navigable: F || q !== void 0 || we !== void 0,
783
790
  scope: Wo,
784
791
  pageSize: J,
785
792
  pageSizeOptions: U?.pageSizeOptions ?? ut,
786
793
  applyAndEmit: o.applyAndEmit
787
794
  }
788
795
  ),
789
- /* @__PURE__ */ r(
796
+ /* @__PURE__ */ n(
790
797
  At,
791
798
  {
792
- visible: !!(uo && !u && !B && !ne),
793
- children: u ? E.loadingMore : B ? (
799
+ visible: !!(uo && !g && !B && !re),
800
+ children: g ? E.loadingMore : B ? (
794
801
  // ⚠️ IL RAMO DELL'ERRORE STA PRIMA DI QUELLO DEL VUOTO — Fase 5,
795
802
  // criterio 4. Una fetch caduta ha `dataRowCount === 0`, quindi nel
796
803
  // ternario cadrebbe nel ramo del vuoto e chi ascolta sentirebbe
@@ -802,8 +809,8 @@ const Mt = [
802
809
  // screen reader leggerebbe due volte, una nella tabella e una in
803
810
  // questa regione. Il fallback è PER FOGLIA perché la chiave è
804
811
  // opzionale nel tipo.
805
- q.errorMessage ?? i.table.errorMessage
806
- ) : ne ? (
812
+ G.errorMessage ?? i.table.errorMessage
813
+ ) : re ? (
807
814
  // ⚠️ SEMPRE `i18n.notFoundMessage`, MAI `emptyComponent`.
808
815
  // `emptyComponent` è un `ReactNode` arbitrario — un'illustrazione,
809
816
  // un bottone, un frammento — e una live region annuncia TESTO:
@@ -811,7 +818,7 @@ const Mt = [
811
818
  // (o nessuno) e potrebbe metterci dentro controlli che uno screen
812
819
  // reader leggerebbe due volte. Qui ci va la stringa, che è testo
813
820
  // per costruzione.
814
- n.notFoundMessage
821
+ r.notFoundMessage
815
822
  ) : (
816
823
  // ⚠️ IL RAMO DELL'ANNUNCIO DI PAGINA VALE SOLO IN MODALITÀ
817
824
  // INFINITA, e la guardia è nuova della Fase 6 perché è la Fase 6
@@ -842,7 +849,7 @@ const Mt = [
842
849
  // dentro, per la ragione già scritta per `appendingPage`: fuori
843
850
  // dalla modalità infinita non esiste nessuna «pagina in più» da
844
851
  // annunciare.
845
- Go ? E.loadedMore : (
852
+ Po ? E.loadedMore : (
846
853
  // IL RAMO DI RIPOSO, che fino alla Fase 5 era la stringa
847
854
  // vuota: qui vivono le quattro clausole. Sta in FONDO al
848
855
  // ternario di proposito — i tre rami sopra restano intatti,
@@ -855,14 +862,14 @@ const Mt = [
855
862
  )
856
863
  }
857
864
  ),
858
- l && /* @__PURE__ */ r(
865
+ d && /* @__PURE__ */ n(
859
866
  "div",
860
867
  {
861
868
  "data-grid-focus-sentinel": "tail",
862
869
  tabIndex: 0,
863
870
  "aria-hidden": "true",
864
871
  className: "sr-only",
865
- onFocus: () => Me("first")
872
+ onFocus: () => Fe("first")
866
873
  }
867
874
  )
868
875
  ]
@@ -870,5 +877,5 @@ const Mt = [
870
877
  );
871
878
  };
872
879
  export {
873
- en as AppDataGrid
880
+ or as AppDataGrid
874
881
  };