@universal-material/data-grid 0.0.0-stage → 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 (237) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +172 -2
  3. package/custom-elements.json +4652 -0
  4. package/dist/attribute-converters.d.ts +53 -0
  5. package/dist/attribute-converters.js +98 -0
  6. package/dist/attribute-converters.js.map +1 -0
  7. package/dist/change-source.d.ts +3 -0
  8. package/dist/change-source.js +2 -0
  9. package/dist/change-source.js.map +1 -0
  10. package/dist/data/data-source.d.ts +164 -0
  11. package/dist/data/data-source.js +75 -0
  12. package/dist/data/data-source.js.map +1 -0
  13. package/dist/data/local-source.d.ts +20 -0
  14. package/dist/data/local-source.js +94 -0
  15. package/dist/data/local-source.js.map +1 -0
  16. package/dist/data/remote-loader.d.ts +190 -0
  17. package/dist/data/remote-loader.js +608 -0
  18. package/dist/data/remote-loader.js.map +1 -0
  19. package/dist/export/csv.d.ts +28 -0
  20. package/dist/export/csv.js +61 -0
  21. package/dist/export/csv.js.map +1 -0
  22. package/dist/export/download.d.ts +7 -0
  23. package/dist/export/download.js +17 -0
  24. package/dist/export/download.js.map +1 -0
  25. package/dist/export/rows.d.ts +75 -0
  26. package/dist/export/rows.js +134 -0
  27. package/dist/export/rows.js.map +1 -0
  28. package/dist/export/slice.d.ts +15 -0
  29. package/dist/export/slice.js +35 -0
  30. package/dist/export/slice.js.map +1 -0
  31. package/dist/export/types.d.ts +155 -0
  32. package/dist/export/types.js +2 -0
  33. package/dist/export/types.js.map +1 -0
  34. package/dist/export/write.d.ts +38 -0
  35. package/dist/export/write.js +178 -0
  36. package/dist/export/write.js.map +1 -0
  37. package/dist/export-pdf/client.d.ts +75 -0
  38. package/dist/export-pdf/client.js +155 -0
  39. package/dist/export-pdf/client.js.map +1 -0
  40. package/dist/export-pdf/engine.d.ts +73 -0
  41. package/dist/export-pdf/engine.js +131 -0
  42. package/dist/export-pdf/engine.js.map +1 -0
  43. package/dist/export-pdf/grid-pdf.wasm +0 -0
  44. package/dist/export-pdf/index.d.ts +27 -0
  45. package/dist/export-pdf/index.js +566 -0
  46. package/dist/export-pdf/index.js.map +1 -0
  47. package/dist/export-pdf/serialize.d.ts +23 -0
  48. package/dist/export-pdf/serialize.js +127 -0
  49. package/dist/export-pdf/serialize.js.map +1 -0
  50. package/dist/export-pdf/types.d.ts +150 -0
  51. package/dist/export-pdf/types.js +2 -0
  52. package/dist/export-pdf/types.js.map +1 -0
  53. package/dist/export-pdf/worker.d.ts +2 -0
  54. package/dist/export-pdf/worker.js +81 -0
  55. package/dist/export-pdf/worker.js.map +1 -0
  56. package/dist/export-xlsx/formats.d.ts +14 -0
  57. package/dist/export-xlsx/formats.js +40 -0
  58. package/dist/export-xlsx/formats.js.map +1 -0
  59. package/dist/export-xlsx/index.d.ts +74 -0
  60. package/dist/export-xlsx/index.js +137 -0
  61. package/dist/export-xlsx/index.js.map +1 -0
  62. package/dist/features/adaptive.d.ts +25 -0
  63. package/dist/features/adaptive.js +47 -0
  64. package/dist/features/adaptive.js.map +1 -0
  65. package/dist/features/cell-content-focus.d.ts +29 -0
  66. package/dist/features/cell-content-focus.js +95 -0
  67. package/dist/features/cell-content-focus.js.map +1 -0
  68. package/dist/features/cell-range.d.ts +97 -0
  69. package/dist/features/cell-range.js +75 -0
  70. package/dist/features/cell-range.js.map +1 -0
  71. package/dist/features/clipboard.d.ts +28 -0
  72. package/dist/features/clipboard.js +48 -0
  73. package/dist/features/clipboard.js.map +1 -0
  74. package/dist/features/column-chooser.d.ts +91 -0
  75. package/dist/features/column-chooser.js +451 -0
  76. package/dist/features/column-chooser.js.map +1 -0
  77. package/dist/features/column-dnd.d.ts +10 -0
  78. package/dist/features/column-dnd.js +126 -0
  79. package/dist/features/column-dnd.js.map +1 -0
  80. package/dist/features/context-menu.d.ts +122 -0
  81. package/dist/features/context-menu.js +153 -0
  82. package/dist/features/context-menu.js.map +1 -0
  83. package/dist/features/drag-helper.d.ts +39 -0
  84. package/dist/features/drag-helper.js +108 -0
  85. package/dist/features/drag-helper.js.map +1 -0
  86. package/dist/features/drop-position.d.ts +15 -0
  87. package/dist/features/drop-position.js +24 -0
  88. package/dist/features/drop-position.js.map +1 -0
  89. package/dist/features/editing.d.ts +111 -0
  90. package/dist/features/editing.js +244 -0
  91. package/dist/features/editing.js.map +1 -0
  92. package/dist/features/filter-row.d.ts +80 -0
  93. package/dist/features/filter-row.js +538 -0
  94. package/dist/features/filter-row.js.map +1 -0
  95. package/dist/features/filtering.d.ts +55 -0
  96. package/dist/features/filtering.js +209 -0
  97. package/dist/features/filtering.js.map +1 -0
  98. package/dist/features/group-dnd.d.ts +11 -0
  99. package/dist/features/group-dnd.js +119 -0
  100. package/dist/features/group-dnd.js.map +1 -0
  101. package/dist/features/header-filter.d.ts +100 -0
  102. package/dist/features/header-filter.js +588 -0
  103. package/dist/features/header-filter.js.map +1 -0
  104. package/dist/features/host-label.d.ts +36 -0
  105. package/dist/features/host-label.js +184 -0
  106. package/dist/features/host-label.js.map +1 -0
  107. package/dist/features/keyboard.d.ts +59 -0
  108. package/dist/features/keyboard.js +127 -0
  109. package/dist/features/keyboard.js.map +1 -0
  110. package/dist/features/menu.d.ts +113 -0
  111. package/dist/features/menu.js +491 -0
  112. package/dist/features/menu.js.map +1 -0
  113. package/dist/features/resize.d.ts +82 -0
  114. package/dist/features/resize.js +214 -0
  115. package/dist/features/resize.js.map +1 -0
  116. package/dist/features/scroll-port.d.ts +51 -0
  117. package/dist/features/scroll-port.js +329 -0
  118. package/dist/features/scroll-port.js.map +1 -0
  119. package/dist/features/search.d.ts +45 -0
  120. package/dist/features/search.js +123 -0
  121. package/dist/features/search.js.map +1 -0
  122. package/dist/features/selection.d.ts +37 -0
  123. package/dist/features/selection.js +103 -0
  124. package/dist/features/selection.js.map +1 -0
  125. package/dist/features/sorting.d.ts +39 -0
  126. package/dist/features/sorting.js +53 -0
  127. package/dist/features/sorting.js.map +1 -0
  128. package/dist/features/toolbar.d.ts +125 -0
  129. package/dist/features/toolbar.js +135 -0
  130. package/dist/features/toolbar.js.map +1 -0
  131. package/dist/features/tree.d.ts +53 -0
  132. package/dist/features/tree.js +94 -0
  133. package/dist/features/tree.js.map +1 -0
  134. package/dist/features/validation.d.ts +48 -0
  135. package/dist/features/validation.js +172 -0
  136. package/dist/features/validation.js.map +1 -0
  137. package/dist/grid-column-def.d.ts +521 -0
  138. package/dist/grid-column-def.js +32 -0
  139. package/dist/grid-column-def.js.map +1 -0
  140. package/dist/grid-column.d.ts +173 -0
  141. package/dist/grid-column.js +382 -0
  142. package/dist/grid-column.js.map +1 -0
  143. package/dist/grid-i18n.d.ts +469 -0
  144. package/dist/grid-i18n.js +3222 -0
  145. package/dist/grid-i18n.js.map +1 -0
  146. package/dist/grid.d.ts +1510 -0
  147. package/dist/grid.js +15972 -0
  148. package/dist/grid.js.map +1 -0
  149. package/dist/grid.min.js +3966 -0
  150. package/dist/grid.styles.d.ts +2 -0
  151. package/dist/grid.styles.js +2849 -0
  152. package/dist/grid.styles.js.map +1 -0
  153. package/dist/render/cell.d.ts +16 -0
  154. package/dist/render/cell.js +78 -0
  155. package/dist/render/cell.js.map +1 -0
  156. package/dist/render/column-window.d.ts +18 -0
  157. package/dist/render/column-window.js +50 -0
  158. package/dist/render/column-window.js.map +1 -0
  159. package/dist/render/content.d.ts +45 -0
  160. package/dist/render/content.js +140 -0
  161. package/dist/render/content.js.map +1 -0
  162. package/dist/render/editors.d.ts +28 -0
  163. package/dist/render/editors.js +41 -0
  164. package/dist/render/editors.js.map +1 -0
  165. package/dist/render/footer.d.ts +61 -0
  166. package/dist/render/footer.js +61 -0
  167. package/dist/render/footer.js.map +1 -0
  168. package/dist/render/group-row.d.ts +35 -0
  169. package/dist/render/group-row.js +60 -0
  170. package/dist/render/group-row.js.map +1 -0
  171. package/dist/render/header.d.ts +108 -0
  172. package/dist/render/header.js +124 -0
  173. package/dist/render/header.js.map +1 -0
  174. package/dist/render/keyed-rows.d.ts +25 -0
  175. package/dist/render/keyed-rows.js +98 -0
  176. package/dist/render/keyed-rows.js.map +1 -0
  177. package/dist/render/virtualizer.d.ts +158 -0
  178. package/dist/render/virtualizer.js +721 -0
  179. package/dist/render/virtualizer.js.map +1 -0
  180. package/dist/row-model/added-rows.d.ts +32 -0
  181. package/dist/row-model/added-rows.js +95 -0
  182. package/dist/row-model/added-rows.js.map +1 -0
  183. package/dist/row-model/cell-range.d.ts +71 -0
  184. package/dist/row-model/cell-range.js +187 -0
  185. package/dist/row-model/cell-range.js.map +1 -0
  186. package/dist/row-model/columns.d.ts +102 -0
  187. package/dist/row-model/columns.js +222 -0
  188. package/dist/row-model/columns.js.map +1 -0
  189. package/dist/row-model/compare.d.ts +40 -0
  190. package/dist/row-model/compare.js +590 -0
  191. package/dist/row-model/compare.js.map +1 -0
  192. package/dist/row-model/distinct.d.ts +39 -0
  193. package/dist/row-model/distinct.js +105 -0
  194. package/dist/row-model/distinct.js.map +1 -0
  195. package/dist/row-model/filter.d.ts +80 -0
  196. package/dist/row-model/filter.js +582 -0
  197. package/dist/row-model/filter.js.map +1 -0
  198. package/dist/row-model/flatten.d.ts +129 -0
  199. package/dist/row-model/flatten.js +511 -0
  200. package/dist/row-model/flatten.js.map +1 -0
  201. package/dist/row-model/fold.d.ts +25 -0
  202. package/dist/row-model/fold.js +104 -0
  203. package/dist/row-model/fold.js.map +1 -0
  204. package/dist/row-model/format.d.ts +58 -0
  205. package/dist/row-model/format.js +239 -0
  206. package/dist/row-model/format.js.map +1 -0
  207. package/dist/row-model/group.d.ts +30 -0
  208. package/dist/row-model/group.js +173 -0
  209. package/dist/row-model/group.js.map +1 -0
  210. package/dist/row-model/lru.d.ts +19 -0
  211. package/dist/row-model/lru.js +48 -0
  212. package/dist/row-model/lru.js.map +1 -0
  213. package/dist/row-model/sort.d.ts +30 -0
  214. package/dist/row-model/sort.js +107 -0
  215. package/dist/row-model/sort.js.map +1 -0
  216. package/dist/row-model/summary.d.ts +64 -0
  217. package/dist/row-model/summary.js +213 -0
  218. package/dist/row-model/summary.js.map +1 -0
  219. package/dist/row-model/tree.d.ts +116 -0
  220. package/dist/row-model/tree.js +478 -0
  221. package/dist/row-model/tree.js.map +1 -0
  222. package/dist/row-model/types.d.ts +109 -0
  223. package/dist/row-model/types.js +5 -0
  224. package/dist/row-model/types.js.map +1 -0
  225. package/dist/row-model/value.d.ts +20 -0
  226. package/dist/row-model/value.js +57 -0
  227. package/dist/row-model/value.js.map +1 -0
  228. package/dist/state/grid-state.d.ts +147 -0
  229. package/dist/state/grid-state.js +295 -0
  230. package/dist/state/grid-state.js.map +1 -0
  231. package/dist/state/storage.d.ts +33 -0
  232. package/dist/state/storage.js +62 -0
  233. package/dist/state/storage.js.map +1 -0
  234. package/dist/state/versioned.d.ts +18 -0
  235. package/dist/state/versioned.js +56 -0
  236. package/dist/state/versioned.js.map +1 -0
  237. package/package.json +145 -6
@@ -0,0 +1,521 @@
1
+ import type { nothing, TemplateResult } from 'lit';
2
+ import type { DataGrid } from './grid.js';
3
+ /** Sort direction: ascending or descending. */
4
+ export type GridSortOrder = 'asc' | 'desc';
5
+ /** A column of the current sorting and its direction (`getSorting()`). */
6
+ export interface GridSort {
7
+ column: GridColumnDef;
8
+ order: GridSortOrder;
9
+ }
10
+ /**
11
+ * Custom comparator of a column, in ascending order (the grid applies the
12
+ * direction). Receives the cell values and the row items.
13
+ */
14
+ export type GridColumnComparator<TItem = any> = (a: any, b: any, itemA: TItem, itemB: TItem) => number;
15
+ /** Data type of a column; without `dataType`, inferred from the first non-null value. */
16
+ export type GridColumnDataType = 'string' | 'number' | 'date' | 'datetime' | 'boolean';
17
+ /** Logical alignment: `start`/`end` follow the direction (RTL). */
18
+ export type GridColumnAlignment = 'start' | 'center' | 'end';
19
+ /** Boolean as text (`trueText`/`falseText`) or as a read-only check icon. */
20
+ export type GridColumnBooleanDisplay = 'text' | 'icon';
21
+ /** Formats a cell value into its displayed text. */
22
+ export type GridColumnFormatter<TItem = any> = (value: unknown, item: TItem) => string;
23
+ /** `Intl` number/date options or a formatter function. */
24
+ export type GridColumnFormat<TItem = any> = Intl.NumberFormatOptions | Intl.DateTimeFormatOptions | GridColumnFormatter<TItem>;
25
+ /**
26
+ * Filter operation of a condition. Text operations (`contains`, `notcontains`,
27
+ * `startswith`, `endswith`) and `=` on text ignore case and accents.
28
+ */
29
+ export type GridFilterOperation = '=' | '<>' | '<' | '<=' | '>' | '>=' | 'contains' | 'notcontains' | 'startswith' | 'endswith' | 'between' | 'anyof' | 'noneof' | 'isblank' | 'isnotblank';
30
+ /**
31
+ * One condition: `[path, operation, value]`. `path` is the column `path`;
32
+ * `between` takes `[start, end]` (inclusive, either may be `null`), `anyof` /
33
+ * `noneof` take a list, `isblank` / `isnotblank` take no value.
34
+ */
35
+ export type GridFilterCondition = readonly [path: string, operation: GridFilterOperation, value?: unknown] | readonly [path: string, value: unknown];
36
+ /**
37
+ * Serializable filter expression (same shape as DevExtreme): a condition, a
38
+ * negation `['!', expression]` or a group of expressions joined by `'and'` /
39
+ * `'or'` (`and` binds tighter; two expressions in a row mean `and`).
40
+ */
41
+ export type GridFilterExpression = GridFilterCondition | readonly ['!', GridFilterExpression] | readonly (GridFilterExpression | 'and' | 'or')[];
42
+ /** Side a column is fixed to (logical: mirrors in RTL). */
43
+ export type GridColumnFixed = 'start' | 'end' | null;
44
+ /**
45
+ * Column definition (the `columns` property of `<u-grid>`). Mirrors the
46
+ * `<u-grid-column>` element: same names, types and defaults. `TItem` types
47
+ * the row item in the callbacks.
48
+ */
49
+ export interface GridColumnDef<TItem = any> {
50
+ /**
51
+ * Nested columns: a column with at least one nested column is a BAND (a
52
+ * header over its columns, no cells). In a band only `label`,
53
+ * `headerRenderer`, `alignment` (of the label; default `start`), `fixed`,
54
+ * `visible` and `showInChooser` apply; the other fields are ignored. A band
55
+ * is shown while it is visible and has a visible column. Columns reorder
56
+ * only inside their own band; only leaf columns sort, group and export.
57
+ * `null` or `[]` = a regular column.
58
+ */
59
+ columns?: readonly GridColumnDef<TItem>[] | null;
60
+ /**
61
+ * Width in px. Under virtual column rendering (`columnRenderingMode`) a
62
+ * column without `width` takes its auto-size width or `max(minWidth, 150)` px.
63
+ */
64
+ width?: number | null;
65
+ /** Minimum width in px (also when resizing and auto-sizing). */
66
+ minWidth?: number | null;
67
+ /** INITIAL grouping level; afterwards grouping is grid state (`groupColumn`, `ungroupColumn`). */
68
+ groupIndex?: number | null;
69
+ /**
70
+ * The column's name as text: the header text (unless `headerRenderer`;
71
+ * empty: `path`) and its name everywhere else (header buttons, group chip
72
+ * and rows, column chooser, row details, announcements, export; empty:
73
+ * `path`, then `name`, as is). Set it also with `headerRenderer`.
74
+ */
75
+ label?: string;
76
+ /** Dot path of the cell value in the row item (`"address.city"`). */
77
+ path?: string;
78
+ /**
79
+ * Stable id of the column in the grid state (`getState`, `stateStorage`)
80
+ * and in string column references (`summary` items look it up before
81
+ * `path`). Default: `path`. A column without `name` and `path` is left out
82
+ * of the state.
83
+ */
84
+ name?: string;
85
+ /** Data type; without it, inferred from the first non-null value. */
86
+ dataType?: GridColumnDataType | null;
87
+ /** `Intl` options or a formatter function. */
88
+ format?: GridColumnFormat<TItem> | null;
89
+ /** Logical alignment; default by data type (numbers at the end). In a band, of the header label (default `start`). */
90
+ alignment?: GridColumnAlignment | null;
91
+ /** Cell value used to group, sort and filter. Default: read `path`. */
92
+ valueGetter?: ((item: TItem) => unknown) | null;
93
+ /** Displayed text (cell and group row); wins over `format`. */
94
+ displayValue?: ((value: unknown, item: TItem) => string) | null;
95
+ /** Boolean as text (default) or icon; the icon has the text as its accessible name. */
96
+ booleanDisplay?: GridColumnBooleanDisplay | null;
97
+ /** Wraps the text in several lines instead of an ellipsis. */
98
+ wrap?: boolean;
99
+ /** Text for empty values (`null`/`undefined`). */
100
+ emptyText?: string | null;
101
+ /**
102
+ * Builds the cell content: a Lit `TemplateResult` (recommended), a string
103
+ * (text, never HTML) or an `HTMLElement` (placed in the grid's light DOM).
104
+ * `null`, `undefined` and Lit's `nothing` render an empty cell. See `GridCellRenderer`.
105
+ */
106
+ renderer?: GridCellRenderer<TItem> | null;
107
+ /**
108
+ * Builds the header label (sort arrow, filter button and resize handle stay; their accessible names
109
+ * follow the rendered text). Set `label` too: it names the column outside the header (without it
110
+ * the grid warns once and uses `path`, then `name`).
111
+ */
112
+ headerRenderer?: GridHeaderRenderer<TItem> | null;
113
+ /** Builds the label of the group rows of this column (expand button and aligned summaries stay). */
114
+ groupRenderer?: GridGroupRenderer<TItem> | null;
115
+ /** Allows sorting from the header. Default: `true` when the column has a `path`, `valueGetter` or `comparator`. */
116
+ sortable?: boolean | null;
117
+ /** INITIAL sort direction; afterwards sorting is grid state (`sortColumn`, `getSorting`). */
118
+ sortOrder?: GridSortOrder | null;
119
+ /** Priority of the initial sort among columns (lower first). */
120
+ sortIndex?: number | null;
121
+ /** Custom ascending comparator. */
122
+ comparator?: GridColumnComparator<TItem> | null;
123
+ /**
124
+ * Allows filtering by this column (filter row, header filter and, by
125
+ * default, the search panel). Default: `true` when the column has a `path`
126
+ * (the filter expression refers to columns by `path`).
127
+ */
128
+ filterable?: boolean | null;
129
+ /**
130
+ * Operations offered in the filter row operation menu (only the menu: the
131
+ * header filter and `filterValue` are not checked). Default by data type.
132
+ */
133
+ filterOperations?: readonly GridFilterOperation[] | null;
134
+ /** Operation of the filter row editor. Default: `contains` for text, `=` otherwise (or the first of `filterOperations`). */
135
+ defaultFilterOperation?: GridFilterOperation | null;
136
+ /** `false` prevents resizing this column even with `column-resizing`. */
137
+ resizable?: boolean | null;
138
+ /** Maximum width in px when resizing and auto-sizing. */
139
+ maxWidth?: number | null;
140
+ /**
141
+ * Order in which the column leaves the table when the grid is too narrow
142
+ * (`autoHideColumns`; its values move to the row details): the lowest goes
143
+ * first, ties from the end. When any column of `columns` has a
144
+ * `hidingPriority` (grouped or hidden ones included), only those columns
145
+ * hide; otherwise columns hide from the last one. Fixed
146
+ * columns never hide. Ignored on bands.
147
+ */
148
+ hidingPriority?: number | null;
149
+ /**
150
+ * Fixes the column at the start or end of the scrollable area. A fixed band
151
+ * fixes its columns; ignored on nested columns (they follow the top band).
152
+ */
153
+ fixed?: GridColumnFixed;
154
+ /** INITIAL visibility (default `true`); afterwards the user changes it in the chooser. */
155
+ visible?: boolean | null;
156
+ /** `false` removes the column from the chooser (the user cannot hide it). */
157
+ showInChooser?: boolean | null;
158
+ /**
159
+ * Value used to GROUP by this column instead of the cell value: a range or
160
+ * bucket (decade, initial letter). Groups are identified, sorted and shown
161
+ * by the returned value; the column `dataType`, `comparator`, `format` and
162
+ * `displayValue` do not apply to it. Return a string or a number.
163
+ */
164
+ groupValueGetter?: ((item: TItem) => unknown) | null;
165
+ /**
166
+ * Allows the user to group by this column (drag to the group panel).
167
+ * Default: `true` when the column has a `path`, `valueGetter` or
168
+ * `groupValueGetter`. Only limits the user: `groupColumn()` still works.
169
+ */
170
+ groupable?: boolean | null;
171
+ /**
172
+ * Includes this column in exports (`exportCsv`, `getExportData`, the xlsx
173
+ * adapter) and in Ctrl+C. Default: `true` when the column has a `path`,
174
+ * `valueGetter` or `displayValue` (a `renderer`-only column has no text).
175
+ */
176
+ exportable?: boolean | null;
177
+ /**
178
+ * Allows editing the cells of this column (with `allowEditing` on the grid;
179
+ * new rows with `allowAdding`). Default: `true` when the column has a
180
+ * `path` or a `valueSetter`.
181
+ */
182
+ editable?: boolean | null;
183
+ /**
184
+ * Builds the editor of a cell instead of the built-in one (text, number,
185
+ * date, checkbox). See `GridEditorRenderer`.
186
+ */
187
+ editorRenderer?: GridEditorRenderer<TItem> | null;
188
+ /** Rules checked when a value is committed and before saving. See `GridValidationRule`. */
189
+ validationRules?: readonly GridValidationRule<TItem>[] | null;
190
+ /**
191
+ * Writes an edited value into `data`, the pending change of the row (a
192
+ * partial item owned by the grid). Default: sets `path` (dots create nested
193
+ * objects). Set other fields too to edit computed columns.
194
+ */
195
+ valueSetter?: GridValueSetter<TItem> | null;
196
+ }
197
+ /**
198
+ * A column of the grid: its `name`, its `path` (first column with that name, else with that path) or the column itself.
199
+ * Leaf columns only, including columns inside a band; a band is not a column reference.
200
+ */
201
+ export type GridColumnRef<TItem = any> = string | GridColumnDef<TItem>;
202
+ /** Values of a group from the outermost level, e.g. `['Brazil', 'SP']`. */
203
+ export type GridGroupPath = readonly unknown[];
204
+ /** Built-in summary aggregates. `sum`/`min`/`max`/`avg` ignore empty values; `count` counts rows. */
205
+ export type GridSummaryType = 'sum' | 'min' | 'max' | 'avg' | 'count';
206
+ /** Custom aggregate: receives the column values and the row items of the group (or of all rows). */
207
+ export type GridSummaryAggregator<TItem = any> = (values: readonly unknown[], items: readonly TItem[]) => unknown;
208
+ /** `Intl` options or a function that formats the summary value. */
209
+ export type GridSummaryFormat = Intl.NumberFormatOptions | Intl.DateTimeFormatOptions | ((value: unknown) => string);
210
+ /** A summary (aggregate) of a column. */
211
+ export interface GridSummaryItem<TItem = any> {
212
+ /** Column whose values are aggregated and under which the summary is shown. */
213
+ column: GridColumnRef<TItem>;
214
+ /** Built-in aggregate or a custom function. */
215
+ type: GridSummaryType | GridSummaryAggregator<TItem>;
216
+ /**
217
+ * Replaces the aggregate name in the text (`"Total: 1,234"`). Without it a
218
+ * custom aggregate shows `"{column}: {value}"` in group rows and only the
219
+ * value in cells.
220
+ */
221
+ label?: string;
222
+ /**
223
+ * Formats the value. Default: the column `format` when it is `Intl`
224
+ * options (a formatter function is not inherited); `count` uses the
225
+ * integer format of the language.
226
+ */
227
+ format?: GridSummaryFormat | null;
228
+ /** Identifies the summary in `getSummaryValues()`. */
229
+ name?: string;
230
+ }
231
+ /** A summary of each group. */
232
+ export interface GridGroupSummaryItem<TItem = any> extends GridSummaryItem<TItem> {
233
+ /**
234
+ * Where it is shown: `inline` (default) in the group row text,
235
+ * `column` in the group row under its column, `footer` in a footer row
236
+ * after the group items.
237
+ */
238
+ display?: 'inline' | 'column' | 'footer';
239
+ }
240
+ /** The `summary` property of `<u-grid>`. */
241
+ export interface GridSummary<TItem = any> {
242
+ /** Totals: a footer fixed at the bottom, under the columns. */
243
+ total?: GridSummaryItem<TItem>[];
244
+ /** Summaries of each group (ignored with `treeMode`). */
245
+ group?: GridGroupSummaryItem<TItem>[];
246
+ /**
247
+ * Tree data (`treeMode`): summaries of each node with children, over its
248
+ * visible descendants (not the node itself). Off with `dataSource`.
249
+ */
250
+ node?: GridNodeSummaryItem<TItem>[];
251
+ }
252
+ /**
253
+ * A summary of each tree node: `inline` (default) after the tree cell text,
254
+ * `column` instead of the node value in that column, `footer` in a row after
255
+ * the children of an expanded node.
256
+ */
257
+ export interface GridNodeSummaryItem<TItem = any> extends GridSummaryItem<TItem> {
258
+ /**
259
+ * Where it is shown: `inline` (default) after the tree cell text, `column`
260
+ * instead of the node value in its column, `footer` in a row after the
261
+ * children of an expanded node.
262
+ */
263
+ display?: 'inline' | 'column' | 'footer';
264
+ }
265
+ /** A computed summary (`getSummaryValues()`). */
266
+ export interface GridSummaryValue<TItem = any> {
267
+ /** The summary definition. */
268
+ item: GridSummaryItem<TItem>;
269
+ /** Raw aggregate (without values: `sum` = `0`, the others `null`). */
270
+ value: unknown;
271
+ /** Formatted value, as shown. */
272
+ text: string;
273
+ }
274
+ /**
275
+ * What a renderer returns. A Lit `TemplateResult` (recommended) or a string
276
+ * (always text, never parsed as HTML) is rendered inside the grid's shadow
277
+ * DOM — also on the server — and styled through the `part` names the
278
+ * template declares (`u-grid::part(my-badge)`). An `HTMLElement` is placed
279
+ * in the grid's light DOM and projected by a slot: page styles apply, but it
280
+ * only renders in the browser (the server leaves the slot empty). `null`,
281
+ * `undefined` and Lit's `nothing` render nothing. Return the same kind of
282
+ * result on the server and on the client (don't branch on `typeof document`).
283
+ */
284
+ export type GridRenderResult = TemplateResult | HTMLElement | string | typeof nothing | null | undefined;
285
+ /** Members shared by every renderer context. */
286
+ export interface GridRenderContextBase {
287
+ /** The grid rendering the content (a renderer may be shared by several grids). */
288
+ readonly grid: DataGrid;
289
+ /**
290
+ * Aborted when the grid discards this content (the row leaves the virtual
291
+ * window, the detail is collapsed, the column or the renderer changes, the
292
+ * grid is disconnected): unmount framework roots here. Created on first
293
+ * access.
294
+ */
295
+ readonly signal: AbortSignal;
296
+ }
297
+ /** Context of a cell `renderer`. */
298
+ export interface GridCellRenderContext<TItem = any> extends GridRenderContextBase {
299
+ /** The row item. */
300
+ readonly item: TItem;
301
+ /** Cell value (`valueGetter` or `path`). */
302
+ readonly value: unknown;
303
+ /** The text the native cell would show (`format`, `displayValue`, `emptyText`, boolean texts). */
304
+ readonly text: string;
305
+ /** The column of the cell. */
306
+ readonly column: GridColumnDef<TItem>;
307
+ /** Row key (without `keyExpr`, the item itself). */
308
+ readonly rowKey: unknown;
309
+ /**
310
+ * `true` when the value is drawn in the row details because the column is
311
+ * hidden for lack of space (`autoHideColumns`), `false` in the table cell.
312
+ * Moving between the two discards the content (the `signal` aborts).
313
+ */
314
+ readonly adaptive: boolean;
315
+ }
316
+ /** Context of a `headerRenderer`. */
317
+ export interface GridHeaderRenderContext<TItem = any> extends GridRenderContextBase {
318
+ /** The column of the header; in a band header, the band (it has `columns` and no `path`). */
319
+ readonly column: GridColumnDef<TItem>;
320
+ }
321
+ /** Context of a `groupRenderer`. */
322
+ export interface GridGroupRenderContext<TItem = any> extends GridRenderContextBase {
323
+ /** The grouped column. */
324
+ readonly column: GridColumnDef<TItem>;
325
+ /** Group value. */
326
+ readonly value: unknown;
327
+ /** Group value formatted as the grid shows it. */
328
+ readonly text: string;
329
+ /** Values of the group from the outermost level. */
330
+ readonly groupPath: GridGroupPath;
331
+ /** Grouping level (0-based). */
332
+ readonly groupIndex: number;
333
+ /** Rows in the group (after filtering). */
334
+ readonly itemCount: number;
335
+ /** Whether the group is expanded. */
336
+ readonly expanded: boolean;
337
+ /** Summaries shown in the group row text (`display: 'inline'`). */
338
+ readonly summaries: readonly GridSummaryValue<TItem>[];
339
+ /** The full label the grid would show (`"Country: Brazil (3, Sum of Population: 1,234)"`). */
340
+ readonly defaultText: string;
341
+ }
342
+ /** Context of the grid `detailRenderer`. */
343
+ export interface GridDetailRenderContext<TItem = any> extends GridRenderContextBase {
344
+ /** The master row item. */
345
+ readonly item: TItem;
346
+ /** Key of the master row. */
347
+ readonly rowKey: unknown;
348
+ }
349
+ /** Side a row is fixed to (`fixedTopItems` / `fixedBottomItems`); `null` = a body row. */
350
+ export type GridRowFixed = 'top' | 'bottom' | null;
351
+ /** Context of the grid `rowRenderer`. */
352
+ export interface GridRowRenderContext<TItem = any> extends GridRenderContextBase {
353
+ /** The row item. */
354
+ readonly item: TItem;
355
+ /** Row key (without `keyExpr`, the item itself). */
356
+ readonly rowKey: unknown;
357
+ /** `'top'`/`'bottom'` in a fixed row, `null` in a body row. */
358
+ readonly fixed: GridRowFixed;
359
+ /**
360
+ * Aborted when the grid discards this content (the row leaves the virtual
361
+ * window, the item or the renderer changes, the grid is disconnected) and
362
+ * immediately when the renderer returns `false`. Created on first access.
363
+ */
364
+ readonly signal: AbortSignal;
365
+ }
366
+ /** Context of the grid `noDataRenderer`. */
367
+ export interface GridNoDataRenderContext extends GridRenderContextBase {
368
+ /** `true` when there are items but the filter or the search hides them all. */
369
+ readonly filtered: boolean;
370
+ }
371
+ /**
372
+ * Cell renderer: a pure function of the item and the column. It runs again
373
+ * when the item, the column object or the language change and when the row
374
+ * comes back to the virtual window — so it may run several times for the
375
+ * same item —, never when selecting, focusing or sorting (nor when the item
376
+ * is mutated).
377
+ */
378
+ export type GridCellRenderer<TItem = any> = (item: TItem, ctx: GridCellRenderContext<TItem>) => GridRenderResult;
379
+ /** Header label renderer (runs again when the column or the language change). */
380
+ export type GridHeaderRenderer<TItem = any> = (ctx: GridHeaderRenderContext<TItem>) => GridRenderResult;
381
+ /** Group row label renderer (runs again when any member of the context changes). */
382
+ export type GridGroupRenderer<TItem = any> = (ctx: GridGroupRenderContext<TItem>) => GridRenderResult;
383
+ /** Detail row renderer (master-detail). `null` renders an empty detail row (the toggle stays). */
384
+ export type GridDetailRenderer<TItem = any> = (item: TItem, ctx: GridDetailRenderContext<TItem>) => GridRenderResult;
385
+ /**
386
+ * What a `rowRenderer` returns: the content of a full-width row, or `false`
387
+ * to keep the row's columns. `null`, `undefined`, `''` and Lit's `nothing`
388
+ * are an EMPTY full-width row, not a normal one.
389
+ */
390
+ export type GridRowRenderResult = GridRenderResult | false;
391
+ /**
392
+ * Full-width row renderer: the content of ONE cell spanning the data
393
+ * columns of a data or fixed row (the group indents, the detail toggle and
394
+ * the selection checkbox stay). Return `false` (not `nothing`/`null`/`''`)
395
+ * to keep that row's columns — `cond && html\`…\`` works,
396
+ * `cond ? html\`…\` : nothing` gives empty full-width rows.
397
+ *
398
+ * Called for every rendered data or fixed row: decide `false` first,
399
+ * deterministically and without touching `document` (the server and the
400
+ * client must take the same decision), before building any content. The
401
+ * result (including `false`) is cached per row: it runs again when the item
402
+ * object, the `rowRenderer` function or the language change and when the
403
+ * row comes back to the virtual window — to re-decide, assign a new item
404
+ * object or a new function. A renderer that throws keeps the row's columns
405
+ * (one `console.error`). Never called for group, summary, detail and
406
+ * skeleton rows nor for a row being added (`addRow`).
407
+ */
408
+ export type GridRowRenderer<TItem = any> = (item: TItem, ctx: GridRowRenderContext<TItem>) => GridRowRenderResult;
409
+ /** Empty state renderer (no rows to show). */
410
+ export type GridNoDataRenderer = (ctx: GridNoDataRenderContext) => GridRenderResult;
411
+ /** Writes an edited `value` into `data` (the pending change of the row); `item` is the original row (empty object for new rows). */
412
+ export type GridValueSetter<TItem = any> = (data: Partial<TItem>, value: unknown, item: TItem) => void;
413
+ /** What a validation rule receives. */
414
+ export interface GridValidationContext<TItem = any> {
415
+ /** The value being checked. */
416
+ readonly value: unknown;
417
+ /** The original row item (empty object for a new row). */
418
+ readonly item: TItem;
419
+ /** The pending change of the row (fields edited so far, this value included). */
420
+ readonly data: Partial<TItem>;
421
+ /** The column of the value. */
422
+ readonly column: GridColumnDef<TItem>;
423
+ /** Row key (a new row has an opaque provisional key). */
424
+ readonly rowKey: unknown;
425
+ }
426
+ /** Members shared by every validation rule. */
427
+ export interface GridValidationRuleBase {
428
+ /** Error text; default: the grid translation of the rule. */
429
+ message?: string;
430
+ }
431
+ /** The value cannot be empty (`null`, `undefined`, `''`, or only spaces with `trim`). */
432
+ export interface GridRequiredRule extends GridValidationRuleBase {
433
+ type: 'required';
434
+ /** Spaces only count as empty. Default `true`. */
435
+ trim?: boolean;
436
+ }
437
+ /** A number or date between `min` and `max` (inclusive). */
438
+ export interface GridRangeRule extends GridValidationRuleBase {
439
+ type: 'range';
440
+ min?: number | Date;
441
+ max?: number | Date;
442
+ }
443
+ /** Text length between `min` and `max` characters. */
444
+ export interface GridStringLengthRule extends GridValidationRuleBase {
445
+ type: 'stringLength';
446
+ min?: number;
447
+ max?: number;
448
+ }
449
+ /** The text matches `pattern`; a string matches the whole value, like the HTML `pattern` attribute. */
450
+ export interface GridPatternRule extends GridValidationRuleBase {
451
+ type: 'pattern';
452
+ pattern: RegExp | string;
453
+ }
454
+ /** An e-mail address (the rule of `<input type="email">`). */
455
+ export interface GridEmailRule extends GridValidationRuleBase {
456
+ type: 'email';
457
+ }
458
+ /**
459
+ * Host check: return `true` (valid), `false` (invalid, `message` or the
460
+ * default text) or an error text; or a promise of it (server check). The
461
+ * `signal` aborts when the value changes again or the edit ends: a stale
462
+ * answer is ignored.
463
+ */
464
+ export interface GridCustomRule<TItem = any> extends GridValidationRuleBase {
465
+ type: 'custom';
466
+ validate: (ctx: GridValidationContext<TItem>, signal: AbortSignal) => boolean | string | Promise<boolean | string>;
467
+ }
468
+ /**
469
+ * A validation rule of `validationRules`. Empty values only fail `required`
470
+ * (and `custom`, which always runs).
471
+ */
472
+ export type GridValidationRule<TItem = any> = GridRequiredRule | GridRangeRule | GridStringLengthRule | GridPatternRule | GridEmailRule | GridCustomRule<TItem>;
473
+ /** Context of an `editorRenderer`. */
474
+ export interface GridEditorRenderContext<TItem = any> extends GridRenderContextBase {
475
+ /** The original row item (empty object for a new row). */
476
+ readonly item: TItem;
477
+ /** The value being edited (pending, not yet saved). */
478
+ readonly value: unknown;
479
+ /** The pending change of the row. */
480
+ readonly data: Partial<TItem>;
481
+ /** The column of the cell. */
482
+ readonly column: GridColumnDef<TItem>;
483
+ /** Row key (a new row has an opaque provisional key). */
484
+ readonly rowKey: unknown;
485
+ /** Accessible name for the editor (the column label). */
486
+ readonly label: string;
487
+ /** `true` when the editor is in the row details (column hidden for lack of space, `autoHideColumns`). */
488
+ readonly adaptive: boolean;
489
+ /** The value failed a validation rule. */
490
+ readonly invalid: boolean;
491
+ /** Error text of the value (`''` when valid). */
492
+ readonly errorMessage: string;
493
+ /**
494
+ * Id of the element with the error text, for `aria-describedby` — only for
495
+ * editors rendered in the grid's shadow DOM (`TemplateResult`). For an
496
+ * `HTMLElement` editor the grid places the text in its light DOM and sets
497
+ * `aria-label`, `aria-invalid` and `aria-describedby` when missing.
498
+ */
499
+ readonly describedBy: string;
500
+ /** Changes the edited value (the grid validates it on commit). */
501
+ setValue(value: unknown): void;
502
+ /** Commits the value (like Enter, without moving). */
503
+ commit(): void;
504
+ /** Discards the value and closes the editor (like Esc). */
505
+ cancel(): void;
506
+ }
507
+ /**
508
+ * Editor of a cell: focus goes to the first focusable element it renders.
509
+ * It runs when the editor opens and again when the validity of the value
510
+ * changes (`invalid`, `errorMessage`): keep the value in `setValue`.
511
+ * The grid handles Enter, Tab and Esc unless the editor calls
512
+ * `preventDefault()` on the `keydown` (a combobox that uses Enter).
513
+ */
514
+ export type GridEditorRenderer<TItem = any> = (item: TItem, ctx: GridEditorRenderContext<TItem>) => GridRenderResult;
515
+ /**
516
+ * How columns are rendered: `virtual` keeps only the columns in view (plus the
517
+ * fixed ones and the focused one) in the DOM; `standard` renders all;
518
+ * `auto` is `virtual` with more than 50 leaf columns defined.
519
+ */
520
+ export type GridColumnRenderingMode = 'auto' | 'virtual' | 'standard';
521
+ //# sourceMappingURL=grid-column-def.d.ts.map
@@ -0,0 +1,32 @@
1
+ /**
2
+ * O usuário pode agrupar pela coluna?
3
+ * @internal
4
+ */
5
+ export const isColumnGroupable = (column) => column.groupable ?? (!!column.path || !!column.valueGetter || !!column.groupValueGetter);
6
+ /**
7
+ * A coluna pode ser ordenada pelo usuário?
8
+ * @internal
9
+ */
10
+ export const isColumnSortable = (column) => column.sortable ?? (!!column.path || !!column.valueGetter || !!column.comparator);
11
+ /**
12
+ * A coluna entra na exportação e na área de transferência?
13
+ * @internal
14
+ */
15
+ export const isColumnExportable = (column) => column.exportable ?? (!!column.path || !!column.valueGetter || !!column.displayValue);
16
+ /**
17
+ * A coluna pode ser filtrada pelo usuário? (a expressão aponta a coluna pelo `path`)
18
+ * @internal
19
+ */
20
+ export const isColumnFilterable = (column) => !!column.path && column.filterable !== false;
21
+ /**
22
+ * A coluna é editável (sem olhar o `allowEditing` do grid)? Padrão: com
23
+ * `path` ou `valueSetter`.
24
+ * @internal
25
+ */
26
+ export const isColumnEditable = (column) => column.editable ?? (!!column.path || !!column.valueSetter);
27
+ /**
28
+ * A coluna é banda (`columns` com pelo menos 1 item).
29
+ * @internal
30
+ */
31
+ export const isBand = (column) => !!column && Array.isArray(column.columns) && column.columns.length > 0;
32
+ //# sourceMappingURL=grid-column-def.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grid-column-def.js","sourceRoot":"","sources":["../src/grid-column-def.ts"],"names":[],"mappings":"AA6cA;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,MAAqB,EAAW,EAAE,CAClE,MAAM,CAAC,SAAS,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,CAAC,MAAM,CAAC,WAAW,IAAI,CAAC,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;AAE3F;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,MAAqB,EAAW,EAAE,CACjE,MAAM,CAAC,QAAQ,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,CAAC,MAAM,CAAC,WAAW,IAAI,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;AAEpF;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,MAAqB,EAAW,EAAE,CACnE,MAAM,CAAC,UAAU,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,CAAC,MAAM,CAAC,WAAW,IAAI,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;AAExF;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,MAAqB,EAAW,EAAE,CACnE,CAAC,CAAC,MAAM,CAAC,IAAI,IAAI,MAAM,CAAC,UAAU,KAAK,KAAK,CAAC;AA8H/C;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,MAAqB,EAAW,EAAE,CACjE,MAAM,CAAC,QAAQ,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;AAE7D;;;GAGG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,MAAwC,EAAW,EAAE,CAC1E,CAAC,CAAC,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC","sourcesContent":["import type { nothing, TemplateResult } from 'lit';\r\n\r\nimport type { DataGrid } from './grid.js';\r\n\r\n/** Sort direction: ascending or descending. */\r\nexport type GridSortOrder = 'asc' | 'desc';\r\n\r\n/** A column of the current sorting and its direction (`getSorting()`). */\r\nexport interface GridSort {\r\n column: GridColumnDef;\r\n order: GridSortOrder;\r\n}\r\n\r\n/**\r\n * Custom comparator of a column, in ascending order (the grid applies the\r\n * direction). Receives the cell values and the row items.\r\n */\r\nexport type GridColumnComparator<TItem = any> = (a: any, b: any, itemA: TItem, itemB: TItem) => number;\r\n\r\n/** Data type of a column; without `dataType`, inferred from the first non-null value. */\r\nexport type GridColumnDataType = 'string' | 'number' | 'date' | 'datetime' | 'boolean';\r\n\r\n/** Logical alignment: `start`/`end` follow the direction (RTL). */\r\nexport type GridColumnAlignment = 'start' | 'center' | 'end';\r\n\r\n/** Boolean as text (`trueText`/`falseText`) or as a read-only check icon. */\r\nexport type GridColumnBooleanDisplay = 'text' | 'icon';\r\n\r\n/** Formats a cell value into its displayed text. */\r\nexport type GridColumnFormatter<TItem = any> = (value: unknown, item: TItem) => string;\r\n\r\n/** `Intl` number/date options or a formatter function. */\r\nexport type GridColumnFormat<TItem = any> = Intl.NumberFormatOptions | Intl.DateTimeFormatOptions | GridColumnFormatter<TItem>;\r\n\r\n/**\r\n * Filter operation of a condition. Text operations (`contains`, `notcontains`,\r\n * `startswith`, `endswith`) and `=` on text ignore case and accents.\r\n */\r\nexport type GridFilterOperation =\r\n | '=' | '<>' | '<' | '<=' | '>' | '>='\r\n | 'contains' | 'notcontains' | 'startswith' | 'endswith'\r\n | 'between' | 'anyof' | 'noneof' | 'isblank' | 'isnotblank';\r\n\r\n/**\r\n * One condition: `[path, operation, value]`. `path` is the column `path`;\r\n * `between` takes `[start, end]` (inclusive, either may be `null`), `anyof` /\r\n * `noneof` take a list, `isblank` / `isnotblank` take no value.\r\n */\r\nexport type GridFilterCondition =\r\n | readonly [path: string, operation: GridFilterOperation, value?: unknown]\r\n | readonly [path: string, value: unknown];\r\n\r\n/**\r\n * Serializable filter expression (same shape as DevExtreme): a condition, a\r\n * negation `['!', expression]` or a group of expressions joined by `'and'` /\r\n * `'or'` (`and` binds tighter; two expressions in a row mean `and`).\r\n */\r\nexport type GridFilterExpression =\r\n | GridFilterCondition\r\n | readonly ['!', GridFilterExpression]\r\n | readonly (GridFilterExpression | 'and' | 'or')[];\r\n\r\n/** Side a column is fixed to (logical: mirrors in RTL). */\r\nexport type GridColumnFixed = 'start' | 'end' | null;\r\n\r\n/**\r\n * Column definition (the `columns` property of `<u-grid>`). Mirrors the\r\n * `<u-grid-column>` element: same names, types and defaults. `TItem` types\r\n * the row item in the callbacks.\r\n */\r\nexport interface GridColumnDef<TItem = any> {\r\n /**\r\n * Nested columns: a column with at least one nested column is a BAND (a\r\n * header over its columns, no cells). In a band only `label`,\r\n * `headerRenderer`, `alignment` (of the label; default `start`), `fixed`,\r\n * `visible` and `showInChooser` apply; the other fields are ignored. A band\r\n * is shown while it is visible and has a visible column. Columns reorder\r\n * only inside their own band; only leaf columns sort, group and export.\r\n * `null` or `[]` = a regular column.\r\n */\r\n columns?: readonly GridColumnDef<TItem>[] | null;\r\n /**\r\n * Width in px. Under virtual column rendering (`columnRenderingMode`) a\r\n * column without `width` takes its auto-size width or `max(minWidth, 150)` px.\r\n */\r\n width?: number | null;\r\n /** Minimum width in px (also when resizing and auto-sizing). */\r\n minWidth?: number | null;\r\n /** INITIAL grouping level; afterwards grouping is grid state (`groupColumn`, `ungroupColumn`). */\r\n groupIndex?: number | null;\r\n /**\r\n * The column's name as text: the header text (unless `headerRenderer`;\r\n * empty: `path`) and its name everywhere else (header buttons, group chip\r\n * and rows, column chooser, row details, announcements, export; empty:\r\n * `path`, then `name`, as is). Set it also with `headerRenderer`.\r\n */\r\n label?: string;\r\n /** Dot path of the cell value in the row item (`\"address.city\"`). */\r\n path?: string;\r\n /**\r\n * Stable id of the column in the grid state (`getState`, `stateStorage`)\r\n * and in string column references (`summary` items look it up before\r\n * `path`). Default: `path`. A column without `name` and `path` is left out\r\n * of the state.\r\n */\r\n name?: string;\r\n /** Data type; without it, inferred from the first non-null value. */\r\n dataType?: GridColumnDataType | null;\r\n /** `Intl` options or a formatter function. */\r\n format?: GridColumnFormat<TItem> | null;\r\n /** Logical alignment; default by data type (numbers at the end). In a band, of the header label (default `start`). */\r\n alignment?: GridColumnAlignment | null;\r\n /** Cell value used to group, sort and filter. Default: read `path`. */\r\n valueGetter?: ((item: TItem) => unknown) | null;\r\n /** Displayed text (cell and group row); wins over `format`. */\r\n displayValue?: ((value: unknown, item: TItem) => string) | null;\r\n /** Boolean as text (default) or icon; the icon has the text as its accessible name. */\r\n booleanDisplay?: GridColumnBooleanDisplay | null;\r\n /** Wraps the text in several lines instead of an ellipsis. */\r\n wrap?: boolean;\r\n /** Text for empty values (`null`/`undefined`). */\r\n emptyText?: string | null;\r\n /**\r\n * Builds the cell content: a Lit `TemplateResult` (recommended), a string\r\n * (text, never HTML) or an `HTMLElement` (placed in the grid's light DOM).\r\n * `null`, `undefined` and Lit's `nothing` render an empty cell. See `GridCellRenderer`.\r\n */\r\n renderer?: GridCellRenderer<TItem> | null;\r\n /**\r\n * Builds the header label (sort arrow, filter button and resize handle stay; their accessible names\r\n * follow the rendered text). Set `label` too: it names the column outside the header (without it\r\n * the grid warns once and uses `path`, then `name`).\r\n */\r\n headerRenderer?: GridHeaderRenderer<TItem> | null;\r\n /** Builds the label of the group rows of this column (expand button and aligned summaries stay). */\r\n groupRenderer?: GridGroupRenderer<TItem> | null;\r\n /** Allows sorting from the header. Default: `true` when the column has a `path`, `valueGetter` or `comparator`. */\r\n sortable?: boolean | null;\r\n /** INITIAL sort direction; afterwards sorting is grid state (`sortColumn`, `getSorting`). */\r\n sortOrder?: GridSortOrder | null;\r\n /** Priority of the initial sort among columns (lower first). */\r\n sortIndex?: number | null;\r\n /** Custom ascending comparator. */\r\n comparator?: GridColumnComparator<TItem> | null;\r\n /**\r\n * Allows filtering by this column (filter row, header filter and, by\r\n * default, the search panel). Default: `true` when the column has a `path`\r\n * (the filter expression refers to columns by `path`).\r\n */\r\n filterable?: boolean | null;\r\n /**\r\n * Operations offered in the filter row operation menu (only the menu: the\r\n * header filter and `filterValue` are not checked). Default by data type.\r\n */\r\n filterOperations?: readonly GridFilterOperation[] | null;\r\n /** Operation of the filter row editor. Default: `contains` for text, `=` otherwise (or the first of `filterOperations`). */\r\n defaultFilterOperation?: GridFilterOperation | null;\r\n /** `false` prevents resizing this column even with `column-resizing`. */\r\n resizable?: boolean | null;\r\n /** Maximum width in px when resizing and auto-sizing. */\r\n maxWidth?: number | null;\r\n /**\r\n * Order in which the column leaves the table when the grid is too narrow\r\n * (`autoHideColumns`; its values move to the row details): the lowest goes\r\n * first, ties from the end. When any column of `columns` has a\r\n * `hidingPriority` (grouped or hidden ones included), only those columns\r\n * hide; otherwise columns hide from the last one. Fixed\r\n * columns never hide. Ignored on bands.\r\n */\r\n hidingPriority?: number | null;\r\n /**\r\n * Fixes the column at the start or end of the scrollable area. A fixed band\r\n * fixes its columns; ignored on nested columns (they follow the top band).\r\n */\r\n fixed?: GridColumnFixed;\r\n /** INITIAL visibility (default `true`); afterwards the user changes it in the chooser. */\r\n visible?: boolean | null;\r\n /** `false` removes the column from the chooser (the user cannot hide it). */\r\n showInChooser?: boolean | null;\r\n /**\r\n * Value used to GROUP by this column instead of the cell value: a range or\r\n * bucket (decade, initial letter). Groups are identified, sorted and shown\r\n * by the returned value; the column `dataType`, `comparator`, `format` and\r\n * `displayValue` do not apply to it. Return a string or a number.\r\n */\r\n groupValueGetter?: ((item: TItem) => unknown) | null;\r\n /**\r\n * Allows the user to group by this column (drag to the group panel).\r\n * Default: `true` when the column has a `path`, `valueGetter` or\r\n * `groupValueGetter`. Only limits the user: `groupColumn()` still works.\r\n */\r\n groupable?: boolean | null;\r\n /**\r\n * Includes this column in exports (`exportCsv`, `getExportData`, the xlsx\r\n * adapter) and in Ctrl+C. Default: `true` when the column has a `path`,\r\n * `valueGetter` or `displayValue` (a `renderer`-only column has no text).\r\n */\r\n exportable?: boolean | null;\r\n /**\r\n * Allows editing the cells of this column (with `allowEditing` on the grid;\r\n * new rows with `allowAdding`). Default: `true` when the column has a\r\n * `path` or a `valueSetter`.\r\n */\r\n editable?: boolean | null;\r\n /**\r\n * Builds the editor of a cell instead of the built-in one (text, number,\r\n * date, checkbox). See `GridEditorRenderer`.\r\n */\r\n editorRenderer?: GridEditorRenderer<TItem> | null;\r\n /** Rules checked when a value is committed and before saving. See `GridValidationRule`. */\r\n validationRules?: readonly GridValidationRule<TItem>[] | null;\r\n /**\r\n * Writes an edited value into `data`, the pending change of the row (a\r\n * partial item owned by the grid). Default: sets `path` (dots create nested\r\n * objects). Set other fields too to edit computed columns.\r\n */\r\n valueSetter?: GridValueSetter<TItem> | null;\r\n}\r\n\r\n/**\r\n * A column of the grid: its `name`, its `path` (first column with that name, else with that path) or the column itself.\r\n * Leaf columns only, including columns inside a band; a band is not a column reference.\r\n */\r\nexport type GridColumnRef<TItem = any> = string | GridColumnDef<TItem>;\r\n\r\n/** Values of a group from the outermost level, e.g. `['Brazil', 'SP']`. */\r\nexport type GridGroupPath = readonly unknown[];\r\n\r\n/** Built-in summary aggregates. `sum`/`min`/`max`/`avg` ignore empty values; `count` counts rows. */\r\nexport type GridSummaryType = 'sum' | 'min' | 'max' | 'avg' | 'count';\r\n\r\n/** Custom aggregate: receives the column values and the row items of the group (or of all rows). */\r\nexport type GridSummaryAggregator<TItem = any> = (values: readonly unknown[], items: readonly TItem[]) => unknown;\r\n\r\n/** `Intl` options or a function that formats the summary value. */\r\nexport type GridSummaryFormat = Intl.NumberFormatOptions | Intl.DateTimeFormatOptions | ((value: unknown) => string);\r\n\r\n/** A summary (aggregate) of a column. */\r\nexport interface GridSummaryItem<TItem = any> {\r\n /** Column whose values are aggregated and under which the summary is shown. */\r\n column: GridColumnRef<TItem>;\r\n /** Built-in aggregate or a custom function. */\r\n type: GridSummaryType | GridSummaryAggregator<TItem>;\r\n /**\r\n * Replaces the aggregate name in the text (`\"Total: 1,234\"`). Without it a\r\n * custom aggregate shows `\"{column}: {value}\"` in group rows and only the\r\n * value in cells.\r\n */\r\n label?: string;\r\n /**\r\n * Formats the value. Default: the column `format` when it is `Intl`\r\n * options (a formatter function is not inherited); `count` uses the\r\n * integer format of the language.\r\n */\r\n format?: GridSummaryFormat | null;\r\n /** Identifies the summary in `getSummaryValues()`. */\r\n name?: string;\r\n}\r\n\r\n/** A summary of each group. */\r\nexport interface GridGroupSummaryItem<TItem = any> extends GridSummaryItem<TItem> {\r\n /**\r\n * Where it is shown: `inline` (default) in the group row text,\r\n * `column` in the group row under its column, `footer` in a footer row\r\n * after the group items.\r\n */\r\n display?: 'inline' | 'column' | 'footer';\r\n}\r\n\r\n/** The `summary` property of `<u-grid>`. */\r\nexport interface GridSummary<TItem = any> {\r\n /** Totals: a footer fixed at the bottom, under the columns. */\r\n total?: GridSummaryItem<TItem>[];\r\n /** Summaries of each group (ignored with `treeMode`). */\r\n group?: GridGroupSummaryItem<TItem>[];\r\n /**\r\n * Tree data (`treeMode`): summaries of each node with children, over its\r\n * visible descendants (not the node itself). Off with `dataSource`.\r\n */\r\n node?: GridNodeSummaryItem<TItem>[];\r\n}\r\n\r\n/**\r\n * A summary of each tree node: `inline` (default) after the tree cell text,\r\n * `column` instead of the node value in that column, `footer` in a row after\r\n * the children of an expanded node.\r\n */\r\nexport interface GridNodeSummaryItem<TItem = any> extends GridSummaryItem<TItem> {\r\n /**\r\n * Where it is shown: `inline` (default) after the tree cell text, `column`\r\n * instead of the node value in its column, `footer` in a row after the\r\n * children of an expanded node.\r\n */\r\n display?: 'inline' | 'column' | 'footer';\r\n}\r\n\r\n/** A computed summary (`getSummaryValues()`). */\r\nexport interface GridSummaryValue<TItem = any> {\r\n /** The summary definition. */\r\n item: GridSummaryItem<TItem>;\r\n /** Raw aggregate (without values: `sum` = `0`, the others `null`). */\r\n value: unknown;\r\n /** Formatted value, as shown. */\r\n text: string;\r\n}\r\n\r\n// --------------------------------------------------------------- renderers\r\n\r\n/**\r\n * What a renderer returns. A Lit `TemplateResult` (recommended) or a string\r\n * (always text, never parsed as HTML) is rendered inside the grid's shadow\r\n * DOM — also on the server — and styled through the `part` names the\r\n * template declares (`u-grid::part(my-badge)`). An `HTMLElement` is placed\r\n * in the grid's light DOM and projected by a slot: page styles apply, but it\r\n * only renders in the browser (the server leaves the slot empty). `null`,\r\n * `undefined` and Lit's `nothing` render nothing. Return the same kind of\r\n * result on the server and on the client (don't branch on `typeof document`).\r\n */\r\nexport type GridRenderResult = TemplateResult | HTMLElement | string | typeof nothing | null | undefined;\r\n\r\n/** Members shared by every renderer context. */\r\nexport interface GridRenderContextBase {\r\n /** The grid rendering the content (a renderer may be shared by several grids). */\r\n readonly grid: DataGrid;\r\n /**\r\n * Aborted when the grid discards this content (the row leaves the virtual\r\n * window, the detail is collapsed, the column or the renderer changes, the\r\n * grid is disconnected): unmount framework roots here. Created on first\r\n * access.\r\n */\r\n readonly signal: AbortSignal;\r\n}\r\n\r\n/** Context of a cell `renderer`. */\r\nexport interface GridCellRenderContext<TItem = any> extends GridRenderContextBase {\r\n /** The row item. */\r\n readonly item: TItem;\r\n /** Cell value (`valueGetter` or `path`). */\r\n readonly value: unknown;\r\n /** The text the native cell would show (`format`, `displayValue`, `emptyText`, boolean texts). */\r\n readonly text: string;\r\n /** The column of the cell. */\r\n readonly column: GridColumnDef<TItem>;\r\n /** Row key (without `keyExpr`, the item itself). */\r\n readonly rowKey: unknown;\r\n /**\r\n * `true` when the value is drawn in the row details because the column is\r\n * hidden for lack of space (`autoHideColumns`), `false` in the table cell.\r\n * Moving between the two discards the content (the `signal` aborts).\r\n */\r\n readonly adaptive: boolean;\r\n}\r\n\r\n/** Context of a `headerRenderer`. */\r\nexport interface GridHeaderRenderContext<TItem = any> extends GridRenderContextBase {\r\n /** The column of the header; in a band header, the band (it has `columns` and no `path`). */\r\n readonly column: GridColumnDef<TItem>;\r\n}\r\n\r\n/** Context of a `groupRenderer`. */\r\nexport interface GridGroupRenderContext<TItem = any> extends GridRenderContextBase {\r\n /** The grouped column. */\r\n readonly column: GridColumnDef<TItem>;\r\n /** Group value. */\r\n readonly value: unknown;\r\n /** Group value formatted as the grid shows it. */\r\n readonly text: string;\r\n /** Values of the group from the outermost level. */\r\n readonly groupPath: GridGroupPath;\r\n /** Grouping level (0-based). */\r\n readonly groupIndex: number;\r\n /** Rows in the group (after filtering). */\r\n readonly itemCount: number;\r\n /** Whether the group is expanded. */\r\n readonly expanded: boolean;\r\n /** Summaries shown in the group row text (`display: 'inline'`). */\r\n readonly summaries: readonly GridSummaryValue<TItem>[];\r\n /** The full label the grid would show (`\"Country: Brazil (3, Sum of Population: 1,234)\"`). */\r\n readonly defaultText: string;\r\n}\r\n\r\n/** Context of the grid `detailRenderer`. */\r\nexport interface GridDetailRenderContext<TItem = any> extends GridRenderContextBase {\r\n /** The master row item. */\r\n readonly item: TItem;\r\n /** Key of the master row. */\r\n readonly rowKey: unknown;\r\n}\r\n\r\n/** Side a row is fixed to (`fixedTopItems` / `fixedBottomItems`); `null` = a body row. */\r\nexport type GridRowFixed = 'top' | 'bottom' | null;\r\n\r\n/** Context of the grid `rowRenderer`. */\r\nexport interface GridRowRenderContext<TItem = any> extends GridRenderContextBase {\r\n /** The row item. */\r\n readonly item: TItem;\r\n /** Row key (without `keyExpr`, the item itself). */\r\n readonly rowKey: unknown;\r\n /** `'top'`/`'bottom'` in a fixed row, `null` in a body row. */\r\n readonly fixed: GridRowFixed;\r\n /**\r\n * Aborted when the grid discards this content (the row leaves the virtual\r\n * window, the item or the renderer changes, the grid is disconnected) and\r\n * immediately when the renderer returns `false`. Created on first access.\r\n */\r\n readonly signal: AbortSignal;\r\n}\r\n\r\n/** Context of the grid `noDataRenderer`. */\r\nexport interface GridNoDataRenderContext extends GridRenderContextBase {\r\n /** `true` when there are items but the filter or the search hides them all. */\r\n readonly filtered: boolean;\r\n}\r\n\r\n/**\r\n * Cell renderer: a pure function of the item and the column. It runs again\r\n * when the item, the column object or the language change and when the row\r\n * comes back to the virtual window — so it may run several times for the\r\n * same item —, never when selecting, focusing or sorting (nor when the item\r\n * is mutated).\r\n */\r\nexport type GridCellRenderer<TItem = any> = (item: TItem, ctx: GridCellRenderContext<TItem>) => GridRenderResult;\r\n\r\n/** Header label renderer (runs again when the column or the language change). */\r\nexport type GridHeaderRenderer<TItem = any> = (ctx: GridHeaderRenderContext<TItem>) => GridRenderResult;\r\n\r\n/** Group row label renderer (runs again when any member of the context changes). */\r\nexport type GridGroupRenderer<TItem = any> = (ctx: GridGroupRenderContext<TItem>) => GridRenderResult;\r\n\r\n/** Detail row renderer (master-detail). `null` renders an empty detail row (the toggle stays). */\r\nexport type GridDetailRenderer<TItem = any> = (item: TItem, ctx: GridDetailRenderContext<TItem>) => GridRenderResult;\r\n\r\n/**\r\n * What a `rowRenderer` returns: the content of a full-width row, or `false`\r\n * to keep the row's columns. `null`, `undefined`, `''` and Lit's `nothing`\r\n * are an EMPTY full-width row, not a normal one.\r\n */\r\nexport type GridRowRenderResult = GridRenderResult | false;\r\n\r\n/**\r\n * Full-width row renderer: the content of ONE cell spanning the data\r\n * columns of a data or fixed row (the group indents, the detail toggle and\r\n * the selection checkbox stay). Return `false` (not `nothing`/`null`/`''`)\r\n * to keep that row's columns — `cond && html\\`…\\`` works,\r\n * `cond ? html\\`…\\` : nothing` gives empty full-width rows.\r\n *\r\n * Called for every rendered data or fixed row: decide `false` first,\r\n * deterministically and without touching `document` (the server and the\r\n * client must take the same decision), before building any content. The\r\n * result (including `false`) is cached per row: it runs again when the item\r\n * object, the `rowRenderer` function or the language change and when the\r\n * row comes back to the virtual window — to re-decide, assign a new item\r\n * object or a new function. A renderer that throws keeps the row's columns\r\n * (one `console.error`). Never called for group, summary, detail and\r\n * skeleton rows nor for a row being added (`addRow`).\r\n */\r\nexport type GridRowRenderer<TItem = any> = (item: TItem, ctx: GridRowRenderContext<TItem>) => GridRowRenderResult;\r\n\r\n/** Empty state renderer (no rows to show). */\r\nexport type GridNoDataRenderer = (ctx: GridNoDataRenderContext) => GridRenderResult;\r\n\r\n/**\r\n * O usuário pode agrupar pela coluna?\r\n * @internal\r\n */\r\nexport const isColumnGroupable = (column: GridColumnDef): boolean =>\r\n column.groupable ?? (!!column.path || !!column.valueGetter || !!column.groupValueGetter);\r\n\r\n/**\r\n * A coluna pode ser ordenada pelo usuário?\r\n * @internal\r\n */\r\nexport const isColumnSortable = (column: GridColumnDef): boolean =>\r\n column.sortable ?? (!!column.path || !!column.valueGetter || !!column.comparator);\r\n\r\n/**\r\n * A coluna entra na exportação e na área de transferência?\r\n * @internal\r\n */\r\nexport const isColumnExportable = (column: GridColumnDef): boolean =>\r\n column.exportable ?? (!!column.path || !!column.valueGetter || !!column.displayValue);\r\n\r\n/**\r\n * A coluna pode ser filtrada pelo usuário? (a expressão aponta a coluna pelo `path`)\r\n * @internal\r\n */\r\nexport const isColumnFilterable = (column: GridColumnDef): boolean =>\r\n !!column.path && column.filterable !== false;\r\n\r\n// ----------------------------------------------------------------- edição\r\n\r\n/** Writes an edited `value` into `data` (the pending change of the row); `item` is the original row (empty object for new rows). */\r\nexport type GridValueSetter<TItem = any> = (data: Partial<TItem>, value: unknown, item: TItem) => void;\r\n\r\n/** What a validation rule receives. */\r\nexport interface GridValidationContext<TItem = any> {\r\n /** The value being checked. */\r\n readonly value: unknown;\r\n /** The original row item (empty object for a new row). */\r\n readonly item: TItem;\r\n /** The pending change of the row (fields edited so far, this value included). */\r\n readonly data: Partial<TItem>;\r\n /** The column of the value. */\r\n readonly column: GridColumnDef<TItem>;\r\n /** Row key (a new row has an opaque provisional key). */\r\n readonly rowKey: unknown;\r\n}\r\n\r\n/** Members shared by every validation rule. */\r\nexport interface GridValidationRuleBase {\r\n /** Error text; default: the grid translation of the rule. */\r\n message?: string;\r\n}\r\n\r\n/** The value cannot be empty (`null`, `undefined`, `''`, or only spaces with `trim`). */\r\nexport interface GridRequiredRule extends GridValidationRuleBase {\r\n type: 'required';\r\n /** Spaces only count as empty. Default `true`. */\r\n trim?: boolean;\r\n}\r\n\r\n/** A number or date between `min` and `max` (inclusive). */\r\nexport interface GridRangeRule extends GridValidationRuleBase {\r\n type: 'range';\r\n min?: number | Date;\r\n max?: number | Date;\r\n}\r\n\r\n/** Text length between `min` and `max` characters. */\r\nexport interface GridStringLengthRule extends GridValidationRuleBase {\r\n type: 'stringLength';\r\n min?: number;\r\n max?: number;\r\n}\r\n\r\n/** The text matches `pattern`; a string matches the whole value, like the HTML `pattern` attribute. */\r\nexport interface GridPatternRule extends GridValidationRuleBase {\r\n type: 'pattern';\r\n pattern: RegExp | string;\r\n}\r\n\r\n/** An e-mail address (the rule of `<input type=\"email\">`). */\r\nexport interface GridEmailRule extends GridValidationRuleBase {\r\n type: 'email';\r\n}\r\n\r\n/**\r\n * Host check: return `true` (valid), `false` (invalid, `message` or the\r\n * default text) or an error text; or a promise of it (server check). The\r\n * `signal` aborts when the value changes again or the edit ends: a stale\r\n * answer is ignored.\r\n */\r\nexport interface GridCustomRule<TItem = any> extends GridValidationRuleBase {\r\n type: 'custom';\r\n validate: (ctx: GridValidationContext<TItem>, signal: AbortSignal) => boolean | string | Promise<boolean | string>;\r\n}\r\n\r\n/**\r\n * A validation rule of `validationRules`. Empty values only fail `required`\r\n * (and `custom`, which always runs).\r\n */\r\nexport type GridValidationRule<TItem = any> =\r\n | GridRequiredRule\r\n | GridRangeRule\r\n | GridStringLengthRule\r\n | GridPatternRule\r\n | GridEmailRule\r\n | GridCustomRule<TItem>;\r\n\r\n/** Context of an `editorRenderer`. */\r\nexport interface GridEditorRenderContext<TItem = any> extends GridRenderContextBase {\r\n /** The original row item (empty object for a new row). */\r\n readonly item: TItem;\r\n /** The value being edited (pending, not yet saved). */\r\n readonly value: unknown;\r\n /** The pending change of the row. */\r\n readonly data: Partial<TItem>;\r\n /** The column of the cell. */\r\n readonly column: GridColumnDef<TItem>;\r\n /** Row key (a new row has an opaque provisional key). */\r\n readonly rowKey: unknown;\r\n /** Accessible name for the editor (the column label). */\r\n readonly label: string;\r\n /** `true` when the editor is in the row details (column hidden for lack of space, `autoHideColumns`). */\r\n readonly adaptive: boolean;\r\n /** The value failed a validation rule. */\r\n readonly invalid: boolean;\r\n /** Error text of the value (`''` when valid). */\r\n readonly errorMessage: string;\r\n /**\r\n * Id of the element with the error text, for `aria-describedby` — only for\r\n * editors rendered in the grid's shadow DOM (`TemplateResult`). For an\r\n * `HTMLElement` editor the grid places the text in its light DOM and sets\r\n * `aria-label`, `aria-invalid` and `aria-describedby` when missing.\r\n */\r\n readonly describedBy: string;\r\n /** Changes the edited value (the grid validates it on commit). */\r\n setValue(value: unknown): void;\r\n /** Commits the value (like Enter, without moving). */\r\n commit(): void;\r\n /** Discards the value and closes the editor (like Esc). */\r\n cancel(): void;\r\n}\r\n\r\n/**\r\n * Editor of a cell: focus goes to the first focusable element it renders.\r\n * It runs when the editor opens and again when the validity of the value\r\n * changes (`invalid`, `errorMessage`): keep the value in `setValue`.\r\n * The grid handles Enter, Tab and Esc unless the editor calls\r\n * `preventDefault()` on the `keydown` (a combobox that uses Enter).\r\n */\r\nexport type GridEditorRenderer<TItem = any> = (item: TItem, ctx: GridEditorRenderContext<TItem>) => GridRenderResult;\r\n\r\n/**\r\n * A coluna é editável (sem olhar o `allowEditing` do grid)? Padrão: com\r\n * `path` ou `valueSetter`.\r\n * @internal\r\n */\r\nexport const isColumnEditable = (column: GridColumnDef): boolean =>\r\n column.editable ?? (!!column.path || !!column.valueSetter);\r\n\r\n/**\r\n * A coluna é banda (`columns` com pelo menos 1 item).\r\n * @internal\r\n */\r\nexport const isBand = (column: GridColumnDef | null | undefined): boolean =>\r\n !!column && Array.isArray(column.columns) && column.columns.length > 0;\r\n\r\n/**\r\n * How columns are rendered: `virtual` keeps only the columns in view (plus the\r\n * fixed ones and the focused one) in the DOM; `standard` renders all;\r\n * `auto` is `virtual` with more than 50 leaf columns defined.\r\n */\r\nexport type GridColumnRenderingMode = 'auto' | 'virtual' | 'standard';\r\n"]}