@universal-material/data-grid 0.1.0 → 0.3.0

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.
Files changed (55) hide show
  1. package/README.md +37 -20
  2. package/custom-elements.json +149 -22
  3. package/dist/data/data-source.d.ts +6 -2
  4. package/dist/data/data-source.js.map +1 -1
  5. package/dist/export/types.d.ts +1 -1
  6. package/dist/export/types.js.map +1 -1
  7. package/dist/export-xlsx/index.d.ts +2 -1
  8. package/dist/export-xlsx/index.js +4 -2
  9. package/dist/export-xlsx/index.js.map +1 -1
  10. package/dist/features/column-chooser.js +4 -3
  11. package/dist/features/column-chooser.js.map +1 -1
  12. package/dist/features/filter-row.d.ts +1 -0
  13. package/dist/features/filter-row.js +16 -10
  14. package/dist/features/filter-row.js.map +1 -1
  15. package/dist/features/header-filter.d.ts +9 -2
  16. package/dist/features/header-filter.js +22 -11
  17. package/dist/features/header-filter.js.map +1 -1
  18. package/dist/features/scroll-port.d.ts +51 -0
  19. package/dist/features/scroll-port.js +329 -0
  20. package/dist/features/scroll-port.js.map +1 -0
  21. package/dist/grid-column-def.d.ts +60 -14
  22. package/dist/grid-column-def.js +6 -2
  23. package/dist/grid-column-def.js.map +1 -1
  24. package/dist/grid-column.d.ts +31 -7
  25. package/dist/grid-column.js +40 -7
  26. package/dist/grid-column.js.map +1 -1
  27. package/dist/grid-i18n.js +14 -14
  28. package/dist/grid-i18n.js.map +1 -1
  29. package/dist/grid.d.ts +61 -14
  30. package/dist/grid.js +758 -165
  31. package/dist/grid.js.map +1 -1
  32. package/dist/grid.min.js +621 -474
  33. package/dist/grid.styles.js +153 -15
  34. package/dist/grid.styles.js.map +1 -1
  35. package/dist/render/cell.js +5 -2
  36. package/dist/render/cell.js.map +1 -1
  37. package/dist/render/group-row.js +2 -1
  38. package/dist/render/group-row.js.map +1 -1
  39. package/dist/render/header.d.ts +17 -1
  40. package/dist/render/header.js +23 -2
  41. package/dist/render/header.js.map +1 -1
  42. package/dist/render/virtualizer.d.ts +49 -1
  43. package/dist/render/virtualizer.js +229 -17
  44. package/dist/render/virtualizer.js.map +1 -1
  45. package/dist/row-model/columns.d.ts +40 -0
  46. package/dist/row-model/columns.js +25 -0
  47. package/dist/row-model/columns.js.map +1 -1
  48. package/dist/row-model/filter.d.ts +19 -4
  49. package/dist/row-model/filter.js +29 -9
  50. package/dist/row-model/filter.js.map +1 -1
  51. package/dist/row-model/format.js +1 -1
  52. package/dist/row-model/format.js.map +1 -1
  53. package/dist/state/grid-state.d.ts +2 -2
  54. package/dist/state/grid-state.js.map +1 -1
  55. package/package.json +7 -3
package/dist/grid.js CHANGED
@@ -31,6 +31,7 @@ import { HOST_LABEL_ATTRIBUTES, HostLabel } from './features/host-label.js';
31
31
  import { HEADER_ROW, navigationKeyOf, nextCell, nextHeaderCell, rangeBetween, } from './features/keyboard.js';
32
32
  import { isContextMenuKey, MenuController, renderMenu } from './features/menu.js';
33
33
  import { clampWidth, ColumnResizeController, DEFAULT_MIN_COLUMN_WIDTH, measureContentWidth, } from './features/resize.js';
34
+ import { ScrollPortController } from './features/scroll-port.js';
34
35
  import { Debouncer, renderHighlighted, renderSearchPanel, SearchController } from './features/search.js';
35
36
  import { countSelected, normalizeSelectionMode, SelectionModel, } from './features/selection.js';
36
37
  import { formatMessage, initialSorting, nextSorting, sameSorting, sortGestureOf, sortingAfterGesture, toggleOrder, } from './features/sorting.js';
@@ -46,12 +47,12 @@ import { rendererContent } from './render/content.js';
46
47
  import { renderBuiltInEditor } from './render/editors.js';
47
48
  import { renderIndentCells, renderSummaryCells, renderTotalFooter } from './render/footer.js';
48
49
  import { groupRowLabel, renderGroupRowCells } from './render/group-row.js';
49
- import { isActivationKey, renderBandHeaderCell, renderHeaderCell, renderSortIndicator } from './render/header.js';
50
+ import { isActivationKey, labelledByHeader, renderBandHeaderCell, renderHeaderCell, renderSortIndicator } from './render/header.js';
50
51
  import { keyedRows } from './render/keyed-rows.js';
51
52
  import { RowVirtualizer } from './render/virtualizer.js';
52
53
  import { RowsWithAdded } from './row-model/added-rows.js';
53
54
  import { cellRangeEdges, countCells, isSingleCell, parseTsv, pasteSize, rectOf, rowBands, sameCorners, unescapePasted, } from './row-model/cell-range.js';
54
- import { ancestorsOf, buildColumnTree, buildHeaderRows, headerCellAt, moveAmongSiblings, normalizeLeafOrder, orderedSiblings, rootOf, } from './row-model/columns.js';
55
+ import { ancestorsOf, buildColumnTree, booleanTexts, buildHeaderRows, columnText, headerText, headerCellAt, moveAmongSiblings, normalizeLeafOrder, orderedSiblings, rootOf, } from './row-model/columns.js';
55
56
  import { createComparer } from './row-model/compare.js';
56
57
  import { distinctValues } from './row-model/distinct.js';
57
58
  import { allValuesConvert, applyMask, combineFilters, compileFilter, filterItems, hasColumnCondition, replaceColumnCondition, searchExpression, } from './row-model/filter.js';
@@ -460,6 +461,8 @@ const detailOrMaster = (rows, key, keyOf) => {
460
461
  };
461
462
  /** Linha de detalhe (master-detail). */
462
463
  const isDetailRow = (row) => !!row && !!row.isDetail;
464
+ /** Linhas de esqueleto do `loading` antes de medir a altura (servidor e 1º render). */
465
+ const LOADING_PLACEHOLDER_ROWS = 10;
463
466
  /** `rowRenderer` que já lançou ou devolveu valor inválido (um `console.error` por função). */
464
467
  const reportedRowRenderers = new WeakSet();
465
468
  const isRenderResult = (value) => value === null || value === undefined || value === nothing || typeof value === 'string'
@@ -534,13 +537,14 @@ const isRenderResult = (value) => value === null || value === undefined || value
534
537
  * @cssprop --u-grid-toolbar-padding - Padding of the bar. Default `8px 16px`.
535
538
  * @cssprop --u-grid-toolbar-block-padding - Block padding of the bar. Default `8px`.
536
539
  * @cssprop --u-grid-toolbar-inline-padding - Inline padding of the bar. Default: the cell inline padding.
537
- * @cssprop --u-grid-header-cell-height - Height of the column header cells. Default `46px`.
540
+ * @cssprop --u-grid-toolbar-gap - Space between the bar items and between its lines (a `gap` value). Default `8px`. A change at runtime applies at the next toolbar layout (resize or item change).
541
+ * @cssprop --u-grid-header-cell-height - Minimum height of the column header cells (rows with `header-wrap` grow). Default `46px`.
538
542
  * @cssprop --u-grid-header-cell-padding - Header cell padding.
539
543
  * @cssprop --u-grid-header-cell-font-size - Header cell font size. Default `0.8125rem`.
540
544
  * @cssprop --u-grid-header-cell-font-weight - Header cell font weight.
541
- * @cssprop --u-grid-cell-padding - Data cell padding. Default `13px 16px`.
542
- * @cssprop --u-grid-cell-block-padding - Block padding of data and header cells. Default `13px`.
543
- * @cssprop --u-grid-cell-inline-padding - Inline padding of data and header cells. Default `16px`.
545
+ * @cssprop --u-grid-cell-padding - Data cell padding (shorthand; wins over the longhands). Default `13px 16px`.
546
+ * @cssprop --u-grid-cell-block-padding - Block padding of data and header cells; wins over the old `--u-table-cell-padding` and `--u-grid-data-cell-padding`. Default `13px`.
547
+ * @cssprop --u-grid-cell-inline-padding - Inline padding of data and header cells; wins over the old `--u-table-cell-padding` and `--u-grid-data-cell-padding`. Default `16px`.
544
548
  * @cssprop --u-grid-cell-font-size - Data cell font size. Default `0.875rem`.
545
549
  * @cssprop --u-grid-cell-font-weight - Data cell font weight.
546
550
  * @cssprop --u-grid-row-hover-opacity - Intensity of the row and header hover tint (`0%` disables it). Default: state-layer hover token or `8%`.
@@ -569,8 +573,8 @@ const isRenderResult = (value) => value === null || value === undefined || value
569
573
  * @cssprop --u-grid-sort-indicator-size - Size of the sort arrow. Default `1.125em`.
570
574
  * @cssprop --u-grid-drop-indicator-color - Drag-and-drop drop indicator color.
571
575
  * @cssprop --u-grid-drop-indicator-width - Drop indicator thickness. Default `3px`.
572
- * @cssprop --u-grid-resize-handle-width - Invisible resize hit area at the end of each header cell (over the end padding, capped to it; the cursor changes on hover). Default `8px`.
573
- * @cssprop --u-grid-column-header-menu-button-size - Size of the "⋮" column header menu button and of the header filter button. Default `24px` (WCAG 2.5.8).
576
+ * @cssprop --u-grid-resize-handle-width - Invisible resize area at the end of each header cell, over its end padding (the header buttons reach up to it). Default `8px`.
577
+ * @cssprop --u-grid-column-header-menu-button-size - Size of the header "⋮" and filter buttons, side by side. Default `24px` (WCAG 2.5.8; below it, add spacing).
574
578
  * @cssprop --u-grid-resize-handle-color - Color of the separator shown at the column edge while dragging to resize. Default: `--u-grid-drop-indicator-color`.
575
579
  * @cssprop --u-grid-fixed-shadow-color - Shadow at the edge of fixed columns while scrolling.
576
580
  * @cssprop --u-grid-column-chooser-background-color - Column chooser background.
@@ -586,7 +590,7 @@ const isRenderResult = (value) => value === null || value === undefined || value
586
590
  * @cssprop --u-grid-header-filter-background-color - Header filter popover background.
587
591
  * @cssprop --u-grid-header-filter-shape - Header filter popover corner radius. Default `12px`.
588
592
  * @cssprop --u-grid-load-panel-background-color - Background of the load panel.
589
- * @cssprop --u-grid-skeleton-row-color - Color of the placeholders in rows still loading.
593
+ * @cssprop --u-grid-skeleton-row-color - Color of the placeholders in rows still loading (remote rows, or `loading` with no rows).
590
594
  * @cssprop --u-grid-pager-height - Minimum height of the pager. Default `56px`.
591
595
  * @cssprop --u-grid-modified-cell-background-color - Background of edited, unsaved cells (`editMode="batch"`). Default: primary color at 10%.
592
596
  * @cssprop --u-grid-modified-cell-indicator-color - Corner mark of edited, unsaved cells (not shown by color alone). Default: primary color.
@@ -609,7 +613,7 @@ const isRenderResult = (value) => value === null || value === undefined || value
609
613
  * @csspart cell - Data cells (`<td>`).
610
614
  * @csspart selection-cell - Cells and header of the selection checkbox column.
611
615
  * @csspart selection-checkbox - The selection checkboxes (rows and "select all").
612
- * @csspart no-data - The cell rendered in the empty state.
616
+ * @csspart no-data - The cell rendered in the empty state, or the "Loading…" cell while `loading` has no rows.
613
617
  * @csspart header-cell - Column header cells (`<th>`), bands included.
614
618
  * @csspart band-header-cell - Band header cells (multi-level headers); they also match `header-cell`.
615
619
  * @csspart sort-indicator - The sort arrow (and priority number) in headers and group chips.
@@ -665,8 +669,8 @@ const isRenderResult = (value) => value === null || value === undefined || value
665
669
  * @csspart pager-button - Pager buttons (first, previous, page numbers, next, last).
666
670
  * @csspart page-size-select - The page size `<select>` of the pager.
667
671
  * @csspart page-info - The "Page x of y (n items)" text of the pager.
668
- * @csspart load-panel - The load panel shown while a data source loads.
669
- * @csspart skeleton-row - Rows of a remote source not loaded yet (with `row`).
672
+ * @csspart load-panel - The load panel shown while a data source loads or `loading` is set (with rows).
673
+ * @csspart skeleton-row - Rows of a remote source not loaded yet (with `row`), or placeholder rows while `loading` has no rows.
670
674
  * @csspart error-row - The bar shown when the data source failed.
671
675
  * @csspart retry-button - The "Retry" button of the error bar.
672
676
  * @csspart search-highlight - Search matches (`<mark>`) in native cells (not in `renderer` cells).
@@ -702,6 +706,26 @@ let DataGrid = class DataGrid extends LitElement {
702
706
  * the translated "No data" text.
703
707
  */
704
708
  this.noDataRenderer = null;
709
+ /**
710
+ * Shows the grid as loading, for `items` you are still fetching. With rows
711
+ * on screen, the load panel (`::part(load-panel)`) covers them; with no rows
712
+ * yet, a "Loading…" row and placeholder rows (`::part(skeleton-row)`) take
713
+ * the place of the empty state (`noDataRenderer` is not called). Placeholder
714
+ * rows are never data: not exported, selected, counted or focusable by API.
715
+ * Does not fire `u-grid-loading`/`u-grid-load`; with `dataSource`, it adds
716
+ * to the source's own loading state (the getter returns only what you set).
717
+ */
718
+ this.loading = false;
719
+ /**
720
+ * Wraps the column header labels in several lines instead of an ellipsis
721
+ * (the header row grows; `--u-grid-header-cell-height` is its minimum). A
722
+ * column's `headerWrap` wins. Auto-size measures the label in one line. If
723
+ * the toolbar and the headers take more than half of the visible height,
724
+ * the headers stop sticking (WCAG 2.4.11).
725
+ */
726
+ this.headerWrap = false;
727
+ /** Linhas de esqueleto do `loading` sem linhas: fixo no servidor e no 1º render (hidratação); depois, o que cabe. */
728
+ this.#placeholderRows = LOADING_PLACEHOLDER_ROWS;
705
729
  /**
706
730
  * Builds the detail of a row (master-detail; property only). With it, a
707
731
  * toggle column appears at the start and each expanded row is followed by
@@ -799,6 +823,8 @@ let DataGrid = class DataGrid extends LitElement {
799
823
  this.#refreshCount = 0;
800
824
  this.#remoteVersion = -1;
801
825
  this.#loadingAnnounced = false;
826
+ /** O "Carregando…" anunciado veio do \`loading\` (o fim é anunciado; a espera do estado não). */
827
+ this.#loadingByProperty = false;
802
828
  this.#warnedColumns = new Set();
803
829
  // ------------------------------------------------------- árvore (frente 25)
804
830
  /**
@@ -914,6 +940,32 @@ let DataGrid = class DataGrid extends LitElement {
914
940
  * the end is reached (remote paging only; with `paging` the pager wins).
915
941
  */
916
942
  this.scrollMode = 'virtual';
943
+ /**
944
+ * Scrolls the grid with an outer container instead of its own scrollbar:
945
+ * the id of an ANCESTOR of the grid (the first ancestor with this id,
946
+ * crossing shadow boundaries, unlike IDREF attributes), or `window` for
947
+ * the page (wins over an element with `id="window"`). The grid grows to
948
+ * its content (do not give it a height), the container scrolls in both
949
+ * directions, and rows and columns are still virtualized by the visible
950
+ * part of the container; toolbar, headers, totals, fixed rows and columns
951
+ * stick to it. The container's `scroll-padding-top`/`-bottom` offsets
952
+ * what the page sticks there (an app bar). `<html>` (or the
953
+ * `document.scrollingElement`) means the window; `<body>` only when it is
954
+ * the scrolling element. Not found, not an ancestor or empty: a console
955
+ * warning and the grid's own scrolling. An element between the grid and
956
+ * the container that clips or scrolls (`overflow` other than
957
+ * `visible`/`clip`) also warns: sticky headers would stick to it. Resolved when
958
+ * the grid connects and when this changes (changing the ancestor's id
959
+ * later does not re-resolve). The attribute alone renders the outer mode
960
+ * on the server.
961
+ */
962
+ this.scrollContainer = null;
963
+ /**
964
+ * The outer scroll container by reference (wins over `scrollContainer`):
965
+ * an ancestor element, or `window`. `document.documentElement` (or the
966
+ * `document.scrollingElement`) means the window. See `scrollContainer`.
967
+ */
968
+ this.scrollContainerElement = null;
917
969
  /** Linhas inteiras (sem a página); `#rows` é a página com `paging`. */
918
970
  this.#allRows = new RowList(rowKeyOf);
919
971
  /** Linhas de dados conhecidas (local: filtradas; remoto: total do servidor; `-1` desconhecido). */
@@ -1025,7 +1077,7 @@ let DataGrid = class DataGrid extends LitElement {
1025
1077
  this.#isGrouped = (column) => this._groupColumns.includes(column);
1026
1078
  // ------------------------------------------------------------ aparência
1027
1079
  // Booleanos: `"false"` desliga (padrão `true` precisa disso — spec 15).
1028
- /** Row height in px (rows with `wrap` columns can grow). */
1080
+ /** Row height in px, padding included (rows with `wrap` columns or taller content grow; the virtualizer measures them). */
1029
1081
  this.rowHeight = 48;
1030
1082
  /** Tints even rows. */
1031
1083
  this.striped = false;
@@ -1287,18 +1339,29 @@ let DataGrid = class DataGrid extends LitElement {
1287
1339
  this._scrollContainerRef = createRef();
1288
1340
  /** @internal */
1289
1341
  this._groupContainerRef = createRef();
1342
+ this.#layoutRef = createRef();
1343
+ /** Rolagem por contêiner externo (spec 27). */
1344
+ this.#scrollPort = new ScrollPortController(this, {
1345
+ scroll: () => this.#onExternalScroll(),
1346
+ moved: () => this.#onExternalMoved(),
1347
+ });
1290
1348
  this.#virtualizer = new RowVirtualizer(this, {
1291
- getScrollElement: () => this._scrollContainerRef.value ?? null,
1349
+ getScrollElement: () => this.#scrollPort.port?.source ?? this._scrollContainerRef.value ?? null,
1350
+ isExternal: () => this.#scrollPort.port !== null,
1292
1351
  rowHeight: () => this.rowHeight,
1293
1352
  overscan: 3,
1294
1353
  getScrollMargin: () => {
1295
1354
  const scroller = this._scrollContainerRef.value;
1296
1355
  const table = scroller?.querySelector('table.grid-table');
1356
+ const port = this.#scrollPort.port;
1357
+ if (!scroller || !table) {
1358
+ return 0;
1359
+ }
1360
+ // Onde a porta começa, em coordenadas da tela, e quanto ela já rolou.
1361
+ const origin = port ? port.rect().top - port.scrollTop : scroller.getBoundingClientRect().top - scroller.scrollTop;
1297
1362
  // O corpo começa depois do cabeçalho e das linhas fixas do topo (no fluxo, sticky ou não).
1298
- return scroller && table
1299
- ? table.getBoundingClientRect().top - scroller.getBoundingClientRect().top + scroller.scrollTop + (table.tHead?.offsetHeight ?? 0)
1300
- + (table.querySelector(':scope > tbody.fixed-top-rows')?.offsetHeight ?? 0)
1301
- : 0;
1363
+ return table.getBoundingClientRect().top - origin + (table.tHead?.offsetHeight ?? 0)
1364
+ + (table.querySelector(':scope > tbody.fixed-top-rows')?.offsetHeight ?? 0);
1302
1365
  },
1303
1366
  // Barra, cabeçalho e fixas do topo grudam: a área coberta vai até o fim do último.
1304
1367
  getStickyHeight: () => {
@@ -1508,6 +1571,8 @@ let DataGrid = class DataGrid extends LitElement {
1508
1571
  this.#declarativeColumns = columns;
1509
1572
  this.#syncColumns();
1510
1573
  };
1574
+ /** Colunas com `headerRenderer` sem `label` já avisadas, pelo nome em texto (o host pode recriar os objetos a cada render). */
1575
+ this.#warnedUnlabeled = new Set();
1511
1576
  this.#siblingCache = {
1512
1577
  regular: [],
1513
1578
  tree: buildColumnTree([]),
@@ -1516,17 +1581,26 @@ let DataGrid = class DataGrid extends LitElement {
1516
1581
  /** Rolagem horizontal: re-renderiza só quando a janela de colunas muda. */
1517
1582
  this.#onHorizontalScroll = () => {
1518
1583
  const scroller = this._scrollContainerRef.value;
1584
+ const external = this.#externalHorizontal();
1585
+ if (external) {
1586
+ this.#syncVisibleWidth(external.visible);
1587
+ }
1519
1588
  if (!scroller || !this.#freeOffsets) {
1520
1589
  return;
1521
1590
  }
1522
- // Em RTL o scrollLeft vai de 0 a negativo.
1523
- const start = Math.abs(scroller.scrollLeft);
1524
- const viewport = scroller.clientWidth;
1525
- if (start === this.#scrollStart && viewport === this.#viewportWidth) {
1591
+ // Em RTL o scrollLeft vai de 0 a negativo. Porta externa: a parte da tabela antes da borda visível.
1592
+ const start = external ? external.start : Math.abs(scroller.scrollLeft);
1593
+ const viewport = external ? external.visible : scroller.clientWidth;
1594
+ if (start === this.#scrollStart && viewport === this.#columnViewport()) {
1526
1595
  return;
1527
1596
  }
1528
1597
  this.#scrollStart = start;
1529
- this.#viewportWidth = viewport;
1598
+ if (external) {
1599
+ this.#visibleWidth = viewport;
1600
+ }
1601
+ else {
1602
+ this.#viewportWidth = viewport;
1603
+ }
1530
1604
  const next = this.#horizontalWindow();
1531
1605
  if (next.first !== this.#columnWindow.first || next.last !== this.#columnWindow.last) {
1532
1606
  // Cabeçalhos novos no DOM: o arrasto precisa deles.
@@ -1541,17 +1615,42 @@ let DataGrid = class DataGrid extends LitElement {
1541
1615
  if (!scroller || !container) {
1542
1616
  return;
1543
1617
  }
1618
+ const external = this.#externalHorizontal();
1544
1619
  // Em RTL o scrollLeft vai de 0 a negativo.
1545
- const offset = Math.abs(scroller.scrollLeft);
1546
- const overflow = scroller.scrollWidth - scroller.clientWidth;
1620
+ const offset = external ? external.start : Math.abs(scroller.scrollLeft);
1621
+ const after = external ? external.end : scroller.scrollWidth - scroller.clientWidth - offset;
1547
1622
  container.classList.toggle('scroll-start', offset > 0.5);
1548
- container.classList.toggle('scroll-end', overflow - offset > 0.5);
1623
+ container.classList.toggle('scroll-end', after > 0.5);
1549
1624
  };
1625
+ /** Largura visível da porta externa sobre a tabela (0 = rolagem interna). */
1626
+ this.#visibleWidth = 0;
1627
+ this.#syncedVisibleWidth = -1;
1550
1628
  this.#isExpanded = (key, level) => this.#expansion.get(key)?.expanded ?? this.#defaultExpanded(level);
1551
1629
  this.#typesVersion = -1;
1552
1630
  this.#warnedInfinitePaging = false;
1553
1631
  /** 1ª linha da última janela renderizada (o 1º pedido de uma consulta nova já traz o bloco dela). */
1554
1632
  this.#lastWindowFirst = 0;
1633
+ /** Coluna do campo de uma condição: `path`, depois `name` de coluna sem `path` (o mesmo do avaliador). */
1634
+ this.#resolveFilterField = field => {
1635
+ if (!this.#filterFields) {
1636
+ const index = new Map();
1637
+ const leaves = this.#columnTree.leaves;
1638
+ for (const column of leaves) {
1639
+ if (column.path && !index.has(column.path)) {
1640
+ index.set(column.path, column);
1641
+ }
1642
+ }
1643
+ for (const column of leaves) {
1644
+ if (!column.path && column.name && !index.has(column.name)) {
1645
+ index.set(column.name, column);
1646
+ }
1647
+ }
1648
+ this.#filterFields = index;
1649
+ }
1650
+ return this.#filterFields.get(field);
1651
+ };
1652
+ /** Colunas já avisadas por `filterable: true` sem efeito (uma vez por coluna). */
1653
+ this.#warnedFilterable = new WeakSet();
1555
1654
  this.#canSortByUser = (column) => this.#sortingMode !== 'none' && isColumnSortable(column);
1556
1655
  this.#onSortPointerDown = () => {
1557
1656
  this.#dragged = false;
@@ -1649,6 +1748,29 @@ let DataGrid = class DataGrid extends LitElement {
1649
1748
  }
1650
1749
  };
1651
1750
  this.#revealAttempts = 0;
1751
+ /** O usuário mexeu na rolagem durante a rolagem suave da API: ela não é refeita (nem o foco roubado). */
1752
+ this.#cancelReveal = (event) => {
1753
+ // Dentro do grid, a tecla/clique já é uma ação do usuário com revelação própria.
1754
+ if (event?.composedPath().includes(this)) {
1755
+ return;
1756
+ }
1757
+ this.#revealInterrupt?.abort();
1758
+ this.#revealInterrupt = undefined;
1759
+ this.#revealPending = false;
1760
+ this.#revealInFlight = false;
1761
+ this.#revealByApi = false;
1762
+ if (this.#deferredFocusFrom !== undefined) {
1763
+ this.#focusPending = false;
1764
+ this.#deferredFocusFrom = undefined;
1765
+ }
1766
+ };
1767
+ /** A última revelação veio de chamada de API (`focusCell`, `editCell`...). */
1768
+ this.#revealByApi = false;
1769
+ /** Rolagem suave da porta externa em curso: a revelação continua no `scrollend`. */
1770
+ this.#revealInFlight = false;
1771
+ /** Margens horizontais do que gruda (colunas fixas, recuos), medidas no render. */
1772
+ this.#revealInline = { start: 0, end: 0 };
1773
+ this.#revealMarginsKey = '';
1652
1774
  /** Foco que entra numa célula (clique, Tab, conteúdo da célula): ela vira a ativa. */
1653
1775
  this.#onGridFocusIn = (event) => {
1654
1776
  const path = event.composedPath();
@@ -1677,7 +1799,8 @@ let DataGrid = class DataGrid extends LitElement {
1677
1799
  this.#setActive(position, 'user');
1678
1800
  }
1679
1801
  else if (path[0] === cell && cell.closest('tr')?.classList.contains('pinned')) {
1680
- // Tab de volta para a célula ativa que está fora da tela: traz a linha.
1802
+ // Tab de volta para a célula ativa que está fora da tela: traz a linha (ação do usuário: na hora).
1803
+ this.#revealByApi = false;
1681
1804
  this.#revealPending = true;
1682
1805
  this.#revealAttempts = 0;
1683
1806
  this.requestUpdate();
@@ -2030,6 +2153,8 @@ let DataGrid = class DataGrid extends LitElement {
2030
2153
  this.#summaryDirty = true;
2031
2154
  }
2032
2155
  #summary;
2156
+ /** Linhas de esqueleto do `loading` sem linhas: fixo no servidor e no 1º render (hidratação); depois, o que cabe. */
2157
+ #placeholderRows;
2033
2158
  /**
2034
2159
  * Rows fixed ("pinned") right below the column headers (property only):
2035
2160
  * the host's own items, rendered with the grid columns (formatting, cell
@@ -2256,6 +2381,8 @@ let DataGrid = class DataGrid extends LitElement {
2256
2381
  #flushTimer;
2257
2382
  #loadingTimer;
2258
2383
  #loadingAnnounced;
2384
+ /** O "Carregando…" anunciado veio do \`loading\` (o fim é anunciado; a espera do estado não). */
2385
+ #loadingByProperty;
2259
2386
  #warnedColumns;
2260
2387
  /** Fonte remota com linhas sob demanda (paginação ou agrupamento no servidor). */
2261
2388
  get #lazy() {
@@ -2344,7 +2471,7 @@ let DataGrid = class DataGrid extends LitElement {
2344
2471
  const reference = this.treeColumn;
2345
2472
  const found = reference ? this.#resolveColumn(reference) : undefined;
2346
2473
  if (reference && !found) {
2347
- this.#warnTree('tree-column', `tree-column "${typeof reference === 'string' ? reference : reference.label ?? reference.path ?? ''}" matches no column; the first visible column is used.`);
2474
+ this.#warnTree('tree-column', `tree-column "${typeof reference === 'string' ? reference : columnText(reference)}" matches no column; the first visible column is used.`);
2348
2475
  }
2349
2476
  return found && visible.includes(found) ? found : visible[0];
2350
2477
  }
@@ -3290,8 +3417,9 @@ let DataGrid = class DataGrid extends LitElement {
3290
3417
  * Column filter (property only): a serializable expression such as
3291
3418
  * `[['age', '>', 30], 'and', ['name', 'contains', 'an']]`. The filter row
3292
3419
  * and the header filter read and write it, so it always holds the current
3293
- * filter. The grid keeps a frozen copy (never the host array). Setting it
3294
- * does not fire `u-grid-filter-change`.
3420
+ * filter. A condition refers to its column by `path` or, for a computed
3421
+ * column (`valueGetter` without `path`), by `name`. The grid keeps a frozen
3422
+ * copy (never the host array). Setting it does not fire `u-grid-filter-change`.
3295
3423
  */
3296
3424
  get filterValue() {
3297
3425
  return this.#filtering.filterValue;
@@ -3711,7 +3839,7 @@ let DataGrid = class DataGrid extends LitElement {
3711
3839
  const warn = (this.#stateInUse || !!this.#stateStorage) && !(quiet && !name);
3712
3840
  if (!name) {
3713
3841
  if (warn) {
3714
- this.#warnState(`a column without "name" or "path" (${JSON.stringify(column.label ?? '')}) is left out of the state.`);
3842
+ this.#warnState(`a column without "name" or "path" (${JSON.stringify(columnText(column))}) is left out of the state.`);
3715
3843
  }
3716
3844
  }
3717
3845
  else if (named.has(name)) {
@@ -4175,6 +4303,17 @@ let DataGrid = class DataGrid extends LitElement {
4175
4303
  }
4176
4304
  return super.dispatchEvent(event);
4177
4305
  }
4306
+ /**
4307
+ * @internal Contêiner externo que rola o grid (frente 27), quando é um
4308
+ * elemento; `undefined` na rolagem interna ou pela janela (harness de perf).
4309
+ */
4310
+ get _scrollElement() {
4311
+ const port = this.#scrollPort.port;
4312
+ return port && !port.isWindow ? port.element : undefined;
4313
+ }
4314
+ #layoutRef;
4315
+ /** Rolagem por contêiner externo (spec 27). */
4316
+ #scrollPort;
4178
4317
  #virtualizer;
4179
4318
  /** Linhas fixas grudadas (não no modo "rolam com o conteúdo" do zoom alto). */
4180
4319
  #stickyFixed;
@@ -4184,7 +4323,8 @@ let DataGrid = class DataGrid extends LitElement {
4184
4323
  const table = this.#tableRef.value;
4185
4324
  const observer = this.#resizeObserver;
4186
4325
  const wanted = new Set();
4187
- if (table && observer && (this.#fixedTopItems.length || this.#fixedBottomItems.length)) {
4326
+ if (table && observer && (this.#fixedTopItems.length || this.#fixedBottomItems.length || this.#anyHeaderWrap)) {
4327
+ // Rótulos que quebram linha: a altura do cabeçalho muda sem o host mudar (zoom de texto, largura).
4188
4328
  for (const element of [table.tHead, table.tFoot, ...table.querySelectorAll(':scope > tbody.fixed-rows')]) {
4189
4329
  if (element) {
4190
4330
  wanted.add(element);
@@ -4220,9 +4360,16 @@ let DataGrid = class DataGrid extends LitElement {
4220
4360
  const toolbar = this.#observedToolbar?.isConnected ? this.#observedToolbar.offsetHeight : 0;
4221
4361
  const head = table.tHead?.offsetHeight ?? 0;
4222
4362
  const foot = table.tFoot?.offsetHeight ?? 0;
4223
- const covered = toolbar + head + foot + (top?.offsetHeight ?? 0) + (bottom?.offsetHeight ?? 0);
4224
- const sticky = !(top || bottom) || covered <= scroller.clientHeight * 0.5 || !scroller.clientHeight;
4225
- container.style.setProperty('--_fixed-top-offset', `${toolbar + head}px`);
4363
+ const port = this.#scrollPort.port;
4364
+ // Porta externa (spec 27): a conta é contra a altura da porta, somando o que o hospedeiro gruda nela.
4365
+ const inset = port ? this.#scrollPort.padding() : { top: 0, bottom: 0 };
4366
+ const height = port ? port.clientHeight : scroller.clientHeight;
4367
+ const covered = toolbar + head + foot + (top?.offsetHeight ?? 0) + (bottom?.offsetHeight ?? 0) + inset.top + inset.bottom;
4368
+ const sticky = !(top || bottom) || covered <= height * 0.5 || !height;
4369
+ // Rótulos quebrados: barra + cabeçalho acima da metade da altura visível deixam de grudar (WCAG 2.4.11).
4370
+ const headerSticky = !this.#anyHeaderWrap || toolbar + head + inset.top <= height * 0.5 || !height;
4371
+ container.classList.toggle('header-rows-scroll', !headerSticky);
4372
+ container.style.setProperty('--_fixed-top-offset', `${headerSticky ? toolbar + head : toolbar}px`);
4226
4373
  container.style.setProperty('--_fixed-bottom-offset', `${foot}px`);
4227
4374
  if (sticky !== this.#stickyFixed) {
4228
4375
  this.#stickyFixed = sticky;
@@ -4291,6 +4438,10 @@ let DataGrid = class DataGrid extends LitElement {
4291
4438
  cachedBlocks: this.#loader.blocksCached,
4292
4439
  loadTimers: (this.#flushTimer === undefined ? 0 : 1) + (this.#loadingTimer === undefined ? 0 : 1),
4293
4440
  rowExpansion: this.#rowExpansion.size,
4441
+ // Rolagem por contêiner externo (frente 27): porta ligada, linhas observadas, esperas de `scrollend`.
4442
+ scrollPortAttached: this.#scrollPort.port ? 1 : 0,
4443
+ scrollPortObservedRows: this.#scrollPort.observedRows,
4444
+ scrollEndWaits: this.#scrollPort.scrollEndWaits,
4294
4445
  // Responsivo (frente 21): o anúncio das ocultas por espaço e o que é guardado por coluna.
4295
4446
  adaptiveTimers: this.#adaptiveTimer === undefined ? 0 : 1,
4296
4447
  adaptiveColumns: this.#adaptiveColumns.length + this.#reportedAdaptive.length,
@@ -4375,6 +4526,8 @@ let DataGrid = class DataGrid extends LitElement {
4375
4526
  this.#rangeSummaryAbort?.abort();
4376
4527
  this.#rangeSummaryAbort = undefined;
4377
4528
  this.#rangeAddMode = false;
4529
+ // Rolagem suave da API em curso (frente 27): sem listeners na porta.
4530
+ this.#cancelReveal();
4378
4531
  // A tabela não segura os rótulos da página enquanto o grid está fora dela (antes do super: precisa do ref).
4379
4532
  this.#hostLabel.disconnect();
4380
4533
  this.#syncTableLabel();
@@ -4420,6 +4573,9 @@ let DataGrid = class DataGrid extends LitElement {
4420
4573
  this.#announcedAdaptive = undefined;
4421
4574
  }
4422
4575
  willUpdate(changed) {
4576
+ if (changed.has('scrollContainer') || changed.has('scrollContainerElement')) {
4577
+ this.#scrollPort.resolve();
4578
+ }
4423
4579
  // No servidor o Lit não chama o `attributeChangedCallback` do elemento: lê o `aria-label` aqui.
4424
4580
  if (isServer) {
4425
4581
  this.#hostLabel.update();
@@ -4558,6 +4714,7 @@ let DataGrid = class DataGrid extends LitElement {
4558
4714
  updated(changed) {
4559
4715
  const virtualizer = this.#virtualizer;
4560
4716
  this.#pruneRowRenders();
4717
+ this.#afterExternalRender();
4561
4718
  this.#observeToolbar();
4562
4719
  this.#observeFixedSections();
4563
4720
  this.#syncTableLabel();
@@ -5005,7 +5162,7 @@ let DataGrid = class DataGrid extends LitElement {
5005
5162
  : [];
5006
5163
  }
5007
5164
  #summaryValue({ item, spec }, value) {
5008
- return { item, value: value ?? null, text: formatSummaryValue(value, spec, item.format, this.#summaryFormatContext) };
5165
+ return { item, value: value ?? null, text: formatSummaryValue(value, spec, item.format, this.#summaryFormatContext(spec.column)) };
5009
5166
  }
5010
5167
  #findGroup(groupPath) {
5011
5168
  if (!Array.isArray(groupPath)) {
@@ -5366,7 +5523,8 @@ let DataGrid = class DataGrid extends LitElement {
5366
5523
  }
5367
5524
  /**
5368
5525
  * The effective filter: `filterValue` `and` the search, as an expression
5369
- * (copy). The search becomes `[path, 'contains', text]` joined by `or`
5526
+ * (copy). The search becomes `[field, 'contains', text]` (`field`: the
5527
+ * `path`, or the `name` of a computed column) joined by `or`
5370
5528
  * over the visible filterable columns (number and date columns included:
5371
5529
  * `contains` matches their displayed text). `null` without filter.
5372
5530
  */
@@ -5839,7 +5997,7 @@ let DataGrid = class DataGrid extends LitElement {
5839
5997
  this.requestUpdate();
5840
5998
  // A resposta chegou com o foco em outra célula: anuncia com contexto.
5841
5999
  if (outcome && !this.#isActiveCell(pending.rowKey, column)) {
5842
- this.#announce(`${column.label ?? ''}: ${outcome.message}`);
6000
+ this.#announce(`${columnText(column)}: ${outcome.message}`);
5843
6001
  }
5844
6002
  return outcome;
5845
6003
  });
@@ -6124,7 +6282,11 @@ let DataGrid = class DataGrid extends LitElement {
6124
6282
  if (!scroller || !rows?.length) {
6125
6283
  return 0;
6126
6284
  }
6127
- const limit = scroller.getBoundingClientRect().top + this.#stickyTop();
6285
+ const port = this.#scrollPort.port;
6286
+ // Porta externa (spec 27): abaixo do que gruda no topo da porta (ou do início do corpo, se ele está mais abaixo).
6287
+ const limit = port
6288
+ ? Math.max(port.rect().top + this.#scrollPort.padding().top + this.#stickyTop(), rows[0].getBoundingClientRect().top)
6289
+ : scroller.getBoundingClientRect().top + this.#stickyTop();
6128
6290
  for (const tr of rows) {
6129
6291
  if (tr.getBoundingClientRect().bottom > limit + 1) {
6130
6292
  return Math.min(Number(tr.getAttribute('data-index')), this.#rows.length);
@@ -6417,11 +6579,11 @@ let DataGrid = class DataGrid extends LitElement {
6417
6579
  }
6418
6580
  const [entry] = pending.errors;
6419
6581
  if (entry) {
6420
- return `${entry[0].label ?? ''}: ${entry[1]}`;
6582
+ return `${columnText(entry[0])}: ${entry[1]}`;
6421
6583
  }
6422
6584
  const [unparsed] = pending.unparsed;
6423
6585
  if (unparsed) {
6424
- return unparsed[0].label ?? '';
6586
+ return columnText(unparsed[0]);
6425
6587
  }
6426
6588
  }
6427
6589
  return '';
@@ -6789,8 +6951,9 @@ let DataGrid = class DataGrid extends LitElement {
6789
6951
  const pending = this.#edits.get(editor.rowKey);
6790
6952
  const column = editor.column;
6791
6953
  const error = pending && column ? pending.errors.get(column) : undefined;
6792
- if (column?.label && !target.hasAttribute('aria-label') && !target.hasAttribute('aria-labelledby')) {
6793
- target.setAttribute('aria-label', column.label);
6954
+ const name = column ? columnText(column) : '';
6955
+ if (name && !target.hasAttribute('aria-label') && !target.hasAttribute('aria-labelledby')) {
6956
+ target.setAttribute('aria-label', name);
6794
6957
  }
6795
6958
  const ids = (target.getAttribute('aria-describedby') ?? '').split(/\s+/).filter(Boolean);
6796
6959
  const messageId = this.#lightMessage?.id;
@@ -6940,7 +7103,7 @@ let DataGrid = class DataGrid extends LitElement {
6940
7103
  groupLabel: (node, valueText, extra) => {
6941
7104
  const parts = this.showGroupCount ? [countFormat.format(node.items.length), ...extra] : [...extra];
6942
7105
  const info = parts.length ? ` ${formatMessage(translation.groupInfoText, { info: parts.join(listSeparator) })}` : '';
6943
- return `${node.column.label ?? ''}${translation.groupLabelSeparator}${valueText}${info}`;
7106
+ return `${columnText(node.column)}${translation.groupLabelSeparator}${valueText}${info}`;
6944
7107
  },
6945
7108
  };
6946
7109
  }
@@ -7000,7 +7163,7 @@ let DataGrid = class DataGrid extends LitElement {
7000
7163
  return {
7001
7164
  info: {
7002
7165
  column,
7003
- label: column.label ?? '',
7166
+ label: columnText(column),
7004
7167
  dataType,
7005
7168
  alignment: resolveAlignment(column, dataType),
7006
7169
  width: this.#widthOf(column) ?? this.#renderedWidths.get(column),
@@ -7552,7 +7715,7 @@ let DataGrid = class DataGrid extends LitElement {
7552
7715
  if (!scroller || !table || !root) {
7553
7716
  return undefined;
7554
7717
  }
7555
- const box = scroller.getBoundingClientRect();
7718
+ const box = this.#visibleScrollBox(scroller);
7556
7719
  const head = table.tHead?.getBoundingClientRect().bottom ?? box.top;
7557
7720
  const px = Math.min(Math.max(x, box.left + 1), box.right - 2);
7558
7721
  const py = Math.min(Math.max(y, Math.max(head, box.top) + 1), box.bottom - 2);
@@ -7570,6 +7733,25 @@ let DataGrid = class DataGrid extends LitElement {
7570
7733
  }
7571
7734
  return undefined;
7572
7735
  }
7736
+ /**
7737
+ * Área visível da rolagem em coordenadas da tela: o contêiner interno, ou
7738
+ * a parte do grid dentro da porta externa (spec 27).
7739
+ */
7740
+ #visibleScrollBox(scroller) {
7741
+ const box = scroller.getBoundingClientRect();
7742
+ const port = this.#scrollPort.port;
7743
+ if (!port) {
7744
+ return box;
7745
+ }
7746
+ const view = port.rect();
7747
+ const inset = this.#scrollPort.padding();
7748
+ return {
7749
+ top: Math.max(box.top, view.top + inset.top),
7750
+ left: Math.max(box.left, view.left),
7751
+ right: Math.min(box.right, view.right),
7752
+ bottom: Math.min(box.bottom, view.bottom - inset.bottom),
7753
+ };
7754
+ }
7573
7755
  #dragRangeTo() {
7574
7756
  const drag = this.#rangeDrag;
7575
7757
  if (!drag) {
@@ -7610,7 +7792,7 @@ let DataGrid = class DataGrid extends LitElement {
7610
7792
  if (this.#rangeDrag !== drag || !scroller) {
7611
7793
  return;
7612
7794
  }
7613
- const box = scroller.getBoundingClientRect();
7795
+ const box = this.#visibleScrollBox(scroller);
7614
7796
  const head = Math.max(drag.table.tHead?.getBoundingClientRect().bottom ?? box.top, box.top);
7615
7797
  const speed = (distance) => Math.min(Math.ceil(distance / 2) + 2, 48);
7616
7798
  const dy = drag.y < head + AUTO_SCROLL_EDGE
@@ -7622,7 +7804,7 @@ let DataGrid = class DataGrid extends LitElement {
7622
7804
  if (!dx && !dy) {
7623
7805
  return;
7624
7806
  }
7625
- scroller.scrollBy(dx, dy);
7807
+ (this.#scrollPort.port?.source ?? scroller).scrollBy(dx, dy);
7626
7808
  this.#dragRangeTo();
7627
7809
  this.#scheduleRangeAutoScroll();
7628
7810
  });
@@ -7849,7 +8031,7 @@ let DataGrid = class DataGrid extends LitElement {
7849
8031
  /** Coluna sem valor exportável (só `renderer`): célula vazia na cópia. */
7850
8032
  #emptyExportColumn(column) {
7851
8033
  return {
7852
- info: { column, label: column.label ?? '', dataType: this.#dataTypeOf(column), alignment: 'start' },
8034
+ info: { column, label: columnText(column), dataType: this.#dataTypeOf(column), alignment: 'start' },
7853
8035
  read: () => '',
7854
8036
  text: () => '',
7855
8037
  builtIn: true,
@@ -7988,9 +8170,18 @@ let DataGrid = class DataGrid extends LitElement {
7988
8170
  if (kind === 'boolean') {
7989
8171
  const value = text.trim().toLowerCase();
7990
8172
  const translation = this.#translation;
8173
+ const own = booleanTexts(column, translation);
7991
8174
  if (!value) {
7992
8175
  return null;
7993
8176
  }
8177
+ // Aceita o texto da coluna e o do idioma (a cópia gera o da coluna); os da coluna primeiro:
8178
+ // um `falseText: 'Sim'` não pode virar `true` pelo `trueText` do idioma.
8179
+ if (value === own.trueText.toLowerCase()) {
8180
+ return true;
8181
+ }
8182
+ if (value === own.falseText.toLowerCase()) {
8183
+ return false;
8184
+ }
7994
8185
  if (['true', '1', 'yes', '✓', translation.trueText.toLowerCase()].includes(value)) {
7995
8186
  return true;
7996
8187
  }
@@ -8114,6 +8305,12 @@ let DataGrid = class DataGrid extends LitElement {
8114
8305
  * @internal
8115
8306
  */
8116
8307
  _columnChanged(column, change) {
8308
+ // `path`/`name` podem ter mudado no mesmo objeto (spec 28). Renomear
8309
+ // uma calculada chega como `display`: o campo das condições mudou.
8310
+ this.#filterFields = undefined;
8311
+ if (change === 'display' && !column.path && column.valueGetter) {
8312
+ this.#filtering.invalidate();
8313
+ }
8117
8314
  if (change === 'columns') {
8118
8315
  // Colunas aninhadas entraram/saíram de uma banda declarativa.
8119
8316
  if (!this.#columnsProperty) {
@@ -8164,6 +8361,44 @@ let DataGrid = class DataGrid extends LitElement {
8164
8361
  }
8165
8362
  // ------------------------------------------------------------- colunas
8166
8363
  #readDeclarativeColumns;
8364
+ /** Colunas com `headerRenderer` sem `label` já avisadas, pelo nome em texto (o host pode recriar os objetos a cada render). */
8365
+ #warnedUnlabeled;
8366
+ /**
8367
+ * `headerRenderer` sem `label`: o renderer só vale para o cabeçalho; menus,
8368
+ * chip, seletor, anúncios e exportação usam o `path`/`name` cru, e um
8369
+ * renderer só de ícone deixa o cabeçalho sem nome. Avisa uma vez por
8370
+ * coluna e instância (spec 00).
8371
+ */
8372
+ #warnUnlabeledColumns(tree) {
8373
+ for (const column of tree.leaves) {
8374
+ // Calculada sem `label` (spec 28): o cabeçalho mostra o `name`, que costuma ser id.
8375
+ if (!column.label && !column.headerRenderer && !column.path && column.valueGetter && column.name
8376
+ && (this.#isFilterable(column) || isColumnSortable(column))) {
8377
+ const key = `computed:${column.name}`;
8378
+ if (!this.#warnedUnlabeled.has(key)) {
8379
+ this.#warnedUnlabeled.add(key);
8380
+ console.warn(`<u-grid>: column "${column.name}" has a "valueGetter" but no "label"; its header, menus and `
8381
+ + `announcements show the name "${column.name}".`);
8382
+ }
8383
+ }
8384
+ }
8385
+ for (const column of [...tree.leaves, ...tree.bands]) {
8386
+ if (!column.headerRenderer || column.label) {
8387
+ continue;
8388
+ }
8389
+ const name = columnText(column);
8390
+ const band = tree.childrenOf.has(column);
8391
+ const key = `${band ? 'band' : 'column'}:${name}`;
8392
+ if (this.#warnedUnlabeled.has(key)) {
8393
+ continue;
8394
+ }
8395
+ this.#warnedUnlabeled.add(key);
8396
+ const which = name ? `${band ? 'band' : 'column'} "${name}"` : band ? 'a band' : 'a column';
8397
+ const used = name ? `"${name}" names it` : 'it has no name';
8398
+ console.warn(`<u-grid>: ${which} has a "headerRenderer" but no "label" (with <u-grid-column>, its text content); `
8399
+ + `${used} in menus, the column chooser, announcements and export.`);
8400
+ }
8401
+ }
8167
8402
  /**
8168
8403
  * Concilia as definições com a ordem atual: colunas já conhecidas mantêm a
8169
8404
  * posição e o agrupamento escolhidos pelo usuário; novas entram pelo
@@ -8172,6 +8407,8 @@ let DataGrid = class DataGrid extends LitElement {
8172
8407
  #syncColumns() {
8173
8408
  const tree = buildColumnTree(this.columns);
8174
8409
  this.#columnTree = tree;
8410
+ this.#filterFields = undefined;
8411
+ this.#warnUnlabeledColumns(tree);
8175
8412
  this.#visibleBands = undefined;
8176
8413
  // Só as folhas têm células; as bandas são só cabeçalho.
8177
8414
  const definitions = tree.leaves;
@@ -8486,7 +8723,7 @@ let DataGrid = class DataGrid extends LitElement {
8486
8723
  if (!columns.length) {
8487
8724
  return translation.noAdaptiveColumnsAnnouncement;
8488
8725
  }
8489
- const names = columns.length <= ADAPTIVE_ANNOUNCE_NAMES ? this.#formatList(columns.map(column => column.label ?? '')) : String(columns.length);
8726
+ const names = columns.length <= ADAPTIVE_ANNOUNCE_NAMES ? this.#formatList(columns.map(column => columnText(column))) : String(columns.length);
8490
8727
  return formatMessage(translation.adaptiveColumnsAnnouncement, { columns: names });
8491
8728
  }
8492
8729
  /**
@@ -8502,9 +8739,9 @@ let DataGrid = class DataGrid extends LitElement {
8502
8739
  const order = sorting.find(spec => spec.column === column)?.order;
8503
8740
  const parts = [
8504
8741
  ...order ? [order === 'asc' ? translation.sortAscending : translation.sortDescending] : [],
8505
- ...hasColumnCondition(filterValue, column) ? [translation.columnFiltered] : [],
8742
+ ...hasColumnCondition(filterValue, column, this.#resolveFilterField) ? [translation.columnFiltered] : [],
8506
8743
  ];
8507
- return parts.length ? [`${column.label ?? ''}${translation.adaptiveLabelSeparator}${parts.join(', ')}`] : [];
8744
+ return parts.length ? [`${columnText(column)}${translation.adaptiveLabelSeparator}${parts.join(', ')}`] : [];
8508
8745
  });
8509
8746
  return [this.#adaptiveAnnouncementText(), ...states].join('. ');
8510
8747
  }
@@ -9027,7 +9264,7 @@ let DataGrid = class DataGrid extends LitElement {
9027
9264
  if (!offsets) {
9028
9265
  return { first: 0, last: -1 };
9029
9266
  }
9030
- const viewport = this.#viewportWidth || DEFAULT_VIEWPORT_WIDTH;
9267
+ const viewport = this.#columnViewport() || DEFAULT_VIEWPORT_WIDTH;
9031
9268
  return columnWindow(offsets, this.#scrollStart, Math.max(viewport - this.#fixedArea, 0), COLUMN_OVERSCAN);
9032
9269
  }
9033
9270
  /** Rolagem horizontal: re-renderiza só quando a janela de colunas muda. */
@@ -9170,30 +9407,55 @@ let DataGrid = class DataGrid extends LitElement {
9170
9407
  });
9171
9408
  return changed;
9172
9409
  }
9410
+ /** Linhas de esqueleto que cabem abaixo do cabeçalho (uma a menos: a linha "Carregando…"). */
9411
+ #measurePlaceholderRows(scroller) {
9412
+ const body = scroller.querySelector('tbody.body-rows');
9413
+ if (!body || this.#scrollPort.port) {
9414
+ return;
9415
+ }
9416
+ const top = body.getBoundingClientRect().top - scroller.getBoundingClientRect().top;
9417
+ const footer = scroller.querySelector('tfoot')?.offsetHeight ?? 0;
9418
+ const fits = Math.floor((scroller.clientHeight - top - footer) / this.rowHeight) - 1;
9419
+ this.#placeholderRows = Math.min(20, Math.max(1, fits));
9420
+ }
9173
9421
  #observeScrollContainer() {
9174
9422
  const scroller = this._scrollContainerRef.value;
9175
9423
  if (!scroller || this.#resizeObserver || typeof ResizeObserver === 'undefined') {
9176
9424
  return;
9177
9425
  }
9178
9426
  this.#resizeObserver = new ResizeObserver(entries => {
9179
- if (entries.some(entry => entry.target === scroller)) {
9427
+ if (entries.some(entry => entry.target === scroller || entry.target === this)) {
9428
+ // Porta externa (spec 27): o `.scroll-container` tem a largura da tabela; a do grid é a do host.
9429
+ const width = this.#scrollPort.port ? this.clientWidth : scroller.clientWidth;
9180
9430
  this.#layoutDirty = true;
9181
9431
  this.#adaptiveDirty = true;
9182
- this.#viewportWidth = scroller.clientWidth;
9432
+ this.#viewportWidth = width;
9183
9433
  // Zoom só de texto muda o `font-size`: a largura padrão da conta do responsivo acompanha (1.4.4).
9184
9434
  this.#fontScale = this.autoHideColumns ? (parseFloat(getComputedStyle(this).fontSize) || 16) / 16 : 1;
9185
9435
  // Largura visível: o conteúdo do detalhe e da linha inteira não passa dela (WCAG 1.4.10).
9186
9436
  // No contêiner: o \`style\` do \`.scroll-container\` é do template (o render o sobrescreve).
9187
- this._containerRef.value?.style.setProperty('--_viewport-inline-size', `${scroller.clientWidth}px`);
9437
+ this.#layoutRef.value?.style.setProperty('--_fill-inline-size', `${width}px`);
9438
+ this.#measurePlaceholderRows(scroller);
9439
+ // Porta externa (spec 27): a parte visível, medida na rolagem.
9440
+ if (this.#scrollPort.port) {
9441
+ this.#onExternalMoved();
9442
+ }
9443
+ else {
9444
+ this.#layoutRef.value?.style.setProperty('--_viewport-inline-size', `${width}px`);
9445
+ }
9188
9446
  this.requestUpdate();
9189
9447
  }
9190
9448
  this.#syncToolbarOffset();
9191
9449
  this.#measureToolbar();
9192
9450
  if (this.#observedFixedSections.size) {
9193
9451
  this.#syncFixedRows();
9452
+ // Cabeçalho mais alto (rótulos quebrados): a margem de revelar o foco acompanha (WCAG 2.4.11).
9453
+ this.#syncRevealMargins();
9194
9454
  }
9195
9455
  });
9196
9456
  this.#resizeObserver.observe(scroller);
9457
+ // Porta externa: a largura do grid é a do host (o `.scroll-container` cresce com a tabela).
9458
+ this.#resizeObserver.observe(this);
9197
9459
  this.#observeToolbar();
9198
9460
  }
9199
9461
  /**
@@ -9224,6 +9486,81 @@ let DataGrid = class DataGrid extends LitElement {
9224
9486
  }
9225
9487
  /** Sombra das fixas: só aparece quando há conteúdo rolado por baixo delas. */
9226
9488
  #updateScrollShadows;
9489
+ /**
9490
+ * Porta externa (spec 27): quanto da tabela fica antes da borda inicial
9491
+ * visível (`start`), depois da final (`end`) e a largura visível — pelos
9492
+ * retângulos, então vale em LTR/RTL e com qualquer `dir` no contêiner.
9493
+ */
9494
+ #externalHorizontal() {
9495
+ const port = this.#scrollPort.port;
9496
+ const table = this.#tableRef.value;
9497
+ if (!port || !table) {
9498
+ return undefined;
9499
+ }
9500
+ const box = table.getBoundingClientRect();
9501
+ const view = port.rect();
9502
+ const left = Math.max(0, view.left - box.left);
9503
+ const right = Math.max(0, box.right - view.right);
9504
+ const visible = Math.max(0, Math.min(view.right, box.right) - Math.max(view.left, box.left));
9505
+ const rtl = this.matches(':dir(rtl)');
9506
+ return { start: rtl ? right : left, end: rtl ? left : right, visible: Math.round(visible) };
9507
+ }
9508
+ /** Largura visível da porta externa sobre a tabela (0 = rolagem interna). */
9509
+ #visibleWidth;
9510
+ #syncedVisibleWidth;
9511
+ /** Largura da área das colunas: a do grid, ou a parte visível na porta externa. */
9512
+ #columnViewport() {
9513
+ return this.#scrollPort.port ? this.#visibleWidth : this.#viewportWidth;
9514
+ }
9515
+ /** `--_viewport-inline-size` = parte visível (barra, detalhe, linha inteira, paginação). */
9516
+ #syncVisibleWidth(width) {
9517
+ if (width !== this.#syncedVisibleWidth && width > 0) {
9518
+ this.#syncedVisibleWidth = width;
9519
+ this.#layoutRef.value?.style.setProperty('--_viewport-inline-size', `${width}px`);
9520
+ }
9521
+ }
9522
+ /** Rolagem da porta externa (spec 27). */
9523
+ #onExternalScroll() {
9524
+ this.#onHorizontalScroll();
9525
+ this.#updateScrollShadows();
9526
+ this.#syncLoadPanel();
9527
+ }
9528
+ /** Depois de cada render com a porta externa: margens, linhas observadas, painel de carga. */
9529
+ #afterExternalRender() {
9530
+ if (!this.#scrollPort.port) {
9531
+ return;
9532
+ }
9533
+ this.#syncRevealMargins();
9534
+ this.#scrollPort.observeRows(this.#tableRef.value?.querySelectorAll(':scope > tbody.body-rows > tr[data-index]:not(.pinned)') ?? []);
9535
+ this.#syncLoadPanel();
9536
+ }
9537
+ /** Painel de carga no centro da parte visível do grid na porta externa. */
9538
+ #syncLoadPanel() {
9539
+ const container = this._containerRef.value;
9540
+ const port = this.#scrollPort.port;
9541
+ if (!port || !container?.querySelector('.lang-scope > .load-panel')) {
9542
+ return;
9543
+ }
9544
+ const box = container.getBoundingClientRect();
9545
+ const view = port.rect();
9546
+ const top = Math.max(box.top, view.top);
9547
+ const bottom = Math.min(box.bottom, view.bottom);
9548
+ const left = Math.max(box.left, view.left);
9549
+ const right = Math.min(box.right, view.right);
9550
+ const block = (top + bottom) / 2 - box.top;
9551
+ const inline = this.matches(':dir(rtl)') ? box.right - (left + right) / 2 : (left + right) / 2 - box.left;
9552
+ container.style.setProperty('--_visible-block-center', `${Math.max(0, block)}px`);
9553
+ container.style.setProperty('--_visible-inline-center', `${Math.max(0, inline)}px`);
9554
+ }
9555
+ /** A porta externa mudou de tamanho, ou o grid se moveu nela sem rolagem (spec 27). */
9556
+ #onExternalMoved() {
9557
+ this.#virtualizer.sync();
9558
+ this.#onHorizontalScroll();
9559
+ this.#updateScrollShadows();
9560
+ this.#syncFixedRows();
9561
+ this.#syncRevealMargins();
9562
+ this.#scrollPort.checkHeight();
9563
+ }
9227
9564
  /**
9228
9565
  * Classe, deslocamento `sticky` e limites de cada coluna visível. Os
9229
9566
  * deslocamentos usam a largura medida (a tabela pode esticar as colunas).
@@ -9287,7 +9624,7 @@ let DataGrid = class DataGrid extends LitElement {
9287
9624
  insetInlineStart: side === 'start' ? `${offsets[index]}px` : undefined,
9288
9625
  insetInlineEnd: side === 'end' ? `${offsets[index]}px` : undefined,
9289
9626
  };
9290
- const truncate = !column.wrap && !column.renderer && column.booleanDisplay !== 'icon';
9627
+ const truncate = !column.wrap && !column.renderer && column.booleanDisplay !== 'icon' && column.booleanDisplay !== 'check';
9291
9628
  const bounds = this._boundsOf(column);
9292
9629
  const resizable = this.#isResizable(column) && (!nextColumnMode || !!this._resizeNeighbor(column));
9293
9630
  return [
@@ -9328,7 +9665,8 @@ let DataGrid = class DataGrid extends LitElement {
9328
9665
  }
9329
9666
  /** Resolve a coluna de um resumo: `path` (1ª coluna com ele) ou a própria coluna, se definida. */
9330
9667
  #resolveColumn(columnRef) {
9331
- const columns = this.columns;
9668
+ // Folhas, não só o nível de cima: coluna dentro de banda também é referência válida.
9669
+ const columns = this.#columnTree.leaves;
9332
9670
  if (typeof columnRef === 'string') {
9333
9671
  return columns.find(column => column.name === columnRef) ?? columns.find(column => column.path === columnRef);
9334
9672
  }
@@ -9584,7 +9922,7 @@ let DataGrid = class DataGrid extends LitElement {
9584
9922
  const id = `${operation}:${columnIdOf(column)}`;
9585
9923
  if (!this.#warnedColumns.has(id)) {
9586
9924
  this.#warnedColumns.add(id);
9587
- console.warn(`<u-grid>: column "${column.label ?? column.path ?? ''}" needs a plain "path" for remote ${operation}; ignored on the server.`);
9925
+ console.warn(`<u-grid>: column "${columnText(column)}" needs a plain "path" for remote ${operation}; ignored on the server.`);
9588
9926
  }
9589
9927
  return undefined;
9590
9928
  }
@@ -9776,20 +10114,35 @@ let DataGrid = class DataGrid extends LitElement {
9776
10114
  }
9777
10115
  this.#loadingAnnounced = false;
9778
10116
  }
9779
- /** Esperando o estado sem fonte de dados: "Carregando…" aos 300 ms, uma vez (com fonte, `#afterRenderLoad` cuida). */
10117
+ /**
10118
+ * Esperando o estado ou com `loading`, sem fonte de dados: "Carregando…"
10119
+ * aos 300 ms, uma vez (com fonte, `#afterRenderLoad` cuida). Ao terminar
10120
+ * uma carga anunciada, diz quantas linhas vieram (ou "sem dados"): quem
10121
+ * ouviu o começo fica sabendo do fim (WCAG 4.1.3).
10122
+ */
9780
10123
  #announceStateLoading() {
9781
10124
  if (this.#dataSource) {
9782
10125
  return;
9783
10126
  }
9784
- if (!this.#stateWaiting) {
10127
+ const waiting = this.#stateWaiting || this.loading;
10128
+ if (!waiting) {
9785
10129
  clearTimeout(this.#loadingTimer);
9786
10130
  this.#loadingTimer = undefined;
10131
+ // Só o \`loading\` anuncia o fim (a espera do estado salvo segue como antes: limpa e pronto).
10132
+ const announced = this.#loadingAnnounced && this.#loadingByProperty;
10133
+ this.#loadingByProperty = false;
9787
10134
  this.#clearLoadingAnnouncement();
10135
+ if (announced) {
10136
+ this.#announce(this.#rows.length
10137
+ ? formatMessage(this.#translation.filteredAnnouncement, { count: String(this.#totalCount) })
10138
+ : this.#translation.noData);
10139
+ }
9788
10140
  }
9789
10141
  else if (!this.#loadingTimer && !this.#loadingAnnounced && this.isConnected) {
9790
10142
  this.#loadingTimer = setTimeout(() => {
9791
10143
  this.#loadingTimer = undefined;
9792
- if (this.#stateWaiting) {
10144
+ if (this.#stateWaiting || this.loading) {
10145
+ this.#loadingByProperty = this.loading;
9793
10146
  this.#loadingAnnounced = true;
9794
10147
  this.#announce(this.#translation.loading);
9795
10148
  }
@@ -10003,7 +10356,7 @@ let DataGrid = class DataGrid extends LitElement {
10003
10356
  const columns = [...this._regularColumns, ...this._groupColumns];
10004
10357
  const known = new Set(columns);
10005
10358
  const contexts = new Map();
10006
- const { trueText, falseText } = this.#translation;
10359
+ const translation = this.#translation;
10007
10360
  const language = this.language;
10008
10361
  const dataTypeOf = (column) => known.has(column)
10009
10362
  ? this.#dataTypeOf(column)
@@ -10011,7 +10364,7 @@ let DataGrid = class DataGrid extends LitElement {
10011
10364
  const contextOf = (column) => {
10012
10365
  let context = contexts.get(column);
10013
10366
  if (!context) {
10014
- context = { language, dataType: dataTypeOf(column), trueText, falseText };
10367
+ context = { language, dataType: dataTypeOf(column), ...booleanTexts(column, translation) };
10015
10368
  contexts.set(column, context);
10016
10369
  }
10017
10370
  return context;
@@ -10019,6 +10372,7 @@ let DataGrid = class DataGrid extends LitElement {
10019
10372
  return {
10020
10373
  language,
10021
10374
  columns,
10375
+ resolve: this.#resolveFilterField,
10022
10376
  dataTypeOf,
10023
10377
  textOf: (item, column) => formatCell(item, column, contextOf(column)),
10024
10378
  alphabetOf: column => displayAlphabet(column, contextOf(column), foldText),
@@ -10039,7 +10393,7 @@ let DataGrid = class DataGrid extends LitElement {
10039
10393
  * @internal
10040
10394
  */
10041
10395
  _searchColumns() {
10042
- return [...this._groupColumns, ...this._shownColumns].filter(isColumnFilterable);
10396
+ return [...this._groupColumns, ...this._shownColumns].filter(column => this.#isFilterable(column));
10043
10397
  }
10044
10398
  /** @internal */
10045
10399
  _columnDataType(column) {
@@ -10047,7 +10401,51 @@ let DataGrid = class DataGrid extends LitElement {
10047
10401
  }
10048
10402
  /** @internal */
10049
10403
  _isFilterable(column) {
10050
- return isColumnFilterable(column);
10404
+ return this.#isFilterable(column);
10405
+ }
10406
+ /** @internal */
10407
+ _resolveFilterField(field) {
10408
+ return this.#resolveFilterField(field);
10409
+ }
10410
+ /** Campo de condição → coluna (spec 28); índice refeito quando as colunas mudam. */
10411
+ #filterFields;
10412
+ /** Coluna do campo de uma condição: `path`, depois `name` de coluna sem `path` (o mesmo do avaliador). */
10413
+ #resolveFilterField;
10414
+ /** Colunas já avisadas por `filterable: true` sem efeito (uma vez por coluna). */
10415
+ #warnedFilterable;
10416
+ /**
10417
+ * O usuário pode filtrar pela coluna (linha de filtro, funil, busca)? Além
10418
+ * de {@link isColumnFilterable}: a coluna sem `path` precisa ser a dona do
10419
+ * próprio `name` (sem colisão com um `path` ou com outra calculada) e, com
10420
+ * filtro remoto, só com `filterable: true` (o servidor não conhece o getter).
10421
+ */
10422
+ #isFilterable(column) {
10423
+ if (!isColumnFilterable(column)) {
10424
+ if (column.filterable === true) {
10425
+ this.#warnFilterable(column, 'needs a "path", or a "valueGetter" and a "name", to be filterable; ignored.');
10426
+ }
10427
+ return false;
10428
+ }
10429
+ if (column.path) {
10430
+ return true;
10431
+ }
10432
+ if (this.#resolveFilterField(column.name) !== column) {
10433
+ if (column.filterable === true) {
10434
+ this.#warnFilterable(column, `has the name "${column.name}" of another column's path or name; not filterable.`);
10435
+ }
10436
+ return false;
10437
+ }
10438
+ return !this.#remote.filtering || column.filterable === true;
10439
+ }
10440
+ /** Funil do filtro do cabeçalho: sem ele na coluna calculada remota (a lista viria só das linhas carregadas). */
10441
+ #hasFunnel(column) {
10442
+ return this.headerFilter && this.#isFilterable(column) && (!!column.path || !this.#remote.filtering);
10443
+ }
10444
+ #warnFilterable(column, problem) {
10445
+ if (!this.#warnedFilterable.has(column)) {
10446
+ this.#warnedFilterable.add(column);
10447
+ console.warn(`<u-grid>: column "${columnText(column)}" ${problem}`);
10448
+ }
10051
10449
  }
10052
10450
  /**
10053
10451
  * Gesto na linha de filtro ou no filtro do cabeçalho: troca (ou tira, com
@@ -10055,7 +10453,7 @@ let DataGrid = class DataGrid extends LitElement {
10055
10453
  * @internal
10056
10454
  */
10057
10455
  _userFilterColumn(column, kind, condition) {
10058
- this.#changeFilter(replaceColumnCondition(this.#filtering.filterValue, column, kind, condition), this.#filtering.searchText, 'user');
10456
+ this.#changeFilter(replaceColumnCondition(this.#filtering.filterValue, column, kind, condition, this.#resolveFilterField), this.#filtering.searchText, 'user');
10059
10457
  }
10060
10458
  /** @internal */
10061
10459
  _userSearch(text) {
@@ -10068,7 +10466,7 @@ let DataGrid = class DataGrid extends LitElement {
10068
10466
  * @internal
10069
10467
  */
10070
10468
  _distinctValues(column) {
10071
- const others = combineFilters(replaceColumnCondition(this.#filtering.filterValue, column, 'header', null), searchExpression(this.#filtering.searchText, this._searchColumns()));
10469
+ const others = combineFilters(replaceColumnCondition(this.#filtering.filterValue, column, 'header', null, this.#resolveFilterField), searchExpression(this.#filtering.searchText, this._searchColumns()));
10072
10470
  let items = this.#items;
10073
10471
  try {
10074
10472
  items = filterItems(items, compileFilter(others, this._filterContext()));
@@ -10136,7 +10534,7 @@ let DataGrid = class DataGrid extends LitElement {
10136
10534
  #announceSorting(column) {
10137
10535
  const translation = this.#translation;
10138
10536
  const order = this.#orderOf(column);
10139
- const params = { column: column.label ?? '' };
10537
+ const params = { column: columnText(column) };
10140
10538
  const rowSorting = this.#sorting.filter(spec => !this.#isGrouped(spec.column));
10141
10539
  const priority = rowSorting.findIndex(spec => spec.column === column) + 1;
10142
10540
  const orderText = order === 'asc' ? translation.sortAscending : translation.sortDescending;
@@ -10168,8 +10566,7 @@ let DataGrid = class DataGrid extends LitElement {
10168
10566
  return this.#dataTypes.get(column);
10169
10567
  }
10170
10568
  #formatContext(column) {
10171
- const { trueText, falseText } = this.#translation;
10172
- return { language: this.language, dataType: this.#dataTypeOf(column), trueText, falseText };
10569
+ return { language: this.language, dataType: this.#dataTypeOf(column), ...booleanTexts(column, this.#translation) };
10173
10570
  }
10174
10571
  #groupValueText(row) {
10175
10572
  const { column } = row;
@@ -10190,9 +10587,9 @@ let DataGrid = class DataGrid extends LitElement {
10190
10587
  return formatCellValue(row.value, row.firstItem, column, this.#formatContext(column));
10191
10588
  }
10192
10589
  // ---------------------------------------------------------------- resumos
10193
- get #summaryFormatContext() {
10194
- const { trueText, falseText } = this.#translation;
10195
- return { language: this.language, trueText, falseText };
10590
+ /** Contexto dos resumos; os textos de `true`/`false` são os da coluna do resumo. */
10591
+ #summaryFormatContext(column) {
10592
+ return { language: this.language, ...booleanTexts(column, this.#translation) };
10196
10593
  }
10197
10594
  #summaryTypeName(item) {
10198
10595
  if (item.label) {
@@ -10217,9 +10614,9 @@ let DataGrid = class DataGrid extends LitElement {
10217
10614
  /** Texto da célula (`"Sum: 1,234"`) e rótulo completo (`"Sum of Population: 1,234"`). */
10218
10615
  #summaryText({ item, spec }, value) {
10219
10616
  const translation = this.#translation;
10220
- const valueText = formatSummaryValue(value, spec, item.format, this.#summaryFormatContext);
10617
+ const valueText = formatSummaryValue(value, spec, item.format, this.#summaryFormatContext(spec.column));
10221
10618
  const type = this.#summaryTypeName(item);
10222
- const column = spec.column?.label ?? '';
10619
+ const column = spec.column ? columnText(spec.column) : '';
10223
10620
  const text = type ? formatMessage(translation.summaryText, { type, value: valueText }) : valueText;
10224
10621
  if (!column) {
10225
10622
  return { text, label: text };
@@ -10231,46 +10628,28 @@ let DataGrid = class DataGrid extends LitElement {
10231
10628
  : `${column}${translation.groupLabelSeparator}${valueText}`,
10232
10629
  };
10233
10630
  }
10234
- /** Resumos agrupados pela coluna onde aparecem. */
10631
+ /**
10632
+ * Resumos agrupados pela coluna onde aparecem. Coluna oculta por falta de
10633
+ * espaço (spec 21) não mostra o resumo no rodapé, como as células dela (o
10634
+ * DevExtreme faz o mesmo); o valor segue no `getSummaryValues`.
10635
+ */
10235
10636
  #textsByColumn(summaries, values, include) {
10236
10637
  const texts = new Map();
10237
10638
  const adaptive = this.#adaptiveColumns;
10238
- const lastShown = this._visibleColumns[this._visibleColumns.length - 1];
10239
10639
  summaries.forEach((summary, index) => {
10240
- let { column } = summary.spec;
10241
- if (!column || !include(summary, index)) {
10640
+ const { column } = summary.spec;
10641
+ if (!column || !include(summary, index) || adaptive.includes(column)) {
10242
10642
  return;
10243
10643
  }
10244
- let text = this.#summaryText(summary, values[index]);
10245
- // Coluna oculta por falta de espaço (spec 21): o resumo vai à última exibida, com o texto completo.
10246
- if (adaptive.length && adaptive.includes(column)) {
10247
- if (!lastShown) {
10248
- return;
10249
- }
10250
- column = lastShown;
10251
- text = { text: text.label, label: text.label };
10252
- }
10253
10644
  let list = texts.get(column);
10254
10645
  if (!list) {
10255
10646
  list = [];
10256
10647
  texts.set(column, list);
10257
10648
  }
10258
- list.push(text);
10649
+ list.push(this.#summaryText(summary, values[index]));
10259
10650
  });
10260
10651
  return texts;
10261
10652
  }
10262
- /**
10263
- * Rodapé de totais com colunas ocultas por falta de espaço (spec 21): a
10264
- * última exibida recebe os resumos delas e quebra linha (WCAG 1.4.10). O
10265
- * rodapé de grupo está no virtualizador (altura fixa): lá ela não quebra.
10266
- */
10267
- #summaryLayout(layout) {
10268
- const last = this._visibleColumns[this._visibleColumns.length - 1];
10269
- if (!this.#adaptiveColumns.length || !last) {
10270
- return layout;
10271
- }
10272
- return layout.map(cell => cell.column === last ? { ...cell, className: `${cell.className} adaptive-summaries` } : cell);
10273
- }
10274
10653
  /** Separador de lista do idioma (sem "e"/"and"), calculado uma vez por idioma. */
10275
10654
  get #listSeparatorText() {
10276
10655
  const language = this.language;
@@ -10701,6 +11080,14 @@ let DataGrid = class DataGrid extends LitElement {
10701
11080
  this.#focusPending ||= focus;
10702
11081
  this.#revealPending ||= reveal || focus;
10703
11082
  this.#revealAttempts = 0;
11083
+ // Porta externa (spec 27): chamada de API respeita o `scroll-behavior` do contêiner; teclado/clique, instantâneo.
11084
+ if (reveal || focus) {
11085
+ this.#revealByApi = source === 'api';
11086
+ // Ação do usuário no meio de uma rolagem suave da API: vale a do usuário (instantânea, já).
11087
+ if (source === 'user') {
11088
+ this.#revealInFlight = false;
11089
+ }
11090
+ }
10704
11091
  this.#reportFocus(source);
10705
11092
  this.requestUpdate();
10706
11093
  }
@@ -10871,16 +11258,32 @@ let DataGrid = class DataGrid extends LitElement {
10871
11258
  this.#revealPending = false;
10872
11259
  return;
10873
11260
  }
10874
- if (this.#focusPending) {
11261
+ // Porta externa, API com rolagem suave até uma linha fora da janela
11262
+ // virtual (spec 27): o foco espera a linha chegar (a `.pinned` é
11263
+ // invisível; lupa e realce do leitor iriam para o topo do grid).
11264
+ const pinned = cell.closest('tr')?.classList.contains('pinned') ?? false;
11265
+ const deferFocus = this.#focusPending && pinned && this.#revealPending && this.#scrollPort.port !== null
11266
+ && this.#revealBehavior() !== 'instant';
11267
+ if (deferFocus) {
11268
+ this.#deferredFocusFrom ??= this.#deepActiveElement();
11269
+ }
11270
+ else if (this.#focusPending) {
10875
11271
  this.#focusPending = false;
11272
+ const from = this.#deferredFocusFrom;
11273
+ this.#deferredFocusFrom = undefined;
11274
+ // Foco esperado pela rolagem: só se ninguém o levou para outro lugar enquanto isso.
11275
+ const moved = from !== undefined && this.#deepActiveElement() !== from && !this.matches(':focus-within');
10876
11276
  // Foco perdido num valor da linha adaptativa (linha recriada ao salvar): volta ao mesmo valor (spec 21).
10877
11277
  const adaptive = this.#adaptiveFocus;
10878
11278
  const value = adaptive && cell.classList.contains('detail-cell')
10879
11279
  ? cell.querySelector(`.adaptive-value.focus-target[data-column="${columnIdOf(adaptive.column)}"]`)
10880
11280
  : null;
10881
- (value ?? cell).focus({ preventScroll: true });
11281
+ if (!moved) {
11282
+ (value ?? cell).focus({ preventScroll: true });
11283
+ }
10882
11284
  }
10883
- if (!this.#revealPending) {
11285
+ // Rolagem suave até a linha em curso (porta externa): continua quando ela acabar.
11286
+ if (!this.#revealPending || this.#revealInFlight) {
10884
11287
  return;
10885
11288
  }
10886
11289
  if (cell.closest('tr')?.classList.contains('pinned')) {
@@ -10888,11 +11291,21 @@ let DataGrid = class DataGrid extends LitElement {
10888
11291
  // pela rolagem traz a linha e termina o ajuste (horizontal).
10889
11292
  if (++this.#revealAttempts > 3) {
10890
11293
  this.#revealPending = false;
11294
+ this.#revealByApi = false;
10891
11295
  }
10892
11296
  this.#scrollRowIntoView(this.#activeRowIndex);
10893
11297
  return;
10894
11298
  }
10895
11299
  this.#revealPending = false;
11300
+ if (this.#scrollPort.port) {
11301
+ // Porta externa (spec 27): as margens do `scroll-margin` (CSS) e o `scroll-padding` do contêiner.
11302
+ this.#syncRevealMargins();
11303
+ const behavior = this.#revealBehavior();
11304
+ cell.scrollIntoView({ block: 'nearest', inline: 'nearest', behavior });
11305
+ this.#afterRevealScroll(behavior);
11306
+ this.#revealByApi = false;
11307
+ return;
11308
+ }
10896
11309
  const scroller = this._scrollContainerRef.value;
10897
11310
  if (scroller) {
10898
11311
  // Cabeçalho/barra presos no topo e rodapé de totais preso embaixo: a
@@ -10908,17 +11321,135 @@ let DataGrid = class DataGrid extends LitElement {
10908
11321
  /** Rola até a linha `index` sem depender de ela estar renderizada (abaixo do que é fixo no topo). */
10909
11322
  #scrollRowIntoView(index) {
10910
11323
  // Linhas fixas não rolam na vertical.
10911
- if (this.#isBodyIndex(index)) {
11324
+ if (!this.#isBodyIndex(index)) {
11325
+ return;
11326
+ }
11327
+ if (this.#scrollPort.port) {
11328
+ this.#revealExternalRow(index);
11329
+ }
11330
+ else {
10912
11331
  this.#virtualizer.scrollToIndex(index);
10913
11332
  }
10914
11333
  }
11334
+ /** Foco que esperava a rolagem suave: onde ele estava quando começou a esperar. */
11335
+ #deferredFocusFrom;
11336
+ /** Listeners de interrupção (roda, toque, ponteiro, tecla na porta) durante a rolagem suave. */
11337
+ #revealInterrupt;
11338
+ #deepActiveElement() {
11339
+ let active = document.activeElement;
11340
+ while (active?.shadowRoot?.activeElement) {
11341
+ active = active.shadowRoot.activeElement;
11342
+ }
11343
+ return active;
11344
+ }
11345
+ /** O usuário mexeu na rolagem durante a rolagem suave da API: ela não é refeita (nem o foco roubado). */
11346
+ #cancelReveal;
11347
+ /** A última revelação veio de chamada de API (`focusCell`, `editCell`...). */
11348
+ #revealByApi;
11349
+ /** Rolagem suave da porta externa em curso: a revelação continua no `scrollend`. */
11350
+ #revealInFlight;
11351
+ /** Margens horizontais do que gruda (colunas fixas, recuos), medidas no render. */
11352
+ #revealInline;
11353
+ #revealMarginsKey;
11354
+ #revealProbe;
11355
+ /** `instant` para ação do usuário e com `prefers-reduced-motion`; `auto` (o `scroll-behavior` do contêiner) para API. */
11356
+ #revealBehavior() {
11357
+ const port = this.#scrollPort.port;
11358
+ // `auto` só faz diferença com `scroll-behavior: smooth` no contêiner; sem ele, é instantâneo (e relido já).
11359
+ return this.#revealByApi && port && getComputedStyle(port.element).scrollBehavior === 'smooth'
11360
+ && !window.matchMedia?.('(prefers-reduced-motion: reduce)').matches ? 'auto' : 'instant';
11361
+ }
11362
+ /**
11363
+ * Margens de rolagem (spec 27) das células e dos focáveis delas (CSS) e
11364
+ * deslocamentos do que o hospedeiro gruda no contêiner (`scroll-padding`
11365
+ * dele), para o `sticky` e para a regra dos 50%.
11366
+ */
11367
+ #syncRevealMargins() {
11368
+ const layout = this.#layoutRef.value;
11369
+ if (!layout || !this.#scrollPort.port) {
11370
+ return;
11371
+ }
11372
+ const inset = this.#scrollPort.padding();
11373
+ // A barra de erro (56px) cobre o pé da parte visível.
11374
+ const error = this.#dataSource && this.#loader.error ? 56 : 0;
11375
+ const values = [this.#stickyTop(), this.#stickyBottom() + error, this.#revealInline.start, this.#revealInline.end, inset.top, inset.bottom];
11376
+ const key = values.join();
11377
+ if (key === this.#revealMarginsKey) {
11378
+ return;
11379
+ }
11380
+ this.#revealMarginsKey = key;
11381
+ const names = ['--_reveal-top', '--_reveal-bottom', '--_reveal-start', '--_reveal-end', '--_port-inset-top', '--_port-inset-bottom'];
11382
+ names.forEach((name, i) => layout.style.setProperty(name, `${values[i]}px`));
11383
+ }
11384
+ /**
11385
+ * Linha fora da janela virtual com a porta externa: um alvo invisível onde
11386
+ * a linha estaria recebe o `scrollIntoView` (rola também os ancestrais do
11387
+ * contêiner). Na horizontal fica na borda visível — o ajuste horizontal
11388
+ * vem com a célula, quando a linha entrar no render.
11389
+ */
11390
+ #revealExternalRow(index) {
11391
+ const port = this.#scrollPort.port;
11392
+ const container = this._containerRef.value;
11393
+ const body = this.#tableRef.value?.querySelector(':scope > tbody.body-rows');
11394
+ if (!port || !container || !body) {
11395
+ return;
11396
+ }
11397
+ this.#syncRevealMargins();
11398
+ const inset = this.#scrollPort.padding();
11399
+ const top = this.#stickyTop();
11400
+ const bottom = this.#stickyBottom() + (this.#dataSource && this.#loader.error ? 56 : 0);
11401
+ const offset = this.#virtualizer.revealOffset(index, top + inset.top, bottom + inset.bottom);
11402
+ const box = container.getBoundingClientRect();
11403
+ const view = port.rect();
11404
+ const probe = this.#revealProbe ??= Object.assign(document.createElement('div'), { className: 'reveal-probe' });
11405
+ probe.setAttribute('aria-hidden', 'true');
11406
+ probe.style.top = `${body.getBoundingClientRect().top - box.top + offset}px`;
11407
+ probe.style.height = `${this.#virtualizer.sizeOf(index)}px`;
11408
+ probe.style.left = `${Math.max(0, Math.min(box.width - 1, Math.max(view.left, box.left) - box.left))}px`;
11409
+ probe.style.scrollMargin = `${top}px 0px ${bottom}px`;
11410
+ container.append(probe);
11411
+ const behavior = this.#revealBehavior();
11412
+ probe.scrollIntoView({ block: 'nearest', inline: 'nearest', behavior });
11413
+ this.#afterRevealScroll(behavior, probe);
11414
+ }
11415
+ /** Depois do `scrollIntoView` na porta externa: instantâneo relê já; suave espera o `scrollend`. */
11416
+ #afterRevealScroll(behavior, probe) {
11417
+ if (behavior === 'instant') {
11418
+ probe?.remove();
11419
+ this.#virtualizer.sync();
11420
+ return;
11421
+ }
11422
+ this.#revealInFlight = true;
11423
+ const port = this.#scrollPort.port;
11424
+ if (port && !this.#revealInterrupt) {
11425
+ this.#revealInterrupt = new AbortController();
11426
+ const options = { passive: true, signal: this.#revealInterrupt.signal };
11427
+ for (const type of ['wheel', 'touchstart', 'pointerdown', 'keydown']) {
11428
+ port.target.addEventListener(type, this.#cancelReveal, options);
11429
+ }
11430
+ }
11431
+ this.#scrollPort.afterScrollEnd(() => {
11432
+ this.#revealInterrupt?.abort();
11433
+ this.#revealInterrupt = undefined;
11434
+ // O alvo fica até a rolagem suave chegar (tirá-lo antes pode interrompê-la).
11435
+ probe?.remove();
11436
+ this.#revealInFlight = false;
11437
+ this.#virtualizer.endGlide();
11438
+ if (this.isConnected) {
11439
+ this.#virtualizer.sync();
11440
+ this.requestUpdate();
11441
+ }
11442
+ });
11443
+ }
10915
11444
  /** Altura do que fica preso no topo da rolagem (cabeçalho das colunas ou barra). */
10916
11445
  #stickyTop() {
10917
11446
  const root = this.renderRoot;
10918
11447
  const thead = root.querySelector('thead');
10919
11448
  const toolbar = root.querySelector('.header');
10920
11449
  // Com a barra, o cabeçalho prende logo abaixo dela (\`.header + table thead\`); as fixas do topo, abaixo dele.
10921
- return (thead?.offsetHeight ?? 0) + (toolbar?.offsetHeight ?? 0) + this.#fixedHeight('top');
11450
+ // Cabeçalho alto demais (\`headerWrap\`, regra dos 50%): ele rola com o conteúdo e não cobre nada.
11451
+ const head = this._containerRef.value?.classList.contains('header-rows-scroll') ? 0 : thead?.offsetHeight ?? 0;
11452
+ return head + (toolbar?.offsetHeight ?? 0) + this.#fixedHeight('top');
10922
11453
  }
10923
11454
  /** Altura do rodapé de totais e das fixas do fundo (presos no fim da rolagem). */
10924
11455
  #stickyBottom() {
@@ -10931,6 +11462,13 @@ let DataGrid = class DataGrid extends LitElement {
10931
11462
  /** Linhas do corpo que cabem na área visível. */
10932
11463
  #pageSize() {
10933
11464
  const scroller = this._scrollContainerRef.value;
11465
+ const port = this.#scrollPort.port;
11466
+ if (port) {
11467
+ // Porta externa (spec 27): a altura da porta menos o que grudaria nela,
11468
+ // quanto do grid estiver à vista agora.
11469
+ const inset = this.#scrollPort.padding();
11470
+ return Math.max(1, Math.floor((port.clientHeight - inset.top - inset.bottom - this.#stickyTop() - this.#stickyBottom()) / this.rowHeight));
11471
+ }
10934
11472
  if (!scroller) {
10935
11473
  return 1;
10936
11474
  }
@@ -11218,7 +11756,7 @@ let DataGrid = class DataGrid extends LitElement {
11218
11756
  this._userGroupColumn(column, this._groupColumns.length);
11219
11757
  // `groupable: false` recusa: nada a anunciar (spec 17).
11220
11758
  if (this._groupColumns.includes(column)) {
11221
- this.#announce(formatMessage(this.#translation.groupedAnnouncement, { column: column.label ?? '' }));
11759
+ this.#announce(formatMessage(this.#translation.groupedAnnouncement, { column: columnText(column) }));
11222
11760
  }
11223
11761
  this.#focusPending = true;
11224
11762
  return true;
@@ -11491,7 +12029,7 @@ let DataGrid = class DataGrid extends LitElement {
11491
12029
  // Posição entre as irmãs visíveis (o `_regularColumns` já tem a ordem nova).
11492
12030
  const visibleAfter = this.#siblingsOf(column).filter(sibling => this._isColumnVisible(sibling));
11493
12031
  this.#announce(formatMessage(this.#translation.columnMovedAnnouncement, {
11494
- column: column.label ?? '',
12032
+ column: columnText(column),
11495
12033
  position: String(visibleAfter.indexOf(column) + 1),
11496
12034
  count: String(visibleAfter.length),
11497
12035
  }));
@@ -11534,7 +12072,7 @@ let DataGrid = class DataGrid extends LitElement {
11534
12072
  /** Novo nível de uma coluna agrupada (Alt+Shift+←/→ no chip ou menu do painel). */
11535
12073
  #announceGroupLevel(column) {
11536
12074
  this.#announce(formatMessage(this.#translation.groupLevelChangedAnnouncement, {
11537
- column: column.label ?? '',
12075
+ column: columnText(column),
11538
12076
  level: String(this._groupColumns.indexOf(column) + 1),
11539
12077
  count: String(this._groupColumns.length),
11540
12078
  }));
@@ -11542,7 +12080,7 @@ let DataGrid = class DataGrid extends LitElement {
11542
12080
  /** Largura da coluna depois de redimensionar pelo cabeçalho (teclado: com espera; menu: na hora). */
11543
12081
  #announceWidth(column, delay) {
11544
12082
  const announce = () => this.#announce(formatMessage(this.#translation.columnResizedAnnouncement, {
11545
- column: column.label ?? '',
12083
+ column: columnText(column),
11546
12084
  width: String(Math.round(this.#widthOf(column) ?? this._boundsOf(column).width)),
11547
12085
  }));
11548
12086
  if (delay) {
@@ -11556,7 +12094,7 @@ let DataGrid = class DataGrid extends LitElement {
11556
12094
  /** Desagrupa pelo teclado (chip ou linha de grupo): anuncia e leva o foco ao cabeçalho da coluna devolvida. */
11557
12095
  #userUngroup(column) {
11558
12096
  this.#moveColumnTo(false, column, this._regularColumns.length, 'user');
11559
- this.#announce(formatMessage(this.#translation.ungroupedAnnouncement, { column: column.label ?? '' }));
12097
+ this.#announce(formatMessage(this.#translation.ungroupedAnnouncement, { column: columnText(column) }));
11560
12098
  // O foco vai ao cabeçalho da coluna devolvida (fim das comuns); sem cabeçalho, a guarda de foco acha a célula ativa.
11561
12099
  void this.updateComplete.then(() => {
11562
12100
  const col = this.#currentNavColumns().indexOf(column);
@@ -11608,12 +12146,13 @@ let DataGrid = class DataGrid extends LitElement {
11608
12146
  const fixedStart = layout.reduce((sum, { headerClasses, width }) => sum + (headerClasses['fixed-start'] ? width ?? 0 : 0), 0);
11609
12147
  // A barra de erro cobre o pé da área de rolagem: o foco não para debaixo dela.
11610
12148
  // `--_fixed-*`: o rótulo da banda prende entre as áreas fixas (frente 13).
12149
+ this.#revealInline = { start: this.#stickyStart() + fixedStart, end: fixedEnd };
11611
12150
  const scrollPadding = `scroll-padding-inline: ${this.#stickyStart() + fixedStart}px ${fixedEnd}px;`
11612
12151
  + ` --_fixed-start: ${this.#stickyStart() + fixedStart}px; --_fixed-end: ${fixedEnd}px;`
11613
12152
  + (this.#dataSource && this.#loader.error ? ' scroll-padding-block-end: 56px;' : '');
11614
12153
  // Coluna flex: a área do grid e o pager (que pode quebrar linha) dividem a altura.
11615
12154
  return html `
11616
- <div class=${waiting ? 'layout state-loading' : 'layout'}>
12155
+ <div class=${`layout${waiting ? ' state-loading' : ''}${this.#scrollPort.external ? ' external-scroll' : ''}`} ${ref(this.#layoutRef)}>
11617
12156
  <div
11618
12157
  class="container ${classMap(classes)}"
11619
12158
  ${ref(this._containerRef)}>
@@ -11623,10 +12162,10 @@ let DataGrid = class DataGrid extends LitElement {
11623
12162
  class=${`grid-table${fit ? ' fit' : ''}${this.#cellSelectionMode !== 'none' ? ' cell-range-mode' : ''}`}
11624
12163
  role=${this._groupColumns.length || this.#treeOn ? 'treegrid' : 'grid'}
11625
12164
  aria-label=${ifDefined(this.#hostLabel.name || undefined)}
11626
- aria-rowcount="${waiting || this.#unknownRowCount ? -1 : this.#bodyRowCount + headerRows + footerRows + fixedTop.length + fixedBottom.length}"
12165
+ aria-rowcount="${waiting || this.#unknownRowCount || this.#loadingPlaceholders ? -1 : this.#bodyRowCount + headerRows + footerRows + fixedTop.length + fixedBottom.length}"
11627
12166
  aria-colcount="${navColumns.length}"
11628
12167
  aria-multiselectable=${ifDefined(selectionMode === 'multiple' || this.#cellSelectionMode !== 'none' ? 'true' : undefined)}
11629
- aria-busy=${ifDefined(waiting || (this.#isLoading && !this.#reshapeLoading) || this.#filtering.pending ? 'true' : undefined)}
12168
+ aria-busy=${ifDefined(waiting || (this.#isLoading && !this.#reshapeLoading) || this.#filtering.pending || this.#loadingPlaceholders ? 'true' : undefined)}
11630
12169
  ${ref(this.#tableRef)}
11631
12170
  @pointerover=${this.#updateCellHint}
11632
12171
  @keydown=${this.#onGridKeyDown}
@@ -11681,7 +12220,8 @@ let DataGrid = class DataGrid extends LitElement {
11681
12220
  }
11682
12221
  /**
11683
12222
  * `fill`: todas as larguras definidas — a última coluna leva a sobra da
11684
- * largura visível (`--_viewport-inline-size`, medida no `ResizeObserver`),
12223
+ * largura do grid (`--_fill-inline-size`, medida no `ResizeObserver`; com a
12224
+ * porta externa, a do grid — não a parte visível, que muda na rolagem),
11685
12225
  * sem ler o DOM no render: as outras colunas entram na conta pelos px e
11686
12226
  * pelas larguras do CSS (recuos, expansão, caixas, comandos).
11687
12227
  */
@@ -11703,7 +12243,7 @@ let DataGrid = class DataGrid extends LitElement {
11703
12243
  ...this.#showCommandColumn ? ['var(--_command-column-width)'] : [],
11704
12244
  ].join(' - ');
11705
12245
  const own = widthOf(last.column) ?? 0;
11706
- fillWidth = `max(${own}px, var(--_viewport-inline-size, 0px) - ${reserved})`;
12246
+ fillWidth = `max(${own}px, var(--_fill-inline-size, 0px) - ${reserved})`;
11707
12247
  }
11708
12248
  return html `
11709
12249
  ${map(this._groupColumns, () => html `
@@ -11799,7 +12339,7 @@ let DataGrid = class DataGrid extends LitElement {
11799
12339
  controller: this.#filterRow,
11800
12340
  column: cell.column,
11801
12341
  dataType: this.#dataTypeOf(cell.column),
11802
- filterable: isColumnFilterable(cell.column),
12342
+ filterable: this.#isFilterable(cell.column),
11803
12343
  translation,
11804
12344
  className: cell.className,
11805
12345
  style: cell.style,
@@ -11927,8 +12467,12 @@ let DataGrid = class DataGrid extends LitElement {
11927
12467
  const idSuffix = `${header.level}-${cell.col + 1}`;
11928
12468
  return renderHeaderCell({
11929
12469
  column,
11930
- // Cabeçalho multinível: a folha que fecha a última posição não leva a linha do fim (é a borda do grid).
11931
- classes: header.start + header.span === cells.length ? { ...cell.headerClasses, 'last-column': true } : cell.headerClasses,
12470
+ classes: {
12471
+ ...cell.headerClasses,
12472
+ // Cabeçalho multinível: a folha que fecha a última posição não leva a linha do fim (é a borda do grid).
12473
+ 'last-column': header.start + header.span === cells.length,
12474
+ 'header-wrap': this.#wrapsHeader(column),
12475
+ },
11932
12476
  styles: cell.headerStyles,
11933
12477
  colIndex: cell.col + 1,
11934
12478
  tabIndex: active === column ? 0 : -1,
@@ -11950,15 +12494,15 @@ let DataGrid = class DataGrid extends LitElement {
11950
12494
  }
11951
12495
  }
11952
12496
  : undefined,
11953
- trailing: cell.resizable ? this.#renderResizeHandle(cell) : nothing,
11954
- filterButton: this.headerFilter && isColumnFilterable(column)
11955
- ? renderHeaderFilterButton(this.#headerFilterPopover, column, filterValue, this.#translation, `header-description-${idSuffix}`)
12497
+ trailing: cell.resizable ? this.#renderResizeHandle(cell, idSuffix) : nothing,
12498
+ filterButton: this.#hasFunnel(column)
12499
+ ? renderHeaderFilterButton(this.#headerFilterPopover, column, filterValue, this.#translation, this.#resolveFilterField, `header-description-${idSuffix}`, idSuffix, this.#textLanguage)
11956
12500
  : nothing,
11957
- menuButton: this.#renderColumnMenuButton(column),
11958
- filtered: hasColumnCondition(filterValue, column),
11959
- description: this.#headerDescription(column, rowSorting[position]?.order, position + 1, showIndex, hasColumnCondition(filterValue, column)),
12501
+ menuButton: this.#renderColumnMenuButton(column, idSuffix),
12502
+ filtered: hasColumnCondition(filterValue, column, this.#resolveFilterField),
12503
+ description: this.#headerDescription(column, rowSorting[position]?.order, position + 1, showIndex, hasColumnCondition(filterValue, column, this.#resolveFilterField)),
11960
12504
  keyShortcuts: this.#headerKeyShortcuts(column, cell.resizable),
11961
- label: column.headerRenderer ? this.#renderHeaderContent(column, cell.id) : column.label,
12505
+ label: column.headerRenderer ? this.#renderHeaderContent(column, cell.id) : headerText(column),
11962
12506
  });
11963
12507
  }
11964
12508
  /** Banda: `colspan` = posições renderizadas sob ela; fixa como as filhas. */
@@ -12006,7 +12550,7 @@ let DataGrid = class DataGrid extends LitElement {
12006
12550
  // F2 só leva a algum lugar com conteúdo do \`headerRenderer\` (o botão "⋮" saiu: menu de contexto).
12007
12551
  ...column.headerRenderer ? ['F2'] : [],
12008
12552
  ].join(' '),
12009
- label: column.headerRenderer ? this.#renderHeaderContent(column, id) : column.label,
12553
+ label: column.headerRenderer ? this.#renderHeaderContent(column, id) : headerText(column),
12010
12554
  });
12011
12555
  }
12012
12556
  /**
@@ -12035,7 +12579,7 @@ let DataGrid = class DataGrid extends LitElement {
12035
12579
  /** \`aria-keyshortcuts\` do cabeçalho: só as teclas que valem para a coluna (nomes do UI Events). */
12036
12580
  #headerKeyShortcuts(column, resizable) {
12037
12581
  const keys = [];
12038
- const funnel = this.headerFilter && isColumnFilterable(column);
12582
+ const funnel = this.#hasFunnel(column);
12039
12583
  if (this.#hasColumnMenu(column)) {
12040
12584
  keys.push('Shift+F10');
12041
12585
  }
@@ -12068,7 +12612,7 @@ let DataGrid = class DataGrid extends LitElement {
12068
12612
  * com o rótulo da coluna no idioma do conteúdo. Fora do `.header-text`: o
12069
12613
  * nome do `columnheader` não o inclui.
12070
12614
  */
12071
- #renderColumnMenuButton(column) {
12615
+ #renderColumnMenuButton(column, idSuffix) {
12072
12616
  if (!this.#showsColumnMenuButton(column)) {
12073
12617
  return nothing;
12074
12618
  }
@@ -12076,8 +12620,9 @@ let DataGrid = class DataGrid extends LitElement {
12076
12620
  const at = template.indexOf('{column}');
12077
12621
  const before = at >= 0 ? template.slice(0, at) : template;
12078
12622
  const after = at >= 0 ? template.slice(at + '{column}'.length) : '';
12079
- const columnLabel = column.label ?? '';
12623
+ const columnLabel = columnText(column);
12080
12624
  const open = this.#contextMenuOpenFor('header', column);
12625
+ const named = column.headerRenderer ? labelledByHeader(template, 'header-menu-name', idSuffix) : undefined;
12081
12626
  const openMenu = (button, focusLast) => {
12082
12627
  this.#openHeaderMenu(column, button.closest('th'), { opener: button, focusLast }, null);
12083
12628
  };
@@ -12088,7 +12633,9 @@ let DataGrid = class DataGrid extends LitElement {
12088
12633
  tabindex="-1"
12089
12634
  aria-haspopup="menu"
12090
12635
  aria-expanded=${open ? 'true' : 'false'}
12091
- title=${formatMessage(template, { column: columnLabel })}
12636
+ aria-labelledby=${ifDefined(named?.labelledBy)}
12637
+ lang=${ifDefined(named ? this.#textLanguage : undefined)}
12638
+ title=${ifDefined(named && !column.label ? undefined : formatMessage(template, { column: columnLabel }))}
12092
12639
  @pointerdown=${(event) => {
12093
12640
  // Não ordena nem começa a seleção de intervalo pelo cabeçalho.
12094
12641
  event.stopPropagation();
@@ -12117,17 +12664,20 @@ let DataGrid = class DataGrid extends LitElement {
12117
12664
  openMenu(event.currentTarget, event.key === 'ArrowUp');
12118
12665
  }
12119
12666
  }
12120
- }}><span
12667
+ }}>${named?.parts ?? html `<span
12121
12668
  class="visually-hidden"
12122
- lang=${this.#textLanguage}>${before}<span lang=${this.#contentLanguage}>${columnLabel}</span>${after}</span></button>`;
12669
+ lang=${this.#textLanguage}>${before}<span lang=${this.#contentLanguage}>${columnLabel}</span>${after}</span>`}</button>`;
12123
12670
  }
12124
- #renderResizeHandle({ column, bounds, width }) {
12671
+ #renderResizeHandle({ column, bounds, width }, idSuffix) {
12672
+ const named = column.headerRenderer ? labelledByHeader(this.#translation.resizeHandleLabel, 'resize-handle-name', idSuffix) : undefined;
12125
12673
  // Fora da ordem de Tab (o grid tem um ponto só): F2 no cabeçalho chega aqui, Esc volta.
12126
12674
  return html `<div
12127
12675
  class="resize-handle"
12128
12676
  role="separator"
12129
12677
  aria-orientation="vertical"
12130
- aria-label=${formatMessage(this.#translation.resizeHandleLabel, { column: column.label ?? '' })}
12678
+ aria-label=${ifDefined(named ? undefined : formatMessage(this.#translation.resizeHandleLabel, { column: columnText(column) }))}
12679
+ aria-labelledby=${ifDefined(named?.labelledBy)}
12680
+ lang=${this.#textLanguage}
12131
12681
  aria-valuenow=${ifDefined(width === undefined ? undefined : Math.round(width))}
12132
12682
  aria-valuemin=${bounds.min}
12133
12683
  aria-valuemax=${ifDefined(Number.isFinite(bounds.max) ? bounds.max : undefined)}
@@ -12151,7 +12701,41 @@ let DataGrid = class DataGrid extends LitElement {
12151
12701
  else {
12152
12702
  this.#resize.keyDown(event, column, false);
12153
12703
  }
12154
- }}></div>`;
12704
+ }}>${named?.parts ?? nothing}</div>`;
12705
+ }
12706
+ /** Rótulo do cabeçalho quebra linha: o da coluna ou o padrão do grid. */
12707
+ #wrapsHeader(column) {
12708
+ return column.headerWrap ?? this.headerWrap;
12709
+ }
12710
+ /** Alguma coluna visível quebra o rótulo: o cabeçalho tem altura variável (observado). */
12711
+ get #anyHeaderWrap() {
12712
+ return this.headerWrap || this._visibleColumns.some(column => column.headerWrap);
12713
+ }
12714
+ /** `loading` sem linhas: a contagem de linhas fica desconhecida e o esqueleto é só visual. */
12715
+ get #loadingPlaceholders() {
12716
+ return this.loading && !this.#rows.length && !this.#waitingForState;
12717
+ }
12718
+ /**
12719
+ * Linha do estado vazio: "sem dados" ou, com `loading`, "Carregando…" e
12720
+ * linhas de esqueleto só visuais (`aria-hidden`, sem papel nem foco; spec
12721
+ * 17), no lugar do que caberia na tela. Um template só: ao terminar a carga
12722
+ * o mesmo `<td>` fica e só o conteúdo muda.
12723
+ */
12724
+ #renderEmptyRow(layout) {
12725
+ const columns = Math.max(this.#totalColumns(layout), 1);
12726
+ const loading = this.loading;
12727
+ return html `
12728
+ <tr role="row" class=${loading ? 'no-data-row loading-row' : 'no-data-row'}>
12729
+ <td role="gridcell" part="no-data" lang=${ifDefined(this.noDataRenderer && !loading ? undefined : this.#textLanguage)} colspan="${columns}">${loading
12730
+ ? this.#translation.loading
12731
+ : this.noDataRenderer ? this.#renderNoDataContent(this.noDataRenderer) : this.#translation.noData}</td>
12732
+ </tr>
12733
+ ${loading
12734
+ ? map(Array.from({ length: this.#placeholderRows }), () => html `
12735
+ <tr class="skeleton-row loading-placeholder" part="row skeleton-row" aria-hidden="true">
12736
+ ${map(Array.from({ length: columns }), () => html `<td><span class="skeleton"></span></td>`)}
12737
+ </tr>`)
12738
+ : nothing}`;
12155
12739
  }
12156
12740
  #renderBody(window, headerRows, layout) {
12157
12741
  if (!this.#rows.length) {
@@ -12159,13 +12743,7 @@ let DataGrid = class DataGrid extends LitElement {
12159
12743
  if (this.#waitingForState || (this.#dataSource && !this.#loader.current)) {
12160
12744
  return nothing;
12161
12745
  }
12162
- return html `
12163
- <tr role="row" class="no-data-row">
12164
- <td role="gridcell" part="no-data" lang=${ifDefined(this.noDataRenderer ? undefined : this.#textLanguage)} colspan="${Math.max(this.#totalColumns(layout), 1)}">${this.noDataRenderer
12165
- ? this.#renderNoDataContent(this.noDataRenderer)
12166
- : this.#translation.noData}</td>
12167
- </tr>
12168
- `;
12746
+ return this.#renderEmptyRow(layout);
12169
12747
  }
12170
12748
  // As linhas ficam no fluxo da tabela, uma após a outra, depois de uma
12171
12749
  // linha espaçadora com a altura até a 1ª linha da janela (vale também
@@ -12235,13 +12813,15 @@ let DataGrid = class DataGrid extends LitElement {
12235
12813
  /** Painel de carregamento (consulta inteira) e barra de erro com "tentar de novo". */
12236
12814
  #renderLoadState() {
12237
12815
  const waiting = this.#waitingForState;
12238
- if (!this.#dataSource && !waiting) {
12816
+ // `loading` com linhas na tela: o painel por cima, sem `aria-busy` (as células seguem legíveis).
12817
+ const localLoading = this.loading && this.#rows.length > 0;
12818
+ if (!this.#dataSource && !waiting && !localLoading) {
12239
12819
  return nothing;
12240
12820
  }
12241
12821
  const translation = this.#translation;
12242
12822
  const failure = this.#dataSource ? this.#loader.error : undefined;
12243
12823
  return html `
12244
- ${waiting || this.#isLoading
12824
+ ${waiting || this.#isLoading || localLoading
12245
12825
  ? html `<div class="load-panel" part="load-panel" aria-hidden=${ifDefined(waiting ? undefined : 'true')}>
12246
12826
  <span class="load-spinner" aria-hidden="true"></span><span>${translation.loading}</span>
12247
12827
  </div>`
@@ -12534,7 +13114,7 @@ let DataGrid = class DataGrid extends LitElement {
12534
13114
  const id = columnIdOf(column);
12535
13115
  const labelId = `adaptive-${index}-${id}`;
12536
13116
  const textId = `${labelId}-value`;
12537
- const bands = this._bandChainOf(column).map(band => band.label ?? '')
13117
+ const bands = this._bandChainOf(column).map(band => columnText(band))
12538
13118
  .filter(Boolean);
12539
13119
  const sortPosition = sorting.findIndex(spec => spec.column === column);
12540
13120
  const order = sorting[sortPosition]?.order;
@@ -12543,7 +13123,7 @@ let DataGrid = class DataGrid extends LitElement {
12543
13123
  const sortText = order && sorting.length > 1 && sortPosition > 0
12544
13124
  ? formatMessage(translation.columnSortPriority, { order: orderText, priority: String(sortPosition + 1) })
12545
13125
  : orderText;
12546
- const filtered = hasColumnCondition(filterValue, column);
13126
+ const filtered = hasColumnCondition(filterValue, column, this.#resolveFilterField);
12547
13127
  const cell = this.#adaptiveCellLayout(column, id);
12548
13128
  const removed = pending?.type === 'remove';
12549
13129
  const added = pending?.type === 'add';
@@ -12570,7 +13150,7 @@ let DataGrid = class DataGrid extends LitElement {
12570
13150
  return html `<div class="adaptive-field" part="adaptive-field"><dt
12571
13151
  class="adaptive-label"
12572
13152
  part="adaptive-label"
12573
- id=${labelId}>${bands.length ? html `<span class="adaptive-band">${bands.join(' ')}</span> ` : nothing}<span class="adaptive-label-text">${column.label ?? ''}</span>${order
13153
+ id=${labelId}>${bands.length ? html `<span class="adaptive-band">${bands.join(' ')}</span> ` : nothing}<span class="adaptive-label-text">${columnText(column)}</span>${order
12574
13154
  ? html `${adaptiveMark(`adaptive-sort ${order}`, SORT_ARROW_PATH)}<span class="visually-hidden"> ${sortText}</span>`
12575
13155
  : nothing}${filtered
12576
13156
  ? html `${adaptiveMark('adaptive-filter', FILTER_MARK_PATH)}<span class="visually-hidden"> ${translation.columnFiltered}</span>`
@@ -12610,7 +13190,7 @@ let DataGrid = class DataGrid extends LitElement {
12610
13190
  }
12611
13191
  const modified = pending.type !== 'add' && adaptive.some(column => pending.modified.has(column));
12612
13192
  const invalid = adaptive.find(column => pending.errors.has(column));
12613
- const error = invalid ? `${invalid.label ?? ''}: ${pending.errors.get(invalid)}` : '';
13193
+ const error = invalid ? `${columnText(invalid)}: ${pending.errors.get(invalid)}` : '';
12614
13194
  return modified || error ? { modified, error } : undefined;
12615
13195
  }
12616
13196
  /** Layout de célula de uma coluna oculta por espaço (render do valor e do editor na linha adaptativa). */
@@ -12750,7 +13330,7 @@ let DataGrid = class DataGrid extends LitElement {
12750
13330
  #renderTotalFooter(layout, ariaRowIndex) {
12751
13331
  const rowIndex = this.#rows.length;
12752
13332
  return renderTotalFooter({
12753
- layout: this.#summaryLayout(layout),
13333
+ layout,
12754
13334
  texts: this.#textsByColumn(this.#totalSpecs, this.#totals, () => true),
12755
13335
  groupColumns: this._groupColumns.length,
12756
13336
  groupColumnWidth: GROUP_COLUMN_WIDTH,
@@ -13017,7 +13597,7 @@ let DataGrid = class DataGrid extends LitElement {
13017
13597
  const parts = pending.rowError ? [pending.rowError] : [];
13018
13598
  for (const [column, message] of pending.errors) {
13019
13599
  if (!this._visibleColumns.includes(column)) {
13020
- parts.push(`${column.label ?? ''}: ${message}`);
13600
+ parts.push(`${columnText(column)}: ${message}`);
13021
13601
  }
13022
13602
  }
13023
13603
  return parts.join(' ');
@@ -13029,7 +13609,7 @@ let DataGrid = class DataGrid extends LitElement {
13029
13609
  const current = editor.drafts.has(column)
13030
13610
  ? editor.drafts.get(column)
13031
13611
  : pending ? this.#pendingValue(pending, column) : getCellValue(row.item, column);
13032
- const label = column.label ?? '';
13612
+ const label = columnText(column);
13033
13613
  const error = pending?.errors.get(column) ?? '';
13034
13614
  const renderer = column.editorRenderer;
13035
13615
  if (renderer) {
@@ -13227,7 +13807,7 @@ let DataGrid = class DataGrid extends LitElement {
13227
13807
  return rendererContent({
13228
13808
  host: this,
13229
13809
  slotName: `u-grid-internal:group:${row.key}`,
13230
- deps: [row.groupKey, column, renderer, this.#renderEpoch(), row.value, row.expanded, row.itemCount, row.summaries, defaultText],
13810
+ deps: [row.groupKey, column, renderer, this.#renderEpoch(), row.value, row.expanded, row.itemCount, row.summaries, defaultText, row.firstItem],
13231
13811
  renderer,
13232
13812
  invoke: signal => renderer.call(column, {
13233
13813
  column,
@@ -13237,6 +13817,7 @@ let DataGrid = class DataGrid extends LitElement {
13237
13817
  groupIndex: row.level,
13238
13818
  itemCount: row.itemCount,
13239
13819
  expanded: row.expanded,
13820
+ firstItem: row.firstItem,
13240
13821
  get summaries() {
13241
13822
  return summaries();
13242
13823
  },
@@ -13297,7 +13878,7 @@ let DataGrid = class DataGrid extends LitElement {
13297
13878
  return html `<span class="node-summary">${this.#summaryTexts(summary)}</span>`;
13298
13879
  }
13299
13880
  const content = renderDataCell(this, row, cell.column, cell.id, cell.format, this.#renderEpoch(), adaptive);
13300
- return matcher && typeof content === 'string' && isColumnFilterable(cell.column)
13881
+ return matcher && typeof content === 'string' && this.#isFilterable(cell.column)
13301
13882
  ? renderHighlighted(content, matcher)
13302
13883
  : content;
13303
13884
  }
@@ -14125,13 +14706,13 @@ let DataGrid = class DataGrid extends LitElement {
14125
14706
  aria-haspopup=${ifDefined(opensMenu ? 'menu' : undefined)}
14126
14707
  aria-expanded=${ifDefined(opensMenu ? this.#contextMenuOpenFor('group-panel', column) ? 'true' : 'false' : undefined)}
14127
14708
  aria-keyshortcuts=${`${menu && sortable ? 'Shift+F10 ' : ''}Alt+Shift+ArrowLeft Alt+Shift+ArrowRight Delete Control+G Meta+G`}
14128
- aria-label=${sortable ? `${column.label ?? ''}, ${order === 'asc' ? translation.sortAscending : translation.sortDescending}` : column.label ?? ''}
14709
+ aria-label=${sortable ? `${columnText(column)}, ${order === 'asc' ? translation.sortAscending : translation.sortDescending}` : columnText(column)}
14129
14710
  @pointerdown=${sortable ? this.#onSortPointerDown : nothing}
14130
14711
  @click=${sortable
14131
14712
  ? (event) => this.#onGroupChipActivate(column, event)
14132
14713
  : opensMenu ? (event) => this.#onMenuChipClick(column, event) : nothing}
14133
14714
  @keydown=${(event) => this.#onChipKeyDown(column, index, event)}>
14134
- <span class="group-label">${column.label}</span>${renderSortIndicator(order)}
14715
+ <span class="group-label">${columnText(column)}</span>${renderSortIndicator(order)}
14135
14716
  </div>`;
14136
14717
  }
14137
14718
  /** Clique no chip que é botão de menu (não ordenável): abre/fecha o menu do painel. */
@@ -14425,7 +15006,7 @@ let DataGrid = class DataGrid extends LitElement {
14425
15006
  return [
14426
15007
  ...index >= 0
14427
15008
  ? [
14428
- { name: 'ungroupColumn', text: translation.ungroupColumn, hiddenSuffix: column.label ?? '' },
15009
+ { name: 'ungroupColumn', text: translation.ungroupColumn, hiddenSuffix: columnText(column) },
14429
15010
  { name: 'moveLeft', text: translation.moveLeft, disabled: !towardLeft },
14430
15011
  { name: 'moveRight', text: translation.moveRight, disabled: !towardRight },
14431
15012
  ]
@@ -14604,7 +15185,7 @@ let DataGrid = class DataGrid extends LitElement {
14604
15185
  row.expanded ? { name: 'collapseGroup', text: translation.collapseGroup } : { name: 'expandGroup', text: translation.expandGroup },
14605
15186
  { name: 'expandAllGroups', text: translation.expandAllGroups },
14606
15187
  { name: 'collapseAllGroups', text: translation.collapseAllGroups },
14607
- { name: 'ungroupColumn', text: translation.ungroupColumn, hiddenSuffix: row.column.label ?? '', separatorBefore: true },
15188
+ { name: 'ungroupColumn', text: translation.ungroupColumn, hiddenSuffix: columnText(row.column), separatorBefore: true },
14608
15189
  ];
14609
15190
  }
14610
15191
  #renderContextMenu() {
@@ -14647,7 +15228,7 @@ let DataGrid = class DataGrid extends LitElement {
14647
15228
  let kind;
14648
15229
  switch (request.target) {
14649
15230
  case 'header':
14650
- label = formatMessage(translation.columnHeaderMenuLabel, { column: request.column?.label ?? '' });
15231
+ label = formatMessage(translation.columnHeaderMenuLabel, { column: request.column ? columnText(request.column) : '' });
14651
15232
  kind = 'column-header-menu';
14652
15233
  break;
14653
15234
  case 'group-panel':
@@ -14834,7 +15415,7 @@ let DataGrid = class DataGrid extends LitElement {
14834
15415
  menu.hide();
14835
15416
  this._userGroupColumn(column, this._groupColumns.length);
14836
15417
  if (this._groupColumns.includes(column)) {
14837
- this.#announce(formatMessage(this.#translation.groupedAnnouncement, { column: column.label ?? '' }));
15418
+ this.#announce(formatMessage(this.#translation.groupedAnnouncement, { column: columnText(column) }));
14838
15419
  }
14839
15420
  this.#focusPending = true;
14840
15421
  break;
@@ -14897,7 +15478,7 @@ let DataGrid = class DataGrid extends LitElement {
14897
15478
  }
14898
15479
  const translation = this.#translation;
14899
15480
  const message = fixed === 'start' ? translation.columnFixedStartAnnouncement : fixed === 'end' ? translation.columnFixedEndAnnouncement : translation.columnUnfixedAnnouncement;
14900
- this.#announce(formatMessage(message, { column: column.label ?? '' }));
15481
+ this.#announce(formatMessage(message, { column: columnText(column) }));
14901
15482
  }
14902
15483
  #runGroupPanelMenuItem(name, column) {
14903
15484
  const menu = this.#contextMenu;
@@ -14924,7 +15505,7 @@ let DataGrid = class DataGrid extends LitElement {
14924
15505
  case 'ungroupColumn':
14925
15506
  if (column && this._groupColumns.includes(column)) {
14926
15507
  this.#moveColumnTo(false, column, this._regularColumns.length, 'user');
14927
- this.#announce(formatMessage(this.#translation.ungroupedAnnouncement, { column: column.label ?? '' }));
15508
+ this.#announce(formatMessage(this.#translation.ungroupedAnnouncement, { column: columnText(column) }));
14928
15509
  }
14929
15510
  break;
14930
15511
  case 'ungroupAll':
@@ -15279,7 +15860,7 @@ let DataGrid = class DataGrid extends LitElement {
15279
15860
  if (!this._canDropColumn(column, target)) {
15280
15861
  // Recusado (fixa × livre, outra banda): pelo teclado, diz por que nada mudou (WCAG 4.1.3).
15281
15862
  if (keyboard) {
15282
- this.#announce(formatMessage(this.#translation.columnMoveRefusedAnnouncement, { column: column.label ?? '', target: target.label ?? '' }));
15863
+ this.#announce(formatMessage(this.#translation.columnMoveRefusedAnnouncement, { column: columnText(column), target: columnText(target) }));
15283
15864
  }
15284
15865
  return false;
15285
15866
  }
@@ -15292,7 +15873,7 @@ let DataGrid = class DataGrid extends LitElement {
15292
15873
  const listed = orderedSiblings(this._regularColumns, this.#columnTree, this._parentBandOf(column) ?? null)
15293
15874
  .filter(sibling => sibling.showInChooser !== false);
15294
15875
  this.#announce(formatMessage(this.#translation.columnMovedAnnouncement, {
15295
- column: column.label ?? '',
15876
+ column: columnText(column),
15296
15877
  position: String(listed.indexOf(column) + 1),
15297
15878
  count: String(listed.length),
15298
15879
  }));
@@ -15344,6 +15925,12 @@ __decorate([
15344
15925
  __decorate([
15345
15926
  property({ attribute: false })
15346
15927
  ], DataGrid.prototype, "noDataRenderer", void 0);
15928
+ __decorate([
15929
+ property({ type: Boolean, converter: booleanAttribute(false) })
15930
+ ], DataGrid.prototype, "loading", void 0);
15931
+ __decorate([
15932
+ property({ type: Boolean, converter: booleanAttribute(false), attribute: 'header-wrap' })
15933
+ ], DataGrid.prototype, "headerWrap", void 0);
15347
15934
  __decorate([
15348
15935
  property({ attribute: false })
15349
15936
  ], DataGrid.prototype, "detailRenderer", void 0);
@@ -15416,6 +16003,12 @@ __decorate([
15416
16003
  __decorate([
15417
16004
  property({ attribute: 'scroll-mode' })
15418
16005
  ], DataGrid.prototype, "scrollMode", void 0);
16006
+ __decorate([
16007
+ property({ attribute: 'scroll-container' })
16008
+ ], DataGrid.prototype, "scrollContainer", void 0);
16009
+ __decorate([
16010
+ property({ attribute: false })
16011
+ ], DataGrid.prototype, "scrollContainerElement", void 0);
15419
16012
  __decorate([
15420
16013
  property({ attribute: false })
15421
16014
  ], DataGrid.prototype, "items", null);