@universal-material/data-grid 0.1.0 → 0.2.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 (37) hide show
  1. package/README.md +37 -20
  2. package/custom-elements.json +35 -7
  3. package/dist/export/types.d.ts +1 -1
  4. package/dist/export/types.js.map +1 -1
  5. package/dist/features/column-chooser.js +3 -2
  6. package/dist/features/column-chooser.js.map +1 -1
  7. package/dist/features/filter-row.js +4 -3
  8. package/dist/features/filter-row.js.map +1 -1
  9. package/dist/features/header-filter.d.ts +5 -1
  10. package/dist/features/header-filter.js +15 -6
  11. package/dist/features/header-filter.js.map +1 -1
  12. package/dist/features/scroll-port.d.ts +51 -0
  13. package/dist/features/scroll-port.js +329 -0
  14. package/dist/features/scroll-port.js.map +1 -0
  15. package/dist/grid-column-def.d.ts +16 -4
  16. package/dist/grid-column-def.js.map +1 -1
  17. package/dist/grid-column.d.ts +8 -2
  18. package/dist/grid-column.js +8 -2
  19. package/dist/grid-column.js.map +1 -1
  20. package/dist/grid.d.ts +30 -4
  21. package/dist/grid.js +505 -112
  22. package/dist/grid.js.map +1 -1
  23. package/dist/grid.min.js +592 -484
  24. package/dist/grid.styles.js +111 -9
  25. package/dist/grid.styles.js.map +1 -1
  26. package/dist/render/group-row.js +2 -1
  27. package/dist/render/group-row.js.map +1 -1
  28. package/dist/render/header.d.ts +17 -1
  29. package/dist/render/header.js +23 -2
  30. package/dist/render/header.js.map +1 -1
  31. package/dist/render/virtualizer.d.ts +49 -1
  32. package/dist/render/virtualizer.js +229 -17
  33. package/dist/render/virtualizer.js.map +1 -1
  34. package/dist/row-model/columns.d.ts +22 -0
  35. package/dist/row-model/columns.js +15 -0
  36. package/dist/row-model/columns.js.map +1 -1
  37. package/package.json +7 -3
package/README.md CHANGED
@@ -1,7 +1,8 @@
1
1
  # `<u-grid>` — @universal-material/data-grid
2
2
 
3
3
  [![npm](https://img.shields.io/npm/v/@universal-material/data-grid)](https://www.npmjs.com/package/@universal-material/data-grid)
4
- [![license](https://img.shields.io/npm/l/@universal-material/data-grid)](https://github.com/universal-material/data-grid/blob/main/LICENSE)
4
+ [![license](https://img.shields.io/npm/l/@universal-material/data-grid)](https://github.com/erichideyuki/universal-data-grid/blob/main/LICENSE)
5
+ [![sponsor](https://img.shields.io/github/sponsors/erichideyuki?label=Sponsor&logo=GitHub)](https://github.com/sponsors/erichideyuki)
5
6
 
6
7
  **A fast, accessible data grid as a standard Web Component.** `<u-grid>` is built with
7
8
  [Lit](https://lit.dev) and belongs to the [Universal Material](https://universal-material.github.io/)
@@ -9,10 +10,10 @@ family. Because it is a native custom element, it works the same in plain HTML,
9
10
  Vue or Svelte.
10
11
 
11
12
  **[Live documentation and examples →](https://universal-material.github.io/data-grid/)**
12
- &nbsp;·&nbsp; [Full API reference](https://github.com/universal-material/data-grid/blob/main/API.md)
13
- &nbsp;·&nbsp; [GitHub](https://github.com/universal-material/data-grid)
13
+ &nbsp;·&nbsp; [Full API reference](https://github.com/erichideyuki/universal-data-grid/blob/main/API.md)
14
+ &nbsp;·&nbsp; [GitHub](https://github.com/erichideyuki/universal-data-grid)
14
15
 
15
- ![A <u-grid> grouped by year](https://raw.githubusercontent.com/universal-material/data-grid/main/.github/readme/overview.webp)
16
+ ![Grouping by dragging a column header into the group panel](https://raw.githubusercontent.com/erichideyuki/universal-data-grid/main/.github/readme/grouping.gif)
16
17
 
17
18
  ---
18
19
 
@@ -20,7 +21,8 @@ Vue or Svelte.
20
21
 
21
22
  - **Millions of rows.** Its own row virtualization renders only the visible rows. Sorting,
22
23
  grouping and expanding don't add per-row work, and the scroll range scales past the browser's
23
- maximum element height. Hundreds of columns can be virtualized as well.
24
+ maximum element height. Hundreds of columns can be virtualized as well, and the grid can scroll
25
+ with the page or a parent panel (`scroll-container`) and still virtualize both.
24
26
  - **Remote data.** A `dataSource` whose server filters, sorts, groups, summarizes and pages. Only the
25
27
  visible blocks load, with skeleton rows, a pager or infinite scrolling, a load panel and "Retry".
26
28
  - **Shape the data.** Multi-column sorting, a filter row, a search panel, header filters, grouping by
@@ -45,6 +47,16 @@ Vue or Svelte.
45
47
  responsive auto-hide, a toolbar and context menus, state persistence, and export to CSV, Excel
46
48
  and tagged PDF.
47
49
 
50
+ ## See it in action
51
+
52
+ | A million rows | Search and filter |
53
+ | --- | --- |
54
+ | ![Scrolling through a million rows, then grouping them by country](https://raw.githubusercontent.com/erichideyuki/universal-data-grid/main/.github/readme/big-data.gif) | ![Typing in the search panel highlights matches, ignoring case and accents](https://raw.githubusercontent.com/erichideyuki/universal-data-grid/main/.github/readme/filtering.gif) |
55
+ | **Real-time updates** | **Batch editing** |
56
+ | ![A stock ticker updating prices many times per second](https://raw.githubusercontent.com/erichideyuki/universal-data-grid/main/.github/readme/real-time.gif) | ![Editing cells in batch mode; changed cells stay marked until saved](https://raw.githubusercontent.com/erichideyuki/universal-data-grid/main/.github/readme/editing.gif) |
57
+
58
+ Every GIF is recorded from the [live documentation](https://universal-material.github.io/data-grid/), where you can try each feature yourself.
59
+
48
60
  ## Install
49
61
 
50
62
  ```bash
@@ -52,7 +64,7 @@ npm i @universal-material/data-grid
52
64
  ```
53
65
 
54
66
  The package is modern ESM with TypeScript declarations and a
55
- [custom elements manifest](https://github.com/custom-elements-manifest/custom-elements-manifest).
67
+ [custom elements manifest](https://github.com/webcomponents/custom-elements-manifest).
56
68
  `lit`, `@lit/context` and `interactjs` are regular dependencies, so your bundler shares them with
57
69
  the rest of your app. Importing the package registers `<u-grid>` as a side effect.
58
70
 
@@ -67,7 +79,7 @@ A self-contained bundle (Lit included) is published for CDNs. An import map lets
67
79
  <script type="importmap">
68
80
  {
69
81
  "imports": {
70
- "@universal-material/data-grid": "https://cdn.jsdelivr.net/npm/@universal-material/data-grid@0.1/dist/grid.min.js"
82
+ "@universal-material/data-grid": "https://cdn.jsdelivr.net/npm/@universal-material/data-grid@0.2/dist/grid.min.js"
71
83
  }
72
84
  }
73
85
  </script>
@@ -91,7 +103,8 @@ A self-contained bundle (Lit included) is published for CDNs. An import map lets
91
103
  ```
92
104
 
93
105
  > **Give the grid a height.** It fills its container (`height: 100%`), so the grid or its parent
94
- > needs a defined height for the scroll area.
106
+ > needs a defined height for the scroll area — unless it scrolls with the page or a parent
107
+ > ([`scroll-container`](https://github.com/erichideyuki/universal-data-grid/blob/main/API.md#scrolling-with-the-page-or-a-parent)).
95
108
 
96
109
  ### Lit
97
110
 
@@ -124,24 +137,24 @@ export class OrderList extends LitElement {
124
137
  Set `columns`, `items` and other objects as **properties** (not attributes), and listen to the
125
138
  `u-grid-*` events: `[columns]` in Angular (with `CUSTOM_ELEMENTS_SCHEMA`), `columns={…}` in
126
139
  React 19+, and `:columns.prop` in Vue. Import the package before the first render. Details are in
127
- [Using with frameworks](https://github.com/universal-material/data-grid/blob/main/API.md#using-with-frameworks).
140
+ [Using with frameworks](https://github.com/erichideyuki/universal-data-grid/blob/main/API.md#using-with-frameworks).
128
141
 
129
142
  ## Documentation
130
143
 
131
144
  - **[Live docs](https://universal-material.github.io/data-grid/)** have one runnable example per
132
145
  feature, with its source code.
133
- - **[API.md](https://github.com/universal-material/data-grid/blob/main/API.md)** is the complete
146
+ - **[API.md](https://github.com/erichideyuki/universal-data-grid/blob/main/API.md)** is the complete
134
147
  guide and reference: every property, attribute, method, event, type, CSS custom property and
135
148
  part, by feature. Popular sections:
136
- [columns](https://github.com/universal-material/data-grid/blob/main/API.md#defining-columns),
137
- [data sources and paging](https://github.com/universal-material/data-grid/blob/main/API.md#data-sources-keys--paging),
138
- [real-time changes](https://github.com/universal-material/data-grid/blob/main/API.md#refreshing-and-incremental-changes),
139
- [editing](https://github.com/universal-material/data-grid/blob/main/API.md#editing),
140
- [i18n](https://github.com/universal-material/data-grid/blob/main/API.md#internationalization-i18n),
141
- [accessibility](https://github.com/universal-material/data-grid/blob/main/API.md#accessibility),
142
- [theming](https://github.com/universal-material/data-grid/blob/main/API.md#theming),
143
- [SSR](https://github.com/universal-material/data-grid/blob/main/API.md#server-side-rendering) and the
144
- [API tables](https://github.com/universal-material/data-grid/blob/main/API.md#api-reference).
149
+ [columns](https://github.com/erichideyuki/universal-data-grid/blob/main/API.md#defining-columns),
150
+ [data sources and paging](https://github.com/erichideyuki/universal-data-grid/blob/main/API.md#data-sources-keys--paging),
151
+ [real-time changes](https://github.com/erichideyuki/universal-data-grid/blob/main/API.md#refreshing-and-incremental-changes),
152
+ [editing](https://github.com/erichideyuki/universal-data-grid/blob/main/API.md#editing),
153
+ [i18n](https://github.com/erichideyuki/universal-data-grid/blob/main/API.md#internationalization-i18n),
154
+ [accessibility](https://github.com/erichideyuki/universal-data-grid/blob/main/API.md#accessibility),
155
+ [theming](https://github.com/erichideyuki/universal-data-grid/blob/main/API.md#theming),
156
+ [SSR](https://github.com/erichideyuki/universal-data-grid/blob/main/API.md#server-side-rendering) and the
157
+ [API tables](https://github.com/erichideyuki/universal-data-grid/blob/main/API.md#api-reference).
145
158
  - `@universal-material/data-grid/custom-elements.json` describes the elements for IDEs and
146
159
  tooling.
147
160
 
@@ -151,6 +164,10 @@ Current evergreen browsers: Chrome and Edge 114+, Firefox 125+, and Safari 17+.
151
164
  ES2022, the Popover API and modern CSS (`color-mix()`, `:has()`). Internet Explorer and legacy
152
165
  Edge are not supported.
153
166
 
167
+ ## Sponsor
168
+
169
+ If `<u-grid>` helps you, consider [sponsoring its development on GitHub](https://github.com/sponsors/erichideyuki).
170
+
154
171
  ## License
155
172
 
156
- [MIT](https://github.com/universal-material/data-grid/blob/main/LICENSE) © Eric Kono
173
+ [MIT](https://github.com/erichideyuki/universal-data-grid/blob/main/LICENSE) © Eric Kono
@@ -73,15 +73,15 @@
73
73
  "name": "--u-grid-header-cell-font-weight"
74
74
  },
75
75
  {
76
- "description": "Data cell padding. Default `13px 16px`.",
76
+ "description": "Data cell padding (shorthand; wins over the longhands). Default `13px 16px`.",
77
77
  "name": "--u-grid-cell-padding"
78
78
  },
79
79
  {
80
- "description": "Block padding of data and header cells. Default `13px`.",
80
+ "description": "Block padding of data and header cells; wins over the old `--u-table-cell-padding` and `--u-grid-data-cell-padding`. Default `13px`.",
81
81
  "name": "--u-grid-cell-block-padding"
82
82
  },
83
83
  {
84
- "description": "Inline padding of data and header cells. Default `16px`.",
84
+ "description": "Inline padding of data and header cells; wins over the old `--u-table-cell-padding` and `--u-grid-data-cell-padding`. Default `16px`.",
85
85
  "name": "--u-grid-cell-inline-padding"
86
86
  },
87
87
  {
@@ -920,6 +920,25 @@
920
920
  "description": "`virtual` (default): every row is in the scroll range and a remote\nsource loads the visible blocks. `infinite`: the next block loads when\nthe end is reached (remote paging only; with `paging` the pager wins).",
921
921
  "attribute": "scroll-mode"
922
922
  },
923
+ {
924
+ "kind": "field",
925
+ "name": "scrollContainer",
926
+ "type": {
927
+ "text": "string | null"
928
+ },
929
+ "default": "null",
930
+ "description": "Scrolls the grid with an outer container instead of its own scrollbar:\nthe id of an ANCESTOR of the grid (the first ancestor with this id,\ncrossing shadow boundaries, unlike IDREF attributes), or `window` for\nthe page (wins over an element with `id=\"window\"`). The grid grows to\nits content (do not give it a height), the container scrolls in both\ndirections, and rows and columns are still virtualized by the visible\npart of the container; toolbar, headers, totals, fixed rows and columns\nstick to it. The container's `scroll-padding-top`/`-bottom` offsets\nwhat the page sticks there (an app bar). `<html>` (or the\n`document.scrollingElement`) means the window; `<body>` only when it is\nthe scrolling element. Not found, not an ancestor or empty: a console\nwarning and the grid's own scrolling. An element between the grid and\nthe container that clips or scrolls (`overflow` other than\n`visible`/`clip`) also warns: sticky headers would stick to it. Resolved when\nthe grid connects and when this changes (changing the ancestor's id\nlater does not re-resolve). The attribute alone renders the outer mode\non the server.",
931
+ "attribute": "scroll-container"
932
+ },
933
+ {
934
+ "kind": "field",
935
+ "name": "scrollContainerElement",
936
+ "type": {
937
+ "text": "HTMLElement | Window | null"
938
+ },
939
+ "default": "null",
940
+ "description": "The outer scroll container by reference (wins over `scrollContainer`):\nan ancestor element, or `window`. `document.documentElement` (or the\n`document.scrollingElement`) means the window. See `scrollContainer`."
941
+ },
923
942
  {
924
943
  "kind": "field",
925
944
  "name": "items",
@@ -962,7 +981,7 @@
962
981
  "text": "number"
963
982
  },
964
983
  "default": "48",
965
- "description": "Row height in px (rows with `wrap` columns can grow).",
984
+ "description": "Row height in px, padding included (rows with `wrap` columns or taller content grow; the virtualizer measures them).",
966
985
  "attribute": "row-height"
967
986
  },
968
987
  {
@@ -2970,6 +2989,15 @@
2970
2989
  "description": "`virtual` (default): every row is in the scroll range and a remote\nsource loads the visible blocks. `infinite`: the next block loads when\nthe end is reached (remote paging only; with `paging` the pager wins).",
2971
2990
  "fieldName": "scrollMode"
2972
2991
  },
2992
+ {
2993
+ "name": "scroll-container",
2994
+ "type": {
2995
+ "text": "string | null"
2996
+ },
2997
+ "default": "null",
2998
+ "description": "Scrolls the grid with an outer container instead of its own scrollbar:\nthe id of an ANCESTOR of the grid (the first ancestor with this id,\ncrossing shadow boundaries, unlike IDREF attributes), or `window` for\nthe page (wins over an element with `id=\"window\"`). The grid grows to\nits content (do not give it a height), the container scrolls in both\ndirections, and rows and columns are still virtualized by the visible\npart of the container; toolbar, headers, totals, fixed rows and columns\nstick to it. The container's `scroll-padding-top`/`-bottom` offsets\nwhat the page sticks there (an app bar). `<html>` (or the\n`document.scrollingElement`) means the window; `<body>` only when it is\nthe scrolling element. Not found, not an ancestor or empty: a console\nwarning and the grid's own scrolling. An element between the grid and\nthe container that clips or scrolls (`overflow` other than\n`visible`/`clip`) also warns: sticky headers would stick to it. Resolved when\nthe grid connects and when this changes (changing the ancestor's id\nlater does not re-resolve). The attribute alone renders the outer mode\non the server.",
2999
+ "fieldName": "scrollContainer"
3000
+ },
2973
3001
  {
2974
3002
  "name": "sort-mode",
2975
3003
  "type": {
@@ -2993,7 +3021,7 @@
2993
3021
  "text": "number"
2994
3022
  },
2995
3023
  "default": "48",
2996
- "description": "Row height in px (rows with `wrap` columns can grow).",
3024
+ "description": "Row height in px, padding included (rows with `wrap` columns or taller content grow; the virtualizer measures them).",
2997
3025
  "fieldName": "rowHeight"
2998
3026
  },
2999
3027
  {
@@ -3955,7 +3983,7 @@
3955
3983
  "text": "GridHeaderRenderer | null"
3956
3984
  },
3957
3985
  "default": "null",
3958
- "description": "Builds the header label (property only); sort arrow, filter button and resize handle stay."
3986
+ "description": "Builds the header label (property only); sort arrow, filter button and resize handle stay. Keep\nthe text content: it still names the column outside the header (menus, chooser, announcements, export)."
3959
3987
  },
3960
3988
  {
3961
3989
  "kind": "field",
@@ -4263,7 +4291,7 @@
4263
4291
  "type": {
4264
4292
  "text": "string"
4265
4293
  },
4266
- "description": "Header label: the trimmed text content of the element, without the text of nested columns.",
4294
+ "description": "Header label: the trimmed text content of the element, without the text of nested columns. Also\nthe column's name outside the header. Empty: the header shows `path`; elsewhere `path`, then `name`, as is.",
4267
4295
  "readonly": true
4268
4296
  }
4269
4297
  ],
@@ -57,7 +57,7 @@ export interface GridCsvDownloadOptions extends GridCsvOptions {
57
57
  /** An exported column (`GridExportData.columns`). */
58
58
  export interface GridExportColumn<TItem = any> {
59
59
  column: GridColumnDef<TItem>;
60
- /** Header text. */
60
+ /** The column's name as text: `label`, else `path`, else `name`. */
61
61
  label: string;
62
62
  /** Effective data type (declared or inferred). */
63
63
  dataType?: GridColumnDataType;
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/export/types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n GridColumnAlignment,\n GridColumnDataType,\n GridColumnDef,\n GridGroupPath,\n GridRowFixed,\n GridSummaryValue,\n} from '../grid-column-def.js';\nimport type { DataGrid } from '../grid.js';\n\n/** Options of `getExportData()`, `exportCsv()`, `downloadCsv()` and the xlsx and PDF adapters. */\nexport interface GridExportOptions {\n /**\n * Only the selected rows, in the current order and filter (not in the\n * selection order of `getSelectedItems()`); group counts and summaries are\n * computed over them. Default `false`.\n */\n selectedOnly?: boolean;\n /**\n * Group rows (`rowType: 'group'`) and indentation levels. `false` exports a\n * flat list in the current order with the grouped columns first. Default `true`.\n */\n includeGroups?: boolean;\n /** Group footers and totals (`group-footer` / `total` rows) and summaries in group rows. Default `true`. */\n includeSummaries?: boolean;\n /**\n * Fixed rows (`fixedTopItems` before the body rows, `fixedBottomItems`\n * before the totals; `rowType: 'data'` with `fixed`, `level: 0`).\n * Default `true`; `selectedOnly: true` leaves them out.\n */\n includeFixedRows?: boolean;\n /** Aborts the export: the promise rejects with an `AbortError` (the PDF adapter: with `signal.reason`). */\n signal?: AbortSignal | null;\n}\n\n/** Options of `exportCsv()`. */\nexport interface GridCsvOptions extends GridExportOptions {\n /**\n * Field separator: one character other than `\"`, CR and LF (a `RangeError`\n * otherwise). `auto` (default): `;` when the grid\n * language uses a decimal comma (what Excel expects there), `,` otherwise.\n */\n separator?: 'auto' | (string & {});\n /** UTF-8 byte order mark, so Excel opens the file as UTF-8. Default `true`. */\n bom?: boolean;\n /** First line with the column labels. Default `true`. */\n includeHeaders?: boolean;\n /**\n * Prefixes `'` to text starting with `=`, `+`, `-`, `@`, tab or CR, which a\n * spreadsheet would run as a formula (CSV injection). Numbers are not\n * prefixed. Default `true`.\n */\n escapeFormulas?: boolean;\n /**\n * Cell values instead of the displayed text: numbers with `.`, dates in\n * ISO 8601, booleans `true`/`false`, empty values as empty fields. Group\n * labels and summaries stay text. Default `false`.\n */\n rawValues?: boolean;\n}\n\n/** Options of `downloadCsv()`. */\nexport interface GridCsvDownloadOptions extends GridCsvOptions {\n /** Name of the downloaded file. Default `export.csv`. */\n fileName?: string;\n}\n\n/** An exported column (`GridExportData.columns`). */\nexport interface GridExportColumn<TItem = any> {\n column: GridColumnDef<TItem>;\n /** Header text. */\n label: string;\n /** Effective data type (declared or inferred). */\n dataType?: GridColumnDataType;\n /** Effective logical alignment. */\n alignment: GridColumnAlignment;\n /** Current width in px, when known. */\n width?: number;\n}\n\n/** A data row. `values[i]` / `texts[i]` belong to `columns[i]`. */\nexport interface GridExportDataRow<TItem = any> {\n rowType: 'data';\n /** Indentation level: the number of grouping levels above the row (0 without groups), or the depth of a tree node (0 = root; kept with `includeGroups: false`). */\n level: number;\n item: TItem;\n /** Cell values (`valueGetter` or `path`). */\n values: unknown[];\n /** Displayed texts (`displayValue` / `format`). */\n texts: string[];\n /** `'top'`/`'bottom'` for a fixed row (`fixedTopItems`/`fixedBottomItems`), `null` for a body row. */\n fixed: GridRowFixed;\n}\n\n/**\n * A group row. `summaries[i]` / `texts[i]` are the summaries shown under `columns[i]`\n * (`display: 'column'`); those of the first column, or of a column not exported, are part of `label`.\n */\nexport interface GridExportGroupRow<TItem = any> {\n rowType: 'group';\n /** Grouping level (0 = outermost). */\n level: number;\n groupPath: GridGroupPath;\n /** Grouped column. */\n column: GridColumnDef<TItem>;\n /** Group value. */\n value: unknown;\n /** Formatted group value (`\"Brazil\"`). */\n text: string;\n /** Whole group label with the count and inline summaries (`\"Country: Brazil (3)\"`). */\n label: string;\n /** Rows in the group. */\n itemCount: number;\n summaries: GridSummaryValue<TItem>[][];\n /** Summary texts of each column, joined with the list separator of the language as on screen. */\n texts: string[];\n}\n\n/** A group footer or the totals row. `summaries[i]` / `texts[i]` belong to `columns[i]`. */\nexport interface GridExportSummaryRow<TItem = any> {\n rowType: 'group-footer' | 'total';\n /** Indentation level: a group footer is at the level of its rows; totals at 0. */\n level: number;\n /** Group of the footer; `null` in the totals row. */\n groupPath: GridGroupPath | null;\n summaries: GridSummaryValue<TItem>[][];\n texts: string[];\n}\n\n/** A row of `GridExportData`, told apart by `rowType`. */\nexport type GridExportRow<TItem = any> = GridExportDataRow<TItem> | GridExportGroupRow<TItem> | GridExportSummaryRow<TItem>;\n\n/** What `getExportData()` returns: the columns and rows the user sees, ready for any file format. */\nexport interface GridExportData<TItem = any> {\n /** Visible exportable columns in the current order (with `includeGroups: false`, the grouped columns first). */\n columns: GridExportColumn<TItem>[];\n rows: GridExportRow<TItem>[];\n}\n\n/** Formats offered by the export UI (`exportFormats`). May gain members in minor versions. */\nexport type GridExportFormat = 'csv' | 'xlsx' | 'pdf';\n\n/** Progress of an export (`onProgress`): data rows done, data rows in total, pages so far (PDF). */\nexport interface GridExportProgress {\n readonly rowCount: number;\n readonly totalCount: number;\n readonly pageCount: number;\n}\n\n/**\n * An export run by the grid UI (`xlsxExporter`, `pdfExporter`): build and\n * download the file of what the user sees. Reject to report an error; honor\n * `signal` (aborted when the grid disconnects or the user cancels: reject with\n * an `AbortError`, which the grid reports as canceled, not as an error); call\n * `onProgress` to show the progress in the export button.\n */\nexport type GridExporter = (\n grid: DataGrid,\n options: {\n readonly selectedOnly: boolean;\n readonly signal: AbortSignal;\n readonly onProgress?: (progress: GridExportProgress) => void;\n },\n) => Promise<void>;\n\n/** `detail` of `u-grid-exporting` and `u-grid-export`. */\nexport interface GridExportingEventDetail {\n readonly format: GridExportFormat;\n /** Only the selected rows (\"Export selected rows\"). */\n readonly selectedOnly: boolean;\n}\n\n/** `detail` of `u-grid-export`. */\nexport type GridExportEventDetail = GridExportingEventDetail;\n\n/** `detail` of `u-grid-export-error`. */\nexport interface GridExportErrorEventDetail extends GridExportingEventDetail {\n readonly error: unknown;\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/export/types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n GridColumnAlignment,\n GridColumnDataType,\n GridColumnDef,\n GridGroupPath,\n GridRowFixed,\n GridSummaryValue,\n} from '../grid-column-def.js';\nimport type { DataGrid } from '../grid.js';\n\n/** Options of `getExportData()`, `exportCsv()`, `downloadCsv()` and the xlsx and PDF adapters. */\nexport interface GridExportOptions {\n /**\n * Only the selected rows, in the current order and filter (not in the\n * selection order of `getSelectedItems()`); group counts and summaries are\n * computed over them. Default `false`.\n */\n selectedOnly?: boolean;\n /**\n * Group rows (`rowType: 'group'`) and indentation levels. `false` exports a\n * flat list in the current order with the grouped columns first. Default `true`.\n */\n includeGroups?: boolean;\n /** Group footers and totals (`group-footer` / `total` rows) and summaries in group rows. Default `true`. */\n includeSummaries?: boolean;\n /**\n * Fixed rows (`fixedTopItems` before the body rows, `fixedBottomItems`\n * before the totals; `rowType: 'data'` with `fixed`, `level: 0`).\n * Default `true`; `selectedOnly: true` leaves them out.\n */\n includeFixedRows?: boolean;\n /** Aborts the export: the promise rejects with an `AbortError` (the PDF adapter: with `signal.reason`). */\n signal?: AbortSignal | null;\n}\n\n/** Options of `exportCsv()`. */\nexport interface GridCsvOptions extends GridExportOptions {\n /**\n * Field separator: one character other than `\"`, CR and LF (a `RangeError`\n * otherwise). `auto` (default): `;` when the grid\n * language uses a decimal comma (what Excel expects there), `,` otherwise.\n */\n separator?: 'auto' | (string & {});\n /** UTF-8 byte order mark, so Excel opens the file as UTF-8. Default `true`. */\n bom?: boolean;\n /** First line with the column labels. Default `true`. */\n includeHeaders?: boolean;\n /**\n * Prefixes `'` to text starting with `=`, `+`, `-`, `@`, tab or CR, which a\n * spreadsheet would run as a formula (CSV injection). Numbers are not\n * prefixed. Default `true`.\n */\n escapeFormulas?: boolean;\n /**\n * Cell values instead of the displayed text: numbers with `.`, dates in\n * ISO 8601, booleans `true`/`false`, empty values as empty fields. Group\n * labels and summaries stay text. Default `false`.\n */\n rawValues?: boolean;\n}\n\n/** Options of `downloadCsv()`. */\nexport interface GridCsvDownloadOptions extends GridCsvOptions {\n /** Name of the downloaded file. Default `export.csv`. */\n fileName?: string;\n}\n\n/** An exported column (`GridExportData.columns`). */\nexport interface GridExportColumn<TItem = any> {\n column: GridColumnDef<TItem>;\n /** The column's name as text: `label`, else `path`, else `name`. */\n label: string;\n /** Effective data type (declared or inferred). */\n dataType?: GridColumnDataType;\n /** Effective logical alignment. */\n alignment: GridColumnAlignment;\n /** Current width in px, when known. */\n width?: number;\n}\n\n/** A data row. `values[i]` / `texts[i]` belong to `columns[i]`. */\nexport interface GridExportDataRow<TItem = any> {\n rowType: 'data';\n /** Indentation level: the number of grouping levels above the row (0 without groups), or the depth of a tree node (0 = root; kept with `includeGroups: false`). */\n level: number;\n item: TItem;\n /** Cell values (`valueGetter` or `path`). */\n values: unknown[];\n /** Displayed texts (`displayValue` / `format`). */\n texts: string[];\n /** `'top'`/`'bottom'` for a fixed row (`fixedTopItems`/`fixedBottomItems`), `null` for a body row. */\n fixed: GridRowFixed;\n}\n\n/**\n * A group row. `summaries[i]` / `texts[i]` are the summaries shown under `columns[i]`\n * (`display: 'column'`); those of the first column, or of a column not exported, are part of `label`.\n */\nexport interface GridExportGroupRow<TItem = any> {\n rowType: 'group';\n /** Grouping level (0 = outermost). */\n level: number;\n groupPath: GridGroupPath;\n /** Grouped column. */\n column: GridColumnDef<TItem>;\n /** Group value. */\n value: unknown;\n /** Formatted group value (`\"Brazil\"`). */\n text: string;\n /** Whole group label with the count and inline summaries (`\"Country: Brazil (3)\"`). */\n label: string;\n /** Rows in the group. */\n itemCount: number;\n summaries: GridSummaryValue<TItem>[][];\n /** Summary texts of each column, joined with the list separator of the language as on screen. */\n texts: string[];\n}\n\n/** A group footer or the totals row. `summaries[i]` / `texts[i]` belong to `columns[i]`. */\nexport interface GridExportSummaryRow<TItem = any> {\n rowType: 'group-footer' | 'total';\n /** Indentation level: a group footer is at the level of its rows; totals at 0. */\n level: number;\n /** Group of the footer; `null` in the totals row. */\n groupPath: GridGroupPath | null;\n summaries: GridSummaryValue<TItem>[][];\n texts: string[];\n}\n\n/** A row of `GridExportData`, told apart by `rowType`. */\nexport type GridExportRow<TItem = any> = GridExportDataRow<TItem> | GridExportGroupRow<TItem> | GridExportSummaryRow<TItem>;\n\n/** What `getExportData()` returns: the columns and rows the user sees, ready for any file format. */\nexport interface GridExportData<TItem = any> {\n /** Visible exportable columns in the current order (with `includeGroups: false`, the grouped columns first). */\n columns: GridExportColumn<TItem>[];\n rows: GridExportRow<TItem>[];\n}\n\n/** Formats offered by the export UI (`exportFormats`). May gain members in minor versions. */\nexport type GridExportFormat = 'csv' | 'xlsx' | 'pdf';\n\n/** Progress of an export (`onProgress`): data rows done, data rows in total, pages so far (PDF). */\nexport interface GridExportProgress {\n readonly rowCount: number;\n readonly totalCount: number;\n readonly pageCount: number;\n}\n\n/**\n * An export run by the grid UI (`xlsxExporter`, `pdfExporter`): build and\n * download the file of what the user sees. Reject to report an error; honor\n * `signal` (aborted when the grid disconnects or the user cancels: reject with\n * an `AbortError`, which the grid reports as canceled, not as an error); call\n * `onProgress` to show the progress in the export button.\n */\nexport type GridExporter = (\n grid: DataGrid,\n options: {\n readonly selectedOnly: boolean;\n readonly signal: AbortSignal;\n readonly onProgress?: (progress: GridExportProgress) => void;\n },\n) => Promise<void>;\n\n/** `detail` of `u-grid-exporting` and `u-grid-export`. */\nexport interface GridExportingEventDetail {\n readonly format: GridExportFormat;\n /** Only the selected rows (\"Export selected rows\"). */\n readonly selectedOnly: boolean;\n}\n\n/** `detail` of `u-grid-export`. */\nexport type GridExportEventDetail = GridExportingEventDetail;\n\n/** `detail` of `u-grid-export-error`. */\nexport interface GridExportErrorEventDetail extends GridExportingEventDetail {\n readonly error: unknown;\n}\n"]}
@@ -3,6 +3,7 @@ import { ifDefined } from 'lit/directives/if-defined.js';
3
3
  import { live } from 'lit/directives/live.js';
4
4
  import { repeat } from 'lit/directives/repeat.js';
5
5
  import interact from 'interactjs';
6
+ import { columnText } from '../row-model/columns.js';
6
7
  import { InteractRegistry } from './drag-helper.js';
7
8
  import { formatMessage } from './sorting.js';
8
9
  /** Texto comparável da busca: sem diacríticos, sem caixa. */
@@ -16,7 +17,7 @@ export const filterChooserItems = (items, search) => {
16
17
  return items;
17
18
  }
18
19
  return items.flatMap(item => {
19
- if (fold(item.column.label ?? '').includes(query)) {
20
+ if (fold(columnText(item.column)).includes(query)) {
20
21
  return [item];
21
22
  }
22
23
  const children = item.children ? filterChooserItems(item.children, search) : [];
@@ -78,7 +79,7 @@ const renderChooserItems = (items, context) => {
78
79
  }
79
80
  }}
80
81
  @change=${(event) => onVisibleChange(item.column, event.target.checked)}>
81
- <span id="column-chooser-label-${item.id}">${item.column.label ?? ''}</span>
82
+ <span id="column-chooser-label-${item.id}">${columnText(item.column)}</span>
82
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AK,CAAC,EAAE,CAAC;oBACtC,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;gBACrC,CAAC;YACH,CAAC;YAED,WAAW,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,aAAa,CAAC;YACxD,gBAAgB,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,aAAa,CAAC;YAE7D,MAAM,EAAE,CAAC,KAAgB,EAAE,EAAE;gBAC3B,MAAM,MAAM,GAAG,IAAI,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC;gBAEjD,IAAI,MAAM,EAAE,CAAC;oBACX,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;gBAC5C,CAAC;YACH,CAAC;SACF,CAAC,CAAC;IACL,CAAC;IAED,qBAAqB,CAAC,KAAgB;QACpC,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,MAAqB,CAAC,CAAC;QACtF,OAAO,MAAM,IAAI,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;IAC5E,CAAC;CACF;AAED,mDAAmD;AACnD,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,WAAqB,EAAE,KAAa,EAAU,EAAE,CACxF,aAAa,CAAC,WAAW,CAAC,+BAA+B,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC","sourcesContent":["import { html, nothing, type ReactiveController, type ReactiveControllerHost, type TemplateResult } from 'lit';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { live } from 'lit/directives/live.js';\nimport { repeat } from 'lit/directives/repeat.js';\n\nimport type { DropEvent } from '@interactjs/actions/drop/DropEvent';\nimport interact from 'interactjs';\n\nimport type { GridColumnDef } from '../grid-column-def.js';\nimport type { GridI18n } from '../grid-i18n.js';\nimport { InteractRegistry } from './drag-helper.js';\nimport { formatMessage } from './sorting.js';\n\n/**\n * Seletor de colunas (como o do AG Grid): `dialog` não modal com busca,\n * \"Mostrar todas\" (caixa nativa com `.indeterminate`) e a lista de caixas\n * nativas (`ul`, não `listbox`). Reordenar: alça de arrasto por item (só\n * ponteiro, `aria-hidden`) e Alt+Shift+↑/↓ na caixa focada. Fixar saiu\n * daqui: vai pelo menu do cabeçalho (coluna oculta só fixa depois de\n * mostrada, como no AG Grid).\n */\n\nexport interface ColumnChooserHost extends ReactiveControllerHost {\n readonly renderRoot: HTMLElement | DocumentFragment;\n readonly _nativeColumnMap: WeakMap<HTMLElement, GridColumnDef>;\n _isRtl(): boolean;\n /** Oculta a coluna (se não for a última visível); devolve se ocultou. */\n _userSetVisible(column: GridColumnDef, visible: boolean): boolean;\n _isRegularColumn(column: GridColumnDef): boolean;\n}\n\nexport interface ColumnChooserItem {\n column: GridColumnDef;\n id: number;\n /** Estado efetivo (banda oculta = desmarcada); na banda, todas as colunas visíveis. */\n visible: boolean;\n /** Banda com só parte das colunas visíveis (caixa mista, frente 13). */\n indeterminate?: boolean;\n /** `false` na última coluna visível (não pode ser ocultada). */\n canToggle: boolean;\n /** Colunas da banda, numa lista aninhada. */\n children?: ColumnChooserItem[];\n /** Oculta por falta de espaço (spec 21; banda: todas as folhas visíveis): dica sob o rótulo. */\n adaptive?: boolean;\n}\n\nexport interface ColumnChooserContext {\n items: ColumnChooserItem[];\n translation: GridI18n;\n /** Texto da busca (o controlador guarda). */\n search: string;\n onSearch: (text: string) => void;\n onVisibleChange: (column: GridColumnDef, visible: boolean) => void;\n /** \"Mostrar todas\": aplica a todas as colunas listadas (as achadas pela busca). */\n onVisibleChangeAll: (columns: GridColumnDef[], visible: boolean) => void;\n /** Mover `column` para antes/depois de `target` (irmã listada); devolve se moveu. */\n onMove: (column: GridColumnDef, target: GridColumnDef, after: boolean, keyboard: boolean) => boolean;\n /** Começo do arrasto pela alça. */\n onDragStart: (event: PointerEvent, column: GridColumnDef) => void;\n onKeyDown: (event: KeyboardEvent) => void;\n /** Tab para fora do painel fecha (não modal; spec 17). */\n onFocusOut?: (event: FocusEvent) => void;\n}\n\n/** Texto comparável da busca: sem diacríticos, sem caixa. */\nconst fold = (text: string): string => text.normalize('NFD').replace(/\\p{M}/gu, '')\n .toLowerCase()\n .trim();\n\n/** Itens que batem com a busca: a banda que bate leva todas as colunas; senão, só as filhas que batem. */\nexport const filterChooserItems = (items: ColumnChooserItem[], search: string): ColumnChooserItem[] => {\n const query = fold(search);\n\n if (!query) {\n return items;\n }\n\n return items.flatMap(item => {\n if (fold(item.column.label ?? '').includes(query)) {\n return [item];\n }\n\n const children = item.children ? filterChooserItems(item.children, search) : [];\n return children.length ? [{ ...item, children }] : [];\n });\n};\n\n/** Quantas entradas (bandas e colunas) a lista mostra. */\nexport const countChooserItems = (items: ColumnChooserItem[]): number =>\n items.reduce((count, item) => count + 1 + (item.children ? countChooserItems(item.children) : 0), 0);\n\nconst dragHandle = html`\n <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"1em\" width=\"1em\" viewBox=\"0 0 24 24\" fill=\"currentColor\" aria-hidden=\"true\">\n <circle cx=\"9\" cy=\"6\" r=\"1.6\"/><circle cx=\"15\" cy=\"6\" r=\"1.6\"/><circle cx=\"9\" cy=\"12\" r=\"1.6\"/><circle cx=\"15\" cy=\"12\" r=\"1.6\"/><circle cx=\"9\" cy=\"18\" r=\"1.6\"/><circle cx=\"15\" cy=\"18\" r=\"1.6\"/>\n </svg>`;\n\nexport const columnChooserIcon = html`\n <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"1em\" width=\"1em\" viewBox=\"0 0 24 24\" fill=\"currentColor\" fill-rule=\"evenodd\" aria-hidden=\"true\">\n <path d=\"M3 5h18v14H3zM5 7v10h3.5V7zm5.5 0v10h3V7zm5 0v10H19V7z\"/>\n </svg>`;\n\nconst REORDER_HINT_ID = 'column-chooser-reorder-hint';\n\n/**\n * Itens do seletor; a banda leva a caixa nativa tri-state (o clique segue a\n * APG: misto → todas visíveis → banda oculta) e as colunas numa lista\n * aninhada com o rótulo da banda.\n */\nconst renderChooserItems = (items: ColumnChooserItem[], context: ColumnChooserContext): TemplateResult => {\n const { translation, onVisibleChange, onMove, onDragStart } = context;\n // Mover só faz sentido com uma irmã listada.\n const movable = items.length > 1;\n\n return html`${repeat(items, item => item.id, (item, index) => {\n const describedBy = [\n ...item.adaptive ? [`column-chooser-title-${item.id}`, `column-chooser-hint-${item.id}`] : [],\n ...movable ? [REORDER_HINT_ID] : [],\n ].join(' ');\n\n return html`\n <li class=\"column-chooser-item ${item.children ? 'column-chooser-band' : ''} ${item.adaptive ? 'column-chooser-adaptive' : ''}\" data-column-id=${item.id}>\n <div class=\"column-chooser-row\">\n ${movable\n ? html`<span\n class=\"column-chooser-drag-handle\"\n aria-hidden=\"true\"\n @pointerdown=${(event: PointerEvent) => onDragStart(event, item.column)}>${dragHandle}</span>`\n : nothing}\n <label class=\"column-chooser-check\">\n <input\n type=\"checkbox\"\n .checked=${live(item.visible)}\n .indeterminate=${live(!!item.indeterminate)}\n ?disabled=${!item.canToggle}\n title=${item.visible ? translation.hideColumn : translation.showColumn}\n aria-describedby=${ifDefined(describedBy || undefined)}\n aria-keyshortcuts=${ifDefined(movable ? 'Alt+Shift+ArrowUp Alt+Shift+ArrowDown' : undefined)}\n @keydown=${(event: KeyboardEvent) => {\n const up = event.key === 'ArrowUp';\n\n if (!movable || !event.altKey || !event.shiftKey || event.ctrlKey || event.metaKey || (!up && event.key !== 'ArrowDown')) {\n return;\n }\n\n event.preventDefault();\n const target = items[index + (up ? -1 : 1)];\n\n if (target) {\n onMove(item.column, target.column, !up, true);\n }\n }}\n @change=${(event: Event) => onVisibleChange(item.column, (event.target as HTMLInputElement).checked)}>\n <span id=\"column-chooser-label-${item.id}\">${item.column.label ?? ''}</span>\n </label>\n </div>\n ${item.adaptive\n // A descrição que o `title` dava (\"Hide column\") continua, junto da dica.\n ? html`<span hidden id=\"column-chooser-title-${item.id}\">${item.visible ? translation.hideColumn : translation.showColumn}</span><span\n class=\"column-chooser-hint\"\n id=\"column-chooser-hint-${item.id}\">${translation.adaptiveColumnDescription}</span>`\n : nothing}\n ${item.children?.length\n ? html`<ul class=\"column-chooser-list column-chooser-nested\" aria-labelledby=\"column-chooser-label-${item.id}\">${renderChooserItems(item.children, context)}</ul>`\n : nothing}\n </li>`;\n })}`;\n};\n\n/** Estado da caixa \"Mostrar todas\" sobre as entradas de cima listadas. */\nconst allState = (items: ColumnChooserItem[]): { checked: boolean; indeterminate: boolean } => {\n const visible = items.filter(item => item.visible).length;\n const mixed = items.some(item => item.indeterminate);\n\n return { checked: visible === items.length && !mixed, indeterminate: mixed || (visible > 0 && visible < items.length) };\n};\n\n/** Painel do seletor de colunas (popover leve, sem dependência nova). */\nexport const renderColumnChooser = (context: ColumnChooserContext): TemplateResult => {\n const { items, translation, search, onSearch, onVisibleChangeAll, onKeyDown, onFocusOut } = context;\n const shown = filterChooserItems(items, search);\n const all = allState(shown);\n\n return html`\n <div\n class=\"column-chooser\"\n part=\"column-chooser\"\n .popover=${'manual'}\n role=\"dialog\"\n aria-label=${translation.columnChooser}\n @keydown=${onKeyDown}\n @focusout=${onFocusOut}>\n <div class=\"column-chooser-title\" aria-hidden=\"true\">${translation.columnChooser}</div>\n <input\n class=\"column-chooser-search\"\n type=\"search\"\n autocomplete=\"off\"\n .value=${live(search)}\n aria-label=${translation.columnChooserSearchLabel}\n placeholder=${translation.columnChooserSearchLabel}\n @input=${(event: Event) => onSearch((event.target as HTMLInputElement).value)}>\n ${shown.length\n ? html`<label class=\"column-chooser-check column-chooser-all\">\n <input\n type=\"checkbox\"\n .checked=${live(all.checked)}\n .indeterminate=${live(all.indeterminate)}\n @change=${(event: Event) => onVisibleChangeAll(shown.map(item => item.column), (event.target as HTMLInputElement).checked)}>\n <span>${translation.selectAllColumns}</span>\n </label>`\n : nothing}\n <ul class=\"column-chooser-list\">${renderChooserItems(shown, context)}</ul>\n <span hidden id=${REORDER_HINT_ID}>${translation.reorderColumnLabel}</span>\n <div class=\"column-chooser-drop-hint\" aria-hidden=\"true\">${translation.hideColumn}</div>\n </div>`;\n};\n\n/** Espera da busca antes de anunciar quantas colunas achou. */\nconst SEARCH_ANNOUNCE_MS = 500;\n\ninterface ChooserDrag {\n column: GridColumnDef;\n /** Solta: `column` antes/depois do item `targetId` (`data-column-id`). */\n onDrop: (targetId: string, after: boolean) => void;\n handle: HTMLElement;\n pointerId: number;\n /** Item sob o ponteiro e o lado (antes/depois). */\n target: { li: HTMLElement; after: boolean } | null;\n}\n\n/**\n * Abrir/fechar o seletor: posição junto ao botão (espelhada em RTL), foco na\n * busca, Esc e clique fora fecham. Com o painel aberto, soltar nele um\n * cabeçalho arrastado oculta a coluna. A busca anuncia a contagem (com\n * espera) e o arrasto pela alça reordena; timer e listeners do arrasto saem\n * ao fechar e no `hostDisconnected` (spec 14).\n */\nexport class ColumnChooserController implements ReactiveController {\n readonly #host: ColumnChooserHost;\n readonly #dropzones = new InteractRegistry();\n #open = false;\n #shown = false;\n #restoreFocus = false;\n /** Caixa focada no painel antes do render (reordenar move o item focado no `repeat`). */\n #focused: { labelId: string } | null = null;\n #anchor: HTMLElement | null = null;\n #search = '';\n #searchTimer: ReturnType<typeof setTimeout> | undefined;\n #drag: ChooserDrag | null = null;\n\n constructor(host: ColumnChooserHost) {\n this.#host = host;\n host.addController(this);\n }\n\n /** Painéis registrados no interactjs (diagnóstico de memória). */\n get dropzones(): number {\n return this.#dropzones.size;\n }\n\n /** Timer do anúncio da busca e arrasto em curso (diagnóstico de memória). */\n get timers(): number {\n return (this.#searchTimer === undefined ? 0 : 1) + (this.#drag ? 1 : 0);\n }\n\n get open(): boolean {\n return this.#open;\n }\n\n get search(): string {\n return this.#search;\n }\n\n /** Abre; `anchor` = quem abriu (o botão da barra, o \"mais\" ou a célula do cabeçalho). */\n show(anchor: HTMLElement | null = null): void {\n if (this.#open) {\n return;\n }\n\n this.#anchor = anchor;\n this.#open = true;\n this.#shown = false;\n this.#search = '';\n this.#host.requestUpdate();\n }\n\n hide(restoreFocus = false): void {\n if (!this.#open) {\n return;\n }\n\n this.#open = false;\n this.#restoreFocus = restoreFocus;\n this.#clearSearchTimer();\n this.#endDrag();\n this.#panel?.hidePopover?.();\n document.removeEventListener('pointerdown', this.#outsidePointerDown, true);\n this.#host.requestUpdate();\n }\n\n toggle(anchor: HTMLElement | null = null): void {\n if (this.#open) {\n this.hide(true);\n } else {\n this.show(anchor);\n }\n }\n\n /** Texto da busca mudou: filtra já e, depois da espera, `announce` diz a contagem (região viva do grid). */\n setSearch(text: string, announce: () => void): void {\n this.#search = text;\n this.#host.requestUpdate();\n this.#clearSearchTimer();\n this.#searchTimer = setTimeout(() => {\n this.#searchTimer = undefined;\n\n if (this.#open) {\n announce();\n }\n }, SEARCH_ANNOUNCE_MS);\n }\n\n readonly onKeyDown = (event: KeyboardEvent): void => {\n if (event.key === 'Escape') {\n event.preventDefault();\n event.stopPropagation();\n\n // Arrasto em curso: Esc só desiste dele.\n if (this.#drag) {\n this.#endDrag();\n return;\n }\n\n this.hide(true);\n }\n };\n\n /** O foco saiu do painel para outro lugar (Tab, Shift+Tab): fecha sem roubar o foco. */\n readonly onFocusOut = (event: FocusEvent): void => {\n const next = event.relatedTarget;\n\n // Sem destino: elemento movido/removido pelo render ou clique fora (tratado no pointerdown).\n if (!(next instanceof Node) || this.#panel?.contains(next) || this.#button?.contains(next)) {\n return;\n }\n\n this.hide();\n };\n\n get #panel(): HTMLElement | null {\n return this.#host.renderRoot.querySelector<HTMLElement>('.column-chooser');\n }\n\n hostUpdate(): void {\n const root = this.#host.renderRoot as ShadowRoot;\n const active = root.activeElement as HTMLElement | null;\n const labelId = active && this.#panel?.contains(active) && active.closest('.column-chooser-item')\n ? active.closest('li')?.querySelector('[id^=\"column-chooser-label-\"]')?.id\n : undefined;\n\n this.#focused = labelId ? { labelId } : null;\n }\n\n /** Quem abriu (ou o botão do seletor na barra): âncora da posição e destino do foco ao fechar. */\n get #button(): HTMLElement | null {\n return (this.#anchor?.isConnected ? this.#anchor : null)\n ?? this.#host.renderRoot.querySelector<HTMLElement>('.column-chooser-button')\n ?? this.#host.renderRoot.querySelector<HTMLElement>('.toolbar-more-button');\n }\n\n hostUpdated(): void {\n this.#dropzones.prune();\n\n const focused = this.#focused;\n this.#focused = null;\n\n if (this.#open && focused && !(this.#host.renderRoot as ShadowRoot).activeElement) {\n this.#host.renderRoot.querySelector(`#${focused.labelId}`)?.closest('li')\n ?.querySelector<HTMLElement>('input')\n ?.focus();\n }\n\n if (!this.#open) {\n if (this.#restoreFocus) {\n this.#restoreFocus = false;\n this.#button?.focus();\n }\n\n return;\n }\n\n const panel = this.#panel;\n\n if (!panel || this.#shown) {\n return;\n }\n\n this.#shown = true;\n\n if (typeof panel.showPopover === 'function' && !panel.matches(':popover-open')) {\n panel.showPopover();\n }\n\n this.#position(panel);\n this.#attachDropzone(panel);\n document.addEventListener('pointerdown', this.#outsidePointerDown, true);\n panel.querySelector<HTMLElement>('.column-chooser-search, input:not([disabled]), button')?.focus();\n }\n\n hostDisconnected(): void {\n this.#anchor = null;\n this.#dropzones.clear();\n this.#clearSearchTimer();\n this.#endDrag();\n document.removeEventListener('pointerdown', this.#outsidePointerDown, true);\n this.#open = false;\n this.#shown = false;\n }\n\n #clearSearchTimer(): void {\n clearTimeout(this.#searchTimer);\n this.#searchTimer = undefined;\n }\n\n // -------------------------------------------- arrasto pela alça (reordenar)\n\n /** `pointerdown` na alça: captura o ponteiro e acompanha até soltar. */\n readonly startDrag = (event: PointerEvent, column: GridColumnDef, onDrop: (targetId: string, after: boolean) => void): void => {\n if (event.button !== 0 || !event.isPrimary) {\n return;\n }\n\n event.preventDefault();\n this.#endDrag();\n const handle = event.currentTarget as HTMLElement;\n this.#drag = { column, onDrop, handle, pointerId: event.pointerId, target: null };\n\n try {\n handle.setPointerCapture?.(event.pointerId);\n } catch {\n // Ponteiro que já não está ativo (sintético): segue sem captura.\n }\n\n handle.closest('li')?.classList.add('dragging');\n handle.addEventListener('pointermove', this.#onDragMove);\n handle.addEventListener('pointerup', this.#onDragEnd);\n handle.addEventListener('pointercancel', this.#onDragCancel);\n handle.addEventListener('lostpointercapture', this.#onDragCancel);\n };\n\n readonly #onDragMove = (event: PointerEvent): void => {\n const drag = this.#drag;\n\n if (drag?.pointerId !== event.pointerId) {\n return;\n }\n\n const source = drag.handle.closest('li');\n const list = source?.parentElement;\n // Só entre as irmãs da mesma lista (a coluna de banda não sai dela).\n const siblings = [...list?.children ?? []].filter((child): child is HTMLElement => child instanceof HTMLElement && child.tagName === 'LI');\n let target: ChooserDrag['target'] = null;\n\n for (const li of siblings) {\n const rect = li.getBoundingClientRect();\n\n if (event.clientY < rect.bottom || li === siblings[siblings.length - 1]) {\n target = li === source ? null : { li, after: event.clientY > rect.top + rect.height / 2 };\n break;\n }\n }\n\n this.#markTarget(target);\n };\n\n readonly #onDragEnd = (event: PointerEvent): void => {\n const drag = this.#drag;\n\n if (drag?.pointerId !== event.pointerId) {\n return;\n }\n\n const target = drag.target;\n const id = target?.li.getAttribute('data-column-id') ?? undefined;\n this.#endDrag();\n\n if (target && id !== undefined) {\n drag.onDrop(id, target.after);\n }\n };\n\n readonly #onDragCancel = (): void => {\n this.#endDrag();\n };\n\n #markTarget(target: ChooserDrag['target']): void {\n const drag = this.#drag;\n\n if (!drag) {\n return;\n }\n\n drag.target?.li.classList.remove('drop-before', 'drop-after');\n drag.target = target;\n target?.li.classList.add(target.after ? 'drop-after' : 'drop-before');\n }\n\n #endDrag(): void {\n const drag = this.#drag;\n\n if (!drag) {\n return;\n }\n\n this.#drag = null;\n drag.target?.li.classList.remove('drop-before', 'drop-after');\n drag.handle.closest('li')?.classList.remove('dragging');\n drag.handle.removeEventListener('pointermove', this.#onDragMove);\n drag.handle.removeEventListener('pointerup', this.#onDragEnd);\n drag.handle.removeEventListener('pointercancel', this.#onDragCancel);\n drag.handle.removeEventListener('lostpointercapture', this.#onDragCancel);\n\n if (drag.handle.hasPointerCapture?.(drag.pointerId)) {\n drag.handle.releasePointerCapture(drag.pointerId);\n }\n }\n\n #position(panel: HTMLElement): void {\n const anchor = this.#button ?? (this.#host as unknown as HTMLElement);\n const rect = anchor.getBoundingClientRect();\n const width = panel.offsetWidth;\n const height = panel.offsetHeight;\n const margin = 8;\n const viewport = document.documentElement.clientWidth;\n const viewportHeight = document.documentElement.clientHeight;\n // Alinha pela borda final de quem abriu: direita em LTR, esquerda em RTL.\n const left = this.#host._isRtl() ? rect.left : rect.right - width;\n const top = rect.bottom + 4;\n\n panel.style.top = `${Math.round(Math.max(margin, Math.min(top, viewportHeight - height - margin)))}px`;\n panel.style.left = `${Math.round(Math.max(margin, Math.min(left, viewport - width - margin)))}px`;\n }\n\n readonly #outsidePointerDown = (event: PointerEvent): void => {\n const path = event.composedPath();\n const keep = path.some(target =>\n target instanceof HTMLElement\n && (target.classList.contains('column-chooser')\n || target.classList.contains('column-chooser-button')\n || target === this.#anchor\n // Arrastar um cabeçalho até o painel não pode fechá-lo.\n || ((target.classList.contains('header-column') || target.classList.contains('band-header')) && this.#host.renderRoot.contains(target))));\n\n if (!keep) {\n this.hide();\n }\n };\n\n #attachDropzone(panel: HTMLElement): void {\n if (!this.#dropzones.add(panel)) {\n return;\n }\n\n interact(panel).dropzone({\n accept: '.move-container',\n\n ondragenter: (event: DropEvent) => {\n if (this.#draggedRegularColumn(event)) {\n panel.classList.add('drop-target');\n }\n },\n\n ondragleave: () => panel.classList.remove('drop-target'),\n ondropdeactivate: () => panel.classList.remove('drop-target'),\n\n ondrop: (event: DropEvent) => {\n const column = this.#draggedRegularColumn(event);\n\n if (column) {\n this.#host._userSetVisible(column, false);\n }\n },\n });\n }\n\n #draggedRegularColumn(event: DropEvent): GridColumnDef | undefined {\n const column = this.#host._nativeColumnMap.get(event.draggable.target as HTMLElement);\n return column && this.#host._isRegularColumn(column) ? column : undefined;\n }\n}\n\n/** Texto da contagem da busca (o grid anuncia). */\nexport const chooserSearchAnnouncement = (translation: GridI18n, count: number): string =>\n formatMessage(translation.columnChooserSearchAnnouncement, { count: String(count) });\n"]}
1
+ {"version":3,"file":"column-chooser.js","sourceRoot":"","sources":["../../src/features/column-chooser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAA6E,MAAM,KAAK,CAAC;AAC/G,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAGlD,OAAO,QAAQ,MAAM,YAAY,CAAC;AAIlC,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAqD7C,6DAA6D;AAC7D,MAAM,IAAI,GAAG,CAAC,IAAY,EAAU,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC;KAChF,WAAW,EAAE;KACb,IAAI,EAAE,CAAC;AAEV,0GAA0G;AAC1G,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,KAA0B,EAAE,MAAc,EAAuB,EAAE;IACpG,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC;IAE3B,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;QAC1B,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;YAClD,OAAO,CAAC,IAAI,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 'lit';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { live } from 'lit/directives/live.js';\nimport { repeat } from 'lit/directives/repeat.js';\n\nimport type { DropEvent } from '@interactjs/actions/drop/DropEvent';\nimport interact from 'interactjs';\n\nimport type { GridColumnDef } from '../grid-column-def.js';\nimport type { GridI18n } from '../grid-i18n.js';\nimport { columnText } from '../row-model/columns.js';\nimport { InteractRegistry } from './drag-helper.js';\nimport { formatMessage } from './sorting.js';\n\n/**\n * Seletor de colunas (como o do AG Grid): `dialog` não modal com busca,\n * \"Mostrar todas\" (caixa nativa com `.indeterminate`) e a lista de caixas\n * nativas (`ul`, não `listbox`). Reordenar: alça de arrasto por item (só\n * ponteiro, `aria-hidden`) e Alt+Shift+↑/↓ na caixa focada. Fixar saiu\n * daqui: vai pelo menu do cabeçalho (coluna oculta só fixa depois de\n * mostrada, como no AG Grid).\n */\n\nexport interface ColumnChooserHost extends ReactiveControllerHost {\n readonly renderRoot: HTMLElement | DocumentFragment;\n readonly _nativeColumnMap: WeakMap<HTMLElement, GridColumnDef>;\n _isRtl(): boolean;\n /** Oculta a coluna (se não for a última visível); devolve se ocultou. */\n _userSetVisible(column: GridColumnDef, visible: boolean): boolean;\n _isRegularColumn(column: GridColumnDef): boolean;\n}\n\nexport interface ColumnChooserItem {\n column: GridColumnDef;\n id: number;\n /** Estado efetivo (banda oculta = desmarcada); na banda, todas as colunas visíveis. */\n visible: boolean;\n /** Banda com só parte das colunas visíveis (caixa mista, frente 13). */\n indeterminate?: boolean;\n /** `false` na última coluna visível (não pode ser ocultada). */\n canToggle: boolean;\n /** Colunas da banda, numa lista aninhada. */\n children?: ColumnChooserItem[];\n /** Oculta por falta de espaço (spec 21; banda: todas as folhas visíveis): dica sob o rótulo. */\n adaptive?: boolean;\n}\n\nexport interface ColumnChooserContext {\n items: ColumnChooserItem[];\n translation: GridI18n;\n /** Texto da busca (o controlador guarda). */\n search: string;\n onSearch: (text: string) => void;\n onVisibleChange: (column: GridColumnDef, visible: boolean) => void;\n /** \"Mostrar todas\": aplica a todas as colunas listadas (as achadas pela busca). */\n onVisibleChangeAll: (columns: GridColumnDef[], visible: boolean) => void;\n /** Mover `column` para antes/depois de `target` (irmã listada); devolve se moveu. */\n onMove: (column: GridColumnDef, target: GridColumnDef, after: boolean, keyboard: boolean) => boolean;\n /** Começo do arrasto pela alça. */\n onDragStart: (event: PointerEvent, column: GridColumnDef) => void;\n onKeyDown: (event: KeyboardEvent) => void;\n /** Tab para fora do painel fecha (não modal; spec 17). */\n onFocusOut?: (event: FocusEvent) => void;\n}\n\n/** Texto comparável da busca: sem diacríticos, sem caixa. */\nconst fold = (text: string): string => text.normalize('NFD').replace(/\\p{M}/gu, '')\n .toLowerCase()\n .trim();\n\n/** Itens que batem com a busca: a banda que bate leva todas as colunas; senão, só as filhas que batem. */\nexport const filterChooserItems = (items: ColumnChooserItem[], search: string): ColumnChooserItem[] => {\n const query = fold(search);\n\n if (!query) {\n return items;\n }\n\n return items.flatMap(item => {\n if (fold(columnText(item.column)).includes(query)) {\n return [item];\n }\n\n const children = item.children ? filterChooserItems(item.children, search) : [];\n return children.length ? [{ ...item, children }] : [];\n });\n};\n\n/** Quantas entradas (bandas e colunas) a lista mostra. */\nexport const countChooserItems = (items: ColumnChooserItem[]): number =>\n items.reduce((count, item) => count + 1 + (item.children ? countChooserItems(item.children) : 0), 0);\n\nconst dragHandle = html`\n <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"1em\" width=\"1em\" viewBox=\"0 0 24 24\" fill=\"currentColor\" aria-hidden=\"true\">\n <circle cx=\"9\" cy=\"6\" r=\"1.6\"/><circle cx=\"15\" cy=\"6\" r=\"1.6\"/><circle cx=\"9\" cy=\"12\" r=\"1.6\"/><circle cx=\"15\" cy=\"12\" r=\"1.6\"/><circle cx=\"9\" cy=\"18\" r=\"1.6\"/><circle cx=\"15\" cy=\"18\" r=\"1.6\"/>\n </svg>`;\n\nexport const columnChooserIcon = html`\n <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"1em\" width=\"1em\" viewBox=\"0 0 24 24\" fill=\"currentColor\" fill-rule=\"evenodd\" aria-hidden=\"true\">\n <path d=\"M3 5h18v14H3zM5 7v10h3.5V7zm5.5 0v10h3V7zm5 0v10H19V7z\"/>\n </svg>`;\n\nconst REORDER_HINT_ID = 'column-chooser-reorder-hint';\n\n/**\n * Itens do seletor; a banda leva a caixa nativa tri-state (o clique segue a\n * APG: misto → todas visíveis → banda oculta) e as colunas numa lista\n * aninhada com o rótulo da banda.\n */\nconst renderChooserItems = (items: ColumnChooserItem[], context: ColumnChooserContext): TemplateResult => {\n const { translation, onVisibleChange, onMove, onDragStart } = context;\n // Mover só faz sentido com uma irmã listada.\n const movable = items.length > 1;\n\n return html`${repeat(items, item => item.id, (item, index) => {\n const describedBy = [\n ...item.adaptive ? [`column-chooser-title-${item.id}`, `column-chooser-hint-${item.id}`] : [],\n ...movable ? [REORDER_HINT_ID] : [],\n ].join(' ');\n\n return html`\n <li class=\"column-chooser-item ${item.children ? 'column-chooser-band' : ''} ${item.adaptive ? 'column-chooser-adaptive' : ''}\" data-column-id=${item.id}>\n <div class=\"column-chooser-row\">\n ${movable\n ? html`<span\n class=\"column-chooser-drag-handle\"\n aria-hidden=\"true\"\n @pointerdown=${(event: PointerEvent) => onDragStart(event, item.column)}>${dragHandle}</span>`\n : nothing}\n <label class=\"column-chooser-check\">\n <input\n type=\"checkbox\"\n .checked=${live(item.visible)}\n .indeterminate=${live(!!item.indeterminate)}\n ?disabled=${!item.canToggle}\n title=${item.visible ? translation.hideColumn : translation.showColumn}\n aria-describedby=${ifDefined(describedBy || undefined)}\n aria-keyshortcuts=${ifDefined(movable ? 'Alt+Shift+ArrowUp Alt+Shift+ArrowDown' : undefined)}\n @keydown=${(event: KeyboardEvent) => {\n const up = event.key === 'ArrowUp';\n\n if (!movable || !event.altKey || !event.shiftKey || event.ctrlKey || event.metaKey || (!up && event.key !== 'ArrowDown')) {\n return;\n }\n\n event.preventDefault();\n const target = items[index + (up ? -1 : 1)];\n\n if (target) {\n onMove(item.column, target.column, !up, true);\n }\n }}\n @change=${(event: Event) => onVisibleChange(item.column, (event.target as HTMLInputElement).checked)}>\n <span id=\"column-chooser-label-${item.id}\">${columnText(item.column)}</span>\n </label>\n </div>\n ${item.adaptive\n // A descrição que o `title` dava (\"Hide column\") continua, junto da dica.\n ? html`<span hidden id=\"column-chooser-title-${item.id}\">${item.visible ? translation.hideColumn : translation.showColumn}</span><span\n class=\"column-chooser-hint\"\n id=\"column-chooser-hint-${item.id}\">${translation.adaptiveColumnDescription}</span>`\n : nothing}\n ${item.children?.length\n ? html`<ul class=\"column-chooser-list column-chooser-nested\" aria-labelledby=\"column-chooser-label-${item.id}\">${renderChooserItems(item.children, context)}</ul>`\n : nothing}\n </li>`;\n })}`;\n};\n\n/** Estado da caixa \"Mostrar todas\" sobre as entradas de cima listadas. */\nconst allState = (items: ColumnChooserItem[]): { checked: boolean; indeterminate: boolean } => {\n const visible = items.filter(item => item.visible).length;\n const mixed = items.some(item => item.indeterminate);\n\n return { checked: visible === items.length && !mixed, indeterminate: mixed || (visible > 0 && visible < items.length) };\n};\n\n/** Painel do seletor de colunas (popover leve, sem dependência nova). */\nexport const renderColumnChooser = (context: ColumnChooserContext): TemplateResult => {\n const { items, translation, search, onSearch, onVisibleChangeAll, onKeyDown, onFocusOut } = context;\n const shown = filterChooserItems(items, search);\n const all = allState(shown);\n\n return html`\n <div\n class=\"column-chooser\"\n part=\"column-chooser\"\n .popover=${'manual'}\n role=\"dialog\"\n aria-label=${translation.columnChooser}\n @keydown=${onKeyDown}\n @focusout=${onFocusOut}>\n <div class=\"column-chooser-title\" aria-hidden=\"true\">${translation.columnChooser}</div>\n <input\n class=\"column-chooser-search\"\n type=\"search\"\n autocomplete=\"off\"\n .value=${live(search)}\n aria-label=${translation.columnChooserSearchLabel}\n placeholder=${translation.columnChooserSearchLabel}\n @input=${(event: Event) => onSearch((event.target as HTMLInputElement).value)}>\n ${shown.length\n ? html`<label class=\"column-chooser-check column-chooser-all\">\n <input\n type=\"checkbox\"\n .checked=${live(all.checked)}\n .indeterminate=${live(all.indeterminate)}\n @change=${(event: Event) => onVisibleChangeAll(shown.map(item => item.column), (event.target as HTMLInputElement).checked)}>\n <span>${translation.selectAllColumns}</span>\n </label>`\n : nothing}\n <ul class=\"column-chooser-list\">${renderChooserItems(shown, context)}</ul>\n <span hidden id=${REORDER_HINT_ID}>${translation.reorderColumnLabel}</span>\n <div class=\"column-chooser-drop-hint\" aria-hidden=\"true\">${translation.hideColumn}</div>\n </div>`;\n};\n\n/** Espera da busca antes de anunciar quantas colunas achou. */\nconst SEARCH_ANNOUNCE_MS = 500;\n\ninterface ChooserDrag {\n column: GridColumnDef;\n /** Solta: `column` antes/depois do item `targetId` (`data-column-id`). */\n onDrop: (targetId: string, after: boolean) => void;\n handle: HTMLElement;\n pointerId: number;\n /** Item sob o ponteiro e o lado (antes/depois). */\n target: { li: HTMLElement; after: boolean } | null;\n}\n\n/**\n * Abrir/fechar o seletor: posição junto ao botão (espelhada em RTL), foco na\n * busca, Esc e clique fora fecham. Com o painel aberto, soltar nele um\n * cabeçalho arrastado oculta a coluna. A busca anuncia a contagem (com\n * espera) e o arrasto pela alça reordena; timer e listeners do arrasto saem\n * ao fechar e no `hostDisconnected` (spec 14).\n */\nexport class ColumnChooserController implements ReactiveController {\n readonly #host: ColumnChooserHost;\n readonly #dropzones = new InteractRegistry();\n #open = false;\n #shown = false;\n #restoreFocus = false;\n /** Caixa focada no painel antes do render (reordenar move o item focado no `repeat`). */\n #focused: { labelId: string } | null = null;\n #anchor: HTMLElement | null = null;\n #search = '';\n #searchTimer: ReturnType<typeof setTimeout> | undefined;\n #drag: ChooserDrag | null = null;\n\n constructor(host: ColumnChooserHost) {\n this.#host = host;\n host.addController(this);\n }\n\n /** Painéis registrados no interactjs (diagnóstico de memória). */\n get dropzones(): number {\n return this.#dropzones.size;\n }\n\n /** Timer do anúncio da busca e arrasto em curso (diagnóstico de memória). */\n get timers(): number {\n return (this.#searchTimer === undefined ? 0 : 1) + (this.#drag ? 1 : 0);\n }\n\n get open(): boolean {\n return this.#open;\n }\n\n get search(): string {\n return this.#search;\n }\n\n /** Abre; `anchor` = quem abriu (o botão da barra, o \"mais\" ou a célula do cabeçalho). */\n show(anchor: HTMLElement | null = null): void {\n if (this.#open) {\n return;\n }\n\n this.#anchor = anchor;\n this.#open = true;\n this.#shown = false;\n this.#search = '';\n this.#host.requestUpdate();\n }\n\n hide(restoreFocus = false): void {\n if (!this.#open) {\n return;\n }\n\n this.#open = false;\n this.#restoreFocus = restoreFocus;\n this.#clearSearchTimer();\n this.#endDrag();\n this.#panel?.hidePopover?.();\n document.removeEventListener('pointerdown', this.#outsidePointerDown, true);\n this.#host.requestUpdate();\n }\n\n toggle(anchor: HTMLElement | null = null): void {\n if (this.#open) {\n this.hide(true);\n } else {\n this.show(anchor);\n }\n }\n\n /** Texto da busca mudou: filtra já e, depois da espera, `announce` diz a contagem (região viva do grid). */\n setSearch(text: string, announce: () => void): void {\n this.#search = text;\n this.#host.requestUpdate();\n this.#clearSearchTimer();\n this.#searchTimer = setTimeout(() => {\n this.#searchTimer = undefined;\n\n if (this.#open) {\n announce();\n }\n }, SEARCH_ANNOUNCE_MS);\n }\n\n readonly onKeyDown = (event: KeyboardEvent): void => {\n if (event.key === 'Escape') {\n event.preventDefault();\n event.stopPropagation();\n\n // Arrasto em curso: Esc só desiste dele.\n if (this.#drag) {\n this.#endDrag();\n return;\n }\n\n this.hide(true);\n }\n };\n\n /** O foco saiu do painel para outro lugar (Tab, Shift+Tab): fecha sem roubar o foco. */\n readonly onFocusOut = (event: FocusEvent): void => {\n const next = event.relatedTarget;\n\n // Sem destino: elemento movido/removido pelo render ou clique fora (tratado no pointerdown).\n if (!(next instanceof Node) || this.#panel?.contains(next) || this.#button?.contains(next)) {\n return;\n }\n\n this.hide();\n };\n\n get #panel(): HTMLElement | null {\n return this.#host.renderRoot.querySelector<HTMLElement>('.column-chooser');\n }\n\n hostUpdate(): void {\n const root = this.#host.renderRoot as ShadowRoot;\n const active = root.activeElement as HTMLElement | null;\n const labelId = active && this.#panel?.contains(active) && active.closest('.column-chooser-item')\n ? active.closest('li')?.querySelector('[id^=\"column-chooser-label-\"]')?.id\n : undefined;\n\n this.#focused = labelId ? { labelId } : null;\n }\n\n /** Quem abriu (ou o botão do seletor na barra): âncora da posição e destino do foco ao fechar. */\n get #button(): HTMLElement | null {\n return (this.#anchor?.isConnected ? this.#anchor : null)\n ?? this.#host.renderRoot.querySelector<HTMLElement>('.column-chooser-button')\n ?? this.#host.renderRoot.querySelector<HTMLElement>('.toolbar-more-button');\n }\n\n hostUpdated(): void {\n this.#dropzones.prune();\n\n const focused = this.#focused;\n this.#focused = null;\n\n if (this.#open && focused && !(this.#host.renderRoot as ShadowRoot).activeElement) {\n this.#host.renderRoot.querySelector(`#${focused.labelId}`)?.closest('li')\n ?.querySelector<HTMLElement>('input')\n ?.focus();\n }\n\n if (!this.#open) {\n if (this.#restoreFocus) {\n this.#restoreFocus = false;\n this.#button?.focus();\n }\n\n return;\n }\n\n const panel = this.#panel;\n\n if (!panel || this.#shown) {\n return;\n }\n\n this.#shown = true;\n\n if (typeof panel.showPopover === 'function' && !panel.matches(':popover-open')) {\n panel.showPopover();\n }\n\n this.#position(panel);\n this.#attachDropzone(panel);\n document.addEventListener('pointerdown', this.#outsidePointerDown, true);\n panel.querySelector<HTMLElement>('.column-chooser-search, input:not([disabled]), button')?.focus();\n }\n\n hostDisconnected(): void {\n this.#anchor = null;\n this.#dropzones.clear();\n this.#clearSearchTimer();\n this.#endDrag();\n document.removeEventListener('pointerdown', this.#outsidePointerDown, true);\n this.#open = false;\n this.#shown = false;\n }\n\n #clearSearchTimer(): void {\n clearTimeout(this.#searchTimer);\n this.#searchTimer = undefined;\n }\n\n // -------------------------------------------- arrasto pela alça (reordenar)\n\n /** `pointerdown` na alça: captura o ponteiro e acompanha até soltar. */\n readonly startDrag = (event: PointerEvent, column: GridColumnDef, onDrop: (targetId: string, after: boolean) => void): void => {\n if (event.button !== 0 || !event.isPrimary) {\n return;\n }\n\n event.preventDefault();\n this.#endDrag();\n const handle = event.currentTarget as HTMLElement;\n this.#drag = { column, onDrop, handle, pointerId: event.pointerId, target: null };\n\n try {\n handle.setPointerCapture?.(event.pointerId);\n } catch {\n // Ponteiro que já não está ativo (sintético): segue sem captura.\n }\n\n handle.closest('li')?.classList.add('dragging');\n handle.addEventListener('pointermove', this.#onDragMove);\n handle.addEventListener('pointerup', this.#onDragEnd);\n handle.addEventListener('pointercancel', this.#onDragCancel);\n handle.addEventListener('lostpointercapture', this.#onDragCancel);\n };\n\n readonly #onDragMove = (event: PointerEvent): void => {\n const drag = this.#drag;\n\n if (drag?.pointerId !== event.pointerId) {\n return;\n }\n\n const source = drag.handle.closest('li');\n const list = source?.parentElement;\n // Só entre as irmãs da mesma lista (a coluna de banda não sai dela).\n const siblings = [...list?.children ?? []].filter((child): child is HTMLElement => child instanceof HTMLElement && child.tagName === 'LI');\n let target: ChooserDrag['target'] = null;\n\n for (const li of siblings) {\n const rect = li.getBoundingClientRect();\n\n if (event.clientY < rect.bottom || li === siblings[siblings.length - 1]) {\n target = li === source ? null : { li, after: event.clientY > rect.top + rect.height / 2 };\n break;\n }\n }\n\n this.#markTarget(target);\n };\n\n readonly #onDragEnd = (event: PointerEvent): void => {\n const drag = this.#drag;\n\n if (drag?.pointerId !== event.pointerId) {\n return;\n }\n\n const target = drag.target;\n const id = target?.li.getAttribute('data-column-id') ?? undefined;\n this.#endDrag();\n\n if (target && id !== undefined) {\n drag.onDrop(id, target.after);\n }\n };\n\n readonly #onDragCancel = (): void => {\n this.#endDrag();\n };\n\n #markTarget(target: ChooserDrag['target']): void {\n const drag = this.#drag;\n\n if (!drag) {\n return;\n }\n\n drag.target?.li.classList.remove('drop-before', 'drop-after');\n drag.target = target;\n target?.li.classList.add(target.after ? 'drop-after' : 'drop-before');\n }\n\n #endDrag(): void {\n const drag = this.#drag;\n\n if (!drag) {\n return;\n }\n\n this.#drag = null;\n drag.target?.li.classList.remove('drop-before', 'drop-after');\n drag.handle.closest('li')?.classList.remove('dragging');\n drag.handle.removeEventListener('pointermove', this.#onDragMove);\n drag.handle.removeEventListener('pointerup', this.#onDragEnd);\n drag.handle.removeEventListener('pointercancel', this.#onDragCancel);\n drag.handle.removeEventListener('lostpointercapture', this.#onDragCancel);\n\n if (drag.handle.hasPointerCapture?.(drag.pointerId)) {\n drag.handle.releasePointerCapture(drag.pointerId);\n }\n }\n\n #position(panel: HTMLElement): void {\n const anchor = this.#button ?? (this.#host as unknown as HTMLElement);\n const rect = anchor.getBoundingClientRect();\n const width = panel.offsetWidth;\n const height = panel.offsetHeight;\n const margin = 8;\n const viewport = document.documentElement.clientWidth;\n const viewportHeight = document.documentElement.clientHeight;\n // Alinha pela borda final de quem abriu: direita em LTR, esquerda em RTL.\n const left = this.#host._isRtl() ? rect.left : rect.right - width;\n const top = rect.bottom + 4;\n\n panel.style.top = `${Math.round(Math.max(margin, Math.min(top, viewportHeight - height - margin)))}px`;\n panel.style.left = `${Math.round(Math.max(margin, Math.min(left, viewport - width - margin)))}px`;\n }\n\n readonly #outsidePointerDown = (event: PointerEvent): void => {\n const path = event.composedPath();\n const keep = path.some(target =>\n target instanceof HTMLElement\n && (target.classList.contains('column-chooser')\n || target.classList.contains('column-chooser-button')\n || target === this.#anchor\n // Arrastar um cabeçalho até o painel não pode fechá-lo.\n || ((target.classList.contains('header-column') || target.classList.contains('band-header')) && this.#host.renderRoot.contains(target))));\n\n if (!keep) {\n this.hide();\n }\n };\n\n #attachDropzone(panel: HTMLElement): void {\n if (!this.#dropzones.add(panel)) {\n return;\n }\n\n interact(panel).dropzone({\n accept: '.move-container',\n\n ondragenter: (event: DropEvent) => {\n if (this.#draggedRegularColumn(event)) {\n panel.classList.add('drop-target');\n }\n },\n\n ondragleave: () => panel.classList.remove('drop-target'),\n ondropdeactivate: () => panel.classList.remove('drop-target'),\n\n ondrop: (event: DropEvent) => {\n const column = this.#draggedRegularColumn(event);\n\n if (column) {\n this.#host._userSetVisible(column, false);\n }\n },\n });\n }\n\n #draggedRegularColumn(event: DropEvent): GridColumnDef | undefined {\n const column = this.#host._nativeColumnMap.get(event.draggable.target as HTMLElement);\n return column && this.#host._isRegularColumn(column) ? column : undefined;\n }\n}\n\n/** Texto da contagem da busca (o grid anuncia). */\nexport const chooserSearchAnnouncement = (translation: GridI18n, count: number): string =>\n formatMessage(translation.columnChooserSearchAnnouncement, { count: String(count) });\n"]}
@@ -2,6 +2,7 @@ import { html, nothing } from 'lit';
2
2
  import { ifDefined } from 'lit/directives/if-defined.js';
3
3
  import { live } from 'lit/directives/live.js';
4
4
  import { map } from 'lit/directives/map.js';
5
+ import { columnText } from '../row-model/columns.js';
5
6
  import { findColumnCondition } from '../row-model/filter.js';
6
7
  import { toDate } from '../row-model/format.js';
7
8
  import { Debouncer, searchIcon } from './search.js';
@@ -399,7 +400,7 @@ export const renderFilterCell = ({ controller, column, dataType, filterable, tra
399
400
  const operation = controller.operationOf(column);
400
401
  const operations = operationsOf(column, dataType);
401
402
  const texts = controller.textsOf(column);
402
- const label = formatMessage(translation.filterEditorLabel, { column: column.label || column.path || '' });
403
+ const label = formatMessage(translation.filterEditorLabel, { column: columnText(column) });
403
404
  const isDate = dataType === 'date' || dataType === 'datetime';
404
405
  const editor = (index, ariaLabel) => html `
405
406
  <input
@@ -454,7 +455,7 @@ export const renderFilterCell = ({ controller, column, dataType, filterable, tra
454
455
  editors = editor(0, label);
455
456
  }
456
457
  const operationLabel = formatMessage(translation.filterOperationButtonLabel, {
457
- column: column.label || column.path || '',
458
+ column: columnText(column),
458
459
  operation: operationName(operation, translation),
459
460
  });
460
461
  return html `
@@ -488,7 +489,7 @@ export const renderFilterMenu = (controller, column, dataType, translation) => {
488
489
  class="filter-menu"
489
490
  .popover=${'manual'}
490
491
  role="menu"
491
- aria-label=${formatMessage(translation.filterEditorLabel, { column: column.label || column.path || '' })}
492
+ aria-label=${formatMessage(translation.filterEditorLabel, { column: columnText(column) })}
492
493
  @keydown=${controller.onMenuKeyDown}>
493
494
  ${map(['', 'true', 'false'], text => html `
494
495
  <button