@universal-material/data-grid 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/README.md +37 -20
  2. package/custom-elements.json +149 -22
  3. package/dist/data/data-source.d.ts +6 -2
  4. package/dist/data/data-source.js.map +1 -1
  5. package/dist/export/types.d.ts +1 -1
  6. package/dist/export/types.js.map +1 -1
  7. package/dist/export-xlsx/index.d.ts +2 -1
  8. package/dist/export-xlsx/index.js +4 -2
  9. package/dist/export-xlsx/index.js.map +1 -1
  10. package/dist/features/column-chooser.js +4 -3
  11. package/dist/features/column-chooser.js.map +1 -1
  12. package/dist/features/filter-row.d.ts +1 -0
  13. package/dist/features/filter-row.js +16 -10
  14. package/dist/features/filter-row.js.map +1 -1
  15. package/dist/features/header-filter.d.ts +9 -2
  16. package/dist/features/header-filter.js +22 -11
  17. package/dist/features/header-filter.js.map +1 -1
  18. package/dist/features/scroll-port.d.ts +51 -0
  19. package/dist/features/scroll-port.js +329 -0
  20. package/dist/features/scroll-port.js.map +1 -0
  21. package/dist/grid-column-def.d.ts +60 -14
  22. package/dist/grid-column-def.js +6 -2
  23. package/dist/grid-column-def.js.map +1 -1
  24. package/dist/grid-column.d.ts +31 -7
  25. package/dist/grid-column.js +40 -7
  26. package/dist/grid-column.js.map +1 -1
  27. package/dist/grid-i18n.js +14 -14
  28. package/dist/grid-i18n.js.map +1 -1
  29. package/dist/grid.d.ts +61 -14
  30. package/dist/grid.js +758 -165
  31. package/dist/grid.js.map +1 -1
  32. package/dist/grid.min.js +621 -474
  33. package/dist/grid.styles.js +153 -15
  34. package/dist/grid.styles.js.map +1 -1
  35. package/dist/render/cell.js +5 -2
  36. package/dist/render/cell.js.map +1 -1
  37. package/dist/render/group-row.js +2 -1
  38. package/dist/render/group-row.js.map +1 -1
  39. package/dist/render/header.d.ts +17 -1
  40. package/dist/render/header.js +23 -2
  41. package/dist/render/header.js.map +1 -1
  42. package/dist/render/virtualizer.d.ts +49 -1
  43. package/dist/render/virtualizer.js +229 -17
  44. package/dist/render/virtualizer.js.map +1 -1
  45. package/dist/row-model/columns.d.ts +40 -0
  46. package/dist/row-model/columns.js +25 -0
  47. package/dist/row-model/columns.js.map +1 -1
  48. package/dist/row-model/filter.d.ts +19 -4
  49. package/dist/row-model/filter.js +29 -9
  50. package/dist/row-model/filter.js.map +1 -1
  51. package/dist/row-model/format.js +1 -1
  52. package/dist/row-model/format.js.map +1 -1
  53. package/dist/state/grid-state.d.ts +2 -2
  54. package/dist/state/grid-state.js.map +1 -1
  55. package/package.json +7 -3
@@ -1 +1 @@
1
- {"version":3,"file":"grid-column-def.js","sourceRoot":"","sources":["../src/grid-column-def.ts"],"names":[],"mappings":"AAicA;;;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 `center`), `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 /** Header label. */\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 /** Builds the header label (sort arrow, filter button and resize handle stay). `label` is still required. */\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/** A column of the grid: its `name`, its `path` (first column with that name, else with that path) or the column itself. */\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"]}
1
+ {"version":3,"file":"grid-column-def.js","sourceRoot":"","sources":["../src/grid-column-def.ts"],"names":[],"mappings":"AA+eA;;;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;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,MAAqB,EAAW,EAAE,CACnE,MAAM,CAAC,UAAU,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,IAAI,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;AA8H5F;;;;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/**\r\n * Boolean as text (`trueText`/`falseText`), as a read-only check/cross icon\r\n * (`icon`) or as a check for `true` only (`check`: `false` shows nothing, its\r\n * text stays for screen readers).\r\n */\r\nexport type GridColumnBooleanDisplay = 'text' | 'icon' | 'check';\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: `[field, operation, value]`. `field` is the column `path`\r\n * or, for a column without `path` (computed by `valueGetter`), its `name`;\r\n * a `path` match wins over a `name` (the reverse of `GridColumnRef`), and a\r\n * field that matches no column is read from the items as a dot 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 [field: string, operation: GridFilterOperation, value?: unknown]\r\n | readonly [field: 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`, or the `name` of a column with a `valueGetter`) 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`) and, for a column without `path`, in filter conditions\r\n * (`filterValue`). Default: `path`. A column without `name` and `path` is\r\n * left out 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 /**\r\n * `'text'` (default: `trueText`/`falseText`), `'icon'` (read-only check/cross,\r\n * the text as its accessible name) or `'check'` (check for `true` only;\r\n * `false` keeps its text for screen readers).\r\n */\r\n booleanDisplay?: GridColumnBooleanDisplay | null;\r\n /**\r\n * Text of `true` in a boolean column (declared or inferred): cell, icon\r\n * name, group row, filters, copy/paste, summaries and export. Empty or\r\n * `null`: the language's `trueText`. A fixed text: it does not follow\r\n * `language`.\r\n */\r\n trueText?: string | null;\r\n /** Text of `false` in a boolean column, like `trueText`. Empty or `null`: the language's `falseText`. */\r\n falseText?: string | null;\r\n /** Wraps the cell text in several lines instead of an ellipsis (cells only; see `headerWrap`). */\r\n wrap?: boolean;\r\n /**\r\n * Wraps the header label in several lines instead of an ellipsis; the\r\n * header row grows. `null`/absent: the grid's `headerWrap`; `false` turns it\r\n * off for this column.\r\n */\r\n headerWrap?: boolean | null;\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` with a `path`, or with a\r\n * `valueGetter` and a `name` (not with remote filtering). The filter\r\n * expression refers to the column by `path` or, without one, by `name`.\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 /**\r\n * The first row of the group in the current order (after filtering), to\r\n * show data of the group's rows (an icon, a link); `undefined` when the\r\n * group has no loaded rows (remote groups).\r\n */\r\n readonly firstItem: TItem | undefined;\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, olhando só a coluna? A condição a\r\n * aponta pelo `path` ou, sem `path`, pelo `name` (spec 28). Padrão: com\r\n * `path`, ou com `valueGetter` e `name` (sem getter a coluna sem `path` não\r\n * tem valor; `filterable: true` não muda isso). O grid ainda tira a colisão\r\n * de `name` e o remoto.\r\n * @internal\r\n */\r\nexport const isColumnFilterable = (column: GridColumnDef): boolean =>\r\n column.filterable !== false && (!!column.path || (!!column.valueGetter && !!column.name));\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"]}
@@ -30,8 +30,9 @@ export declare class DataGridColumn extends LitElement implements GridColumnDef
30
30
  /**
31
31
  * Stable id of the column in the grid state (`getState`, `stateStorage`)
32
32
  * and in string column references (`summary` items look it up before
33
- * `path`). Default: `path`. A column without `name` and `path` is left out
34
- * of the state.
33
+ * `path`) and, for a column without `path`, in filter conditions
34
+ * (`filterValue`). Default: `path`. A column without `name` and `path` is
35
+ * left out of the state.
35
36
  */
36
37
  name: string;
37
38
  /**
@@ -40,7 +41,10 @@ export declare class DataGridColumn extends LitElement implements GridColumnDef
40
41
  * light DOM). `null`, `undefined` and Lit's `nothing` render an empty cell.
41
42
  */
42
43
  renderer: GridCellRenderer | null;
43
- /** Builds the header label (property only); sort arrow, filter button and resize handle stay. */
44
+ /**
45
+ * Builds the header label (property only); sort arrow, filter button and resize handle stay. Keep
46
+ * the text content: it still names the column outside the header (menus, chooser, announcements, export).
47
+ */
44
48
  headerRenderer: GridHeaderRenderer | null;
45
49
  /** Builds the label of the group rows of this column (property only); the expand button and aligned summaries stay. */
46
50
  groupRenderer: GridGroupRenderer | null;
@@ -59,10 +63,26 @@ export declare class DataGridColumn extends LitElement implements GridColumnDef
59
63
  valueGetter: ((item: any) => unknown) | null;
60
64
  /** Displayed text (cell and group row); wins over `format` (property only). */
61
65
  displayValue: ((value: unknown, item: any) => string) | null;
62
- /** `text` (default) or `icon` (read-only check icon) for boolean columns. */
66
+ /**
67
+ * `text` (default), `icon` (read-only check/cross icon) or `check` (check
68
+ * icon for `true`, nothing visible for `false`) for boolean columns.
69
+ */
63
70
  booleanDisplay: GridColumnBooleanDisplay | null;
71
+ /**
72
+ * Text of `true` in this boolean column (cell, icon name, group row, filters,
73
+ * copy/paste, summaries, export). Empty or unset: the language's `trueText`;
74
+ * a fixed text, it does not follow `language`.
75
+ */
76
+ trueText: string | null;
77
+ /** Text of `false` in this boolean column, like `trueText`. Empty or unset: the language's `falseText`. */
78
+ falseText: string | null;
64
79
  /** Wraps the text in several lines instead of an ellipsis (`wrap="false"` turns it off). */
65
80
  wrap: boolean;
81
+ /**
82
+ * Wraps the header label in several lines (`header-wrap`); `header-wrap="false"`
83
+ * turns off the grid's `header-wrap` for this column. Unset: the grid's.
84
+ */
85
+ headerWrap: boolean | null;
66
86
  /** Minimum width in px (also when resizing and auto-sizing). */
67
87
  minWidth: number | null;
68
88
  /** Text for empty values (`null`/`undefined`). */
@@ -112,8 +132,9 @@ export declare class DataGridColumn extends LitElement implements GridColumnDef
112
132
  groupable: boolean | null;
113
133
  /**
114
134
  * Allows filtering by this column (filter row, header filter and, by
115
- * default, the search panel). Default (`null`): `true` when the column has
116
- * a `path`. `filterable="false"` disables it.
135
+ * default, the search panel). Default (`null`): `true` with a `path`, or
136
+ * with a `valueGetter` and a `name` (not with remote filtering).
137
+ * `filterable="false"` disables it.
117
138
  */
118
139
  filterable: boolean | null;
119
140
  /**
@@ -155,7 +176,10 @@ export declare class DataGridColumn extends LitElement implements GridColumnDef
155
176
  * frozen and stays the same while the nested columns don't change.
156
177
  */
157
178
  get columns(): readonly DataGridColumn[] | null;
158
- /** Header label: the trimmed text content of the element, without the text of nested columns. */
179
+ /**
180
+ * Header label: the trimmed text content of the element, without the text of nested columns. Also
181
+ * the column's name outside the header. Empty: the header shows `path`; elsewhere `path`, then `name`, as is.
182
+ */
159
183
  get label(): string;
160
184
  protected render(): import("lit-html").TemplateResult<1>;
161
185
  }
@@ -33,8 +33,9 @@ let DataGridColumn = class DataGridColumn extends LitElement {
33
33
  /**
34
34
  * Stable id of the column in the grid state (`getState`, `stateStorage`)
35
35
  * and in string column references (`summary` items look it up before
36
- * `path`). Default: `path`. A column without `name` and `path` is left out
37
- * of the state.
36
+ * `path`) and, for a column without `path`, in filter conditions
37
+ * (`filterValue`). Default: `path`. A column without `name` and `path` is
38
+ * left out of the state.
38
39
  */
39
40
  this.name = '';
40
41
  /**
@@ -43,7 +44,10 @@ let DataGridColumn = class DataGridColumn extends LitElement {
43
44
  * light DOM). `null`, `undefined` and Lit's `nothing` render an empty cell.
44
45
  */
45
46
  this.renderer = null;
46
- /** Builds the header label (property only); sort arrow, filter button and resize handle stay. */
47
+ /**
48
+ * Builds the header label (property only); sort arrow, filter button and resize handle stay. Keep
49
+ * the text content: it still names the column outside the header (menus, chooser, announcements, export).
50
+ */
47
51
  this.headerRenderer = null;
48
52
  /** Builds the label of the group rows of this column (property only); the expand button and aligned summaries stay. */
49
53
  this.groupRenderer = null;
@@ -62,10 +66,26 @@ let DataGridColumn = class DataGridColumn extends LitElement {
62
66
  this.valueGetter = null;
63
67
  /** Displayed text (cell and group row); wins over `format` (property only). */
64
68
  this.displayValue = null;
65
- /** `text` (default) or `icon` (read-only check icon) for boolean columns. */
69
+ /**
70
+ * `text` (default), `icon` (read-only check/cross icon) or `check` (check
71
+ * icon for `true`, nothing visible for `false`) for boolean columns.
72
+ */
66
73
  this.booleanDisplay = null;
74
+ /**
75
+ * Text of `true` in this boolean column (cell, icon name, group row, filters,
76
+ * copy/paste, summaries, export). Empty or unset: the language's `trueText`;
77
+ * a fixed text, it does not follow `language`.
78
+ */
79
+ this.trueText = null;
80
+ /** Text of `false` in this boolean column, like `trueText`. Empty or unset: the language's `falseText`. */
81
+ this.falseText = null;
67
82
  /** Wraps the text in several lines instead of an ellipsis (`wrap="false"` turns it off). */
68
83
  this.wrap = false;
84
+ /**
85
+ * Wraps the header label in several lines (`header-wrap`); `header-wrap="false"`
86
+ * turns off the grid's `header-wrap` for this column. Unset: the grid's.
87
+ */
88
+ this.headerWrap = null;
69
89
  /** Minimum width in px (also when resizing and auto-sizing). */
70
90
  this.minWidth = null;
71
91
  /** Text for empty values (`null`/`undefined`). */
@@ -115,8 +135,9 @@ let DataGridColumn = class DataGridColumn extends LitElement {
115
135
  this.groupable = null;
116
136
  /**
117
137
  * Allows filtering by this column (filter row, header filter and, by
118
- * default, the search panel). Default (`null`): `true` when the column has
119
- * a `path`. `filterable="false"` disables it.
138
+ * default, the search panel). Default (`null`): `true` with a `path`, or
139
+ * with a `valueGetter` and a `name` (not with remote filtering).
140
+ * `filterable="false"` disables it.
120
141
  */
121
142
  this.filterable = null;
122
143
  /**
@@ -224,7 +245,10 @@ let DataGridColumn = class DataGridColumn extends LitElement {
224
245
  }
225
246
  return this.#nested.length ? this.#nested : null;
226
247
  }
227
- /** Header label: the trimmed text content of the element, without the text of nested columns. */
248
+ /**
249
+ * Header label: the trimmed text content of the element, without the text of nested columns. Also
250
+ * the column's name outside the header. Empty: the header shows `path`; elsewhere `path`, then `name`, as is.
251
+ */
228
252
  get label() {
229
253
  if (!this.columns) {
230
254
  return (this.textContent ?? '').trim();
@@ -300,9 +324,18 @@ __decorate([
300
324
  __decorate([
301
325
  property({ attribute: 'boolean-display' })
302
326
  ], DataGridColumn.prototype, "booleanDisplay", void 0);
327
+ __decorate([
328
+ property({ attribute: 'true-text' })
329
+ ], DataGridColumn.prototype, "trueText", void 0);
330
+ __decorate([
331
+ property({ attribute: 'false-text' })
332
+ ], DataGridColumn.prototype, "falseText", void 0);
303
333
  __decorate([
304
334
  property({ type: Boolean, converter: booleanAttribute(false) })
305
335
  ], DataGridColumn.prototype, "wrap", void 0);
336
+ __decorate([
337
+ property({ converter: optionalBoolean, attribute: 'header-wrap' })
338
+ ], DataGridColumn.prototype, "headerWrap", void 0);
306
339
  __decorate([
307
340
  property({ type: Number, attribute: 'min-width' })
308
341
  ], DataGridColumn.prototype, "minWidth", void 0);
@@ -1 +1 @@
1
- {"version":3,"file":"grid-column.js","sourceRoot":"","sources":["../src/grid-column.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAA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,CAAC,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC;kDAAmC;AAOQ;IAAnF,QAAQ,CAAC,EAAE,SAAS,EAAE,yBAAyB,EAAE,SAAS,EAAE,mBAAmB,EAAE,CAAC;wDAAgE;AAOzD;IAAzF,QAAQ,CAAC,EAAE,SAAS,EAAE,wBAAwB,EAAE,SAAS,EAAE,0BAA0B,EAAE,CAAC;8DAA2D;AAO1G;IAAzC,QAAQ,CAAC,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC;gDAAiC;AAG1C;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;sDAAkD;AAGjD;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;uDAA8D;AAG7D;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;mDAA4C;AA9MhE,cAAc;IAD1B,aAAa,CAAC,eAAe,CAAC;GAClB,cAAc,CAuS1B","sourcesContent":["import { html, LitElement, type PropertyValues } from 'lit';\r\nimport { customElement, property } from 'lit/decorators.js';\r\n\r\nimport { booleanAttribute, filterOperationAttribute, filterOperationsAttribute, type LegacyAttributes, optionalBooleanAttribute, optionalNumberAttribute } from './attribute-converters.js';\r\nimport type {\r\n GridCellRenderer,\r\n GridColumnAlignment,\r\n GridColumnBooleanDisplay,\r\n GridColumnComparator,\r\n GridColumnDataType,\r\n GridColumnDef,\r\n GridColumnFixed,\r\n GridColumnFormat,\r\n GridEditorRenderer,\r\n GridFilterOperation,\r\n GridGroupRenderer,\r\n GridHeaderRenderer,\r\n GridSortOrder,\r\n GridValidationRule,\r\n GridValueSetter,\r\n} from './grid-column-def.js';\r\n\r\n/**\r\n * `value`: muda o valor das células; `display`: só a exibição/layout.\r\n * @internal\r\n */\r\nexport type GridColumnChange = 'width' | 'groupIndex' | 'value' | 'display' | 'columns';\r\n\r\nconst optionalBoolean = optionalBooleanAttribute;\r\n\r\n/** Atributos renomeados na revisão de API (spec 15): antigo → novo. */\r\nconst LEGACY_ATTRIBUTES: LegacyAttributes = {\r\n 'data-type': 'type',\r\n};\r\n\r\n/** @internal */\r\ninterface ColumnHost extends HTMLElement {\r\n _columnChanged(column: GridColumnDef, change: GridColumnChange): void;\r\n}\r\n\r\nconst isColumnHost = (element: Element | null): element is ColumnHost =>\r\n !!element && typeof (element as Partial<ColumnHost>)._columnChanged === 'function';\r\n\r\nconst isColumnElement = (node: Node): node is DataGridColumn =>\r\n node instanceof Element && node.localName === 'u-grid-column';\r\n\r\nconst sameElements = (a: readonly Element[], b: readonly Element[]): boolean =>\r\n a.length === b.length && a.every((element, index) => element === b[index]);\r\n\r\nconst fixedSide = {\r\n fromAttribute: (value: string | null): GridColumnFixed =>\r\n value === 'start' || value === 'end' ? value : null,\r\n};\r\n\r\n/**\r\n * Declarative column of a `<u-grid>`: one direct child `<u-grid-column>` per\r\n * column. The text content is the header label. Every option mirrors a\r\n * `GridColumnDef` field with the same property name. A `<u-grid-column>`\r\n * with nested `<u-grid-column>` elements is a band (multi-level header).\r\n *\r\n * @slot - Header label text and, in a band, the nested `<u-grid-column>` elements.\r\n */\r\n@customElement('u-grid-column')\r\nexport class DataGridColumn extends LitElement implements GridColumnDef {\r\n\r\n static override get observedAttributes(): string[] {\r\n return [...super.observedAttributes, ...Object.keys(LEGACY_ATTRIBUTES)];\r\n }\r\n\r\n readonly #warnedDeprecations = new Set<string>();\r\n #nested: readonly DataGridColumn[] = Object.freeze([]);\r\n\r\n #width: number | null = null;\r\n #groupIndex: number | null = null;\r\n\r\n /**\r\n * Width in px. Changing it after the column is rendered overrides the width\r\n * chosen by the user. Under virtual column rendering (`columnRenderingMode`)\r\n * a column without `width` takes its auto-size width or `max(minWidth, 150)` px.\r\n */\r\n @property({ type: Number })\r\n get width(): number | null {\r\n return this.#width;\r\n }\r\n\r\n set width(value: number | null) {\r\n\r\n if (this.#width === value) {\r\n return;\r\n }\r\n\r\n this.#width = value;\r\n this.#notify('width');\r\n }\r\n\r\n /**\r\n * INITIAL grouping level. Afterwards grouping is grid state: use\r\n * `grid.groupColumn()` / `grid.ungroupColumn()`. Changing it after the\r\n * column is rendered still regroups, but is deprecated.\r\n */\r\n @property({ type: Number, attribute: 'group-index' })\r\n get groupIndex(): number | null {\r\n return this.#groupIndex;\r\n }\r\n\r\n set groupIndex(value: number | null) {\r\n\r\n if (this.#groupIndex === value) {\r\n return;\r\n }\r\n\r\n this.#groupIndex = value;\r\n this.#notify('groupIndex');\r\n }\r\n\r\n /** Dot path of the cell value in the row item (`\"address.city\"`). */\r\n @property() path = '';\r\n\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 @property() name = '';\r\n\r\n /**\r\n * Builds the cell content (property only): a Lit `TemplateResult`\r\n * (recommended), a string (text) or an `HTMLElement` (placed in the grid's\r\n * light DOM). `null`, `undefined` and Lit's `nothing` render an empty cell.\r\n */\r\n @property({ attribute: false }) renderer: GridCellRenderer | null = null;\r\n\r\n /** Builds the header label (property only); sort arrow, filter button and resize handle stay. */\r\n @property({ attribute: false }) headerRenderer: GridHeaderRenderer | null = null;\r\n\r\n /** Builds the label of the group rows of this column (property only); the expand button and aligned summaries stay. */\r\n @property({ attribute: false }) groupRenderer: GridGroupRenderer | null = null;\r\n\r\n /**\r\n * Data type of the column (`string`, `number`, `date`, `datetime`,\r\n * `boolean`); attribute `type`. Without it, inferred from the first\r\n * non-null value. The `data-type` attribute is deprecated (`data-*`\r\n * belongs to the page author).\r\n */\r\n @property({ attribute: 'type' }) dataType: GridColumnDataType | null = null;\r\n\r\n /** `Intl` options or a formatter function (property only). */\r\n @property({ attribute: false }) format: GridColumnFormat | null = null;\r\n\r\n /** Logical alignment (`start`, `center`, `end`); follows RTL. Default by data type. In a band, of the header label (default `start`). */\r\n @property() alignment: GridColumnAlignment | null = null;\r\n\r\n /** Computes the cell value used to group, sort and filter (property only). Default: read `path`. */\r\n @property({ attribute: false }) valueGetter: ((item: any) => unknown) | null = null;\r\n\r\n /** Displayed text (cell and group row); wins over `format` (property only). */\r\n @property({ attribute: false }) displayValue: ((value: unknown, item: any) => string) | null = null;\r\n\r\n /** `text` (default) or `icon` (read-only check icon) for boolean columns. */\r\n @property({ attribute: 'boolean-display' }) booleanDisplay: GridColumnBooleanDisplay | null = null;\r\n\r\n /** Wraps the text in several lines instead of an ellipsis (`wrap=\"false\"` turns it off). */\r\n @property({ type: Boolean, converter: booleanAttribute(false) }) wrap = false;\r\n\r\n /** Minimum width in px (also when resizing and auto-sizing). */\r\n @property({ type: Number, attribute: 'min-width' }) minWidth: number | null = null;\r\n\r\n /** Text for empty values (`null`/`undefined`). */\r\n @property({ attribute: 'empty-text' }) emptyText: string | null = null;\r\n\r\n /** Maximum width in px when resizing and auto-sizing. */\r\n @property({ type: Number, attribute: 'max-width' }) maxWidth: number | null = null;\r\n\r\n /**\r\n * Order in which the column leaves the table when the grid is too narrow\r\n * (`auto-hide-columns`; its values move to the row details): the lowest\r\n * goes first, ties from the end. When any column has a `hiding-priority`\r\n * (grouped or hidden ones included), only those columns hide; otherwise\r\n * columns hide from the last one. Fixed columns never hide. Empty or not a\r\n * number = none. Ignored on bands.\r\n */\r\n @property({ converter: optionalNumberAttribute, attribute: 'hiding-priority' }) hidingPriority: number | null = null;\r\n\r\n /** `resizable=\"false\"` prevents resizing this column even with `column-resizing`. */\r\n @property({ converter: optionalBoolean }) resizable: boolean | null = null;\r\n\r\n /**\r\n * Fixes the column at the `start` or `end` of the scrollable area (logical:\r\n * mirrors in RTL). A fixed band fixes its columns; ignored on nested columns.\r\n */\r\n @property({ converter: fixedSide }) fixed: GridColumnFixed = null;\r\n\r\n /** INITIAL visibility (`visible=\"false\"` hides). Afterwards the user changes it in the chooser. */\r\n @property({ converter: optionalBoolean }) visible: boolean | null = null;\r\n\r\n /** `show-in-chooser=\"false\"` removes the column from the chooser (the user cannot hide it). */\r\n @property({ converter: optionalBoolean, attribute: 'show-in-chooser' }) showInChooser: boolean | null = null;\r\n\r\n /** Allows sorting by this column. Default: `true` when it has a `path`, `valueGetter` or `comparator`. */\r\n @property({ converter: optionalBoolean }) sortable: boolean | null = null;\r\n\r\n /** Initial sort direction. Afterwards the sorting is grid state. */\r\n @property({ attribute: 'sort-order' }) sortOrder: GridSortOrder | null = null;\r\n\r\n /** Priority of the initial sort among columns (lower first). */\r\n @property({ type: Number, attribute: 'sort-index' }) sortIndex: number | null = null;\r\n\r\n /** Custom ascending comparator: `(valueA, valueB, itemA, itemB) => number`. */\r\n @property({ attribute: false }) comparator: GridColumnComparator | null = null;\r\n\r\n /**\r\n * Value used to GROUP by this column (a range or bucket: decade, initial\r\n * letter), property only. Groups are identified, sorted and shown by the\r\n * returned value; `dataType`, `comparator`, `format` and `displayValue` do\r\n * not apply to it.\r\n */\r\n @property({ attribute: false }) groupValueGetter: ((item: any) => unknown) | null = null;\r\n\r\n /**\r\n * Allows the user to group by this column (`groupable=\"false\"` prevents\r\n * it). Default: `true` when it has a `path`, `valueGetter` or\r\n * `groupValueGetter`. Only limits the user: `groupColumn()` still works.\r\n */\r\n @property({ converter: optionalBoolean }) groupable: boolean | null = null;\r\n\r\n /**\r\n * Allows filtering by this column (filter row, header filter and, by\r\n * default, the search panel). Default (`null`): `true` when the column has\r\n * a `path`. `filterable=\"false\"` disables it.\r\n */\r\n @property({ converter: optionalBoolean }) filterable: boolean | null = null;\r\n\r\n /**\r\n * Includes this column in exports (`exportCsv`, `getExportData`, the\r\n * xlsx adapter) and in Ctrl+C. Default (`null`): `true` when it has a\r\n * `path`, `valueGetter` or `displayValue` (a `renderer`-only column has no\r\n * text). `exportable=\"false\"` leaves it out.\r\n */\r\n @property({ converter: optionalBoolean }) exportable: boolean | null = null;\r\n\r\n /**\r\n * Operations of the filter row operation menu. Attribute: space separated\r\n * list (`filter-operations=\"contains startswith =\"`); unknown tokens are\r\n * ignored with a warning. Default by data type.\r\n */\r\n @property({ converter: filterOperationsAttribute, attribute: 'filter-operations' }) filterOperations: readonly GridFilterOperation[] | null = null;\r\n\r\n /**\r\n * Operation of the filter row editor. Default: `contains` for text, `=`\r\n * otherwise; one outside `filterOperations` falls back to the first of the\r\n * list. Unknown attribute values are ignored with a warning.\r\n */\r\n @property({ converter: filterOperationAttribute, attribute: 'default-filter-operation' }) defaultFilterOperation: GridFilterOperation | null = null;\r\n\r\n /**\r\n * Allows editing the cells of this column (with `allow-editing` on the\r\n * grid). Default (`null`): `true` when it has a `path` or a\r\n * `valueSetter`. `editable=\"false\"` makes it read-only.\r\n */\r\n @property({ converter: optionalBoolean }) editable: boolean | null = null;\r\n\r\n /** Builds the cell editor instead of the built-in one (property only). See `GridEditorRenderer`. */\r\n @property({ attribute: false }) editorRenderer: GridEditorRenderer | null = null;\r\n\r\n /** Rules checked when a value is committed and before saving (property only). See `GridValidationRule`. */\r\n @property({ attribute: false }) validationRules: readonly GridValidationRule[] | null = null;\r\n\r\n /** Writes an edited value into the pending change of the row (property only). Default: sets `path`. */\r\n @property({ attribute: false }) valueSetter: GridValueSetter | null = null;\r\n\r\n override attributeChangedCallback(name: string, old: string | null, value: string | null): void {\r\n const renamed = LEGACY_ATTRIBUTES[name];\r\n\r\n if (renamed) {\r\n this.#deprecated(`${name} attribute`, `${renamed} attribute`);\r\n // Conversor e propriedade são os do atributo novo.\r\n super.attributeChangedCallback(renamed, old, value);\r\n return;\r\n }\r\n\r\n super.attributeChangedCallback(name, old, value);\r\n }\r\n\r\n override willUpdate(changed: PropertyValues<this>): void {\r\n // Os valores iniciais o grid já lê ao montar as colunas.\r\n if (!this.hasUpdated) {\r\n return;\r\n }\r\n\r\n if (changed.has('path') || changed.has('valueGetter') || changed.has('dataType') || changed.has('comparator') || changed.has('groupValueGetter')) {\r\n this.#notify('value');\r\n } else if (changed.size) {\r\n this.#notify('display');\r\n }\r\n }\r\n\r\n /**\r\n * Nested `<u-grid-column>` elements (read-only): when there is at least\r\n * one, this column is a band. `null` without nested columns. The array is\r\n * frozen and stays the same while the nested columns don't change.\r\n */\r\n get columns(): readonly DataGridColumn[] | null {\r\n const nested = Array.from(this.children).filter(isColumnElement);\r\n\r\n if (!sameElements(nested, this.#nested)) {\r\n this.#nested = Object.freeze(nested);\r\n }\r\n\r\n return this.#nested.length ? this.#nested : null;\r\n }\r\n\r\n /** Header label: the trimmed text content of the element, without the text of nested columns. */\r\n get label(): string {\r\n if (!this.columns) {\r\n return (this.textContent ?? '').trim();\r\n }\r\n\r\n let text = '';\r\n\r\n for (const node of this.childNodes) {\r\n if (!isColumnElement(node)) {\r\n text += node.textContent ?? '';\r\n }\r\n }\r\n\r\n return text.trim();\r\n }\r\n\r\n // Só para saber quando as colunas aninhadas mudam (o grid não mostra este conteúdo).\r\n protected override render() {\r\n return html`<slot @slotchange=${this.#onSlotChange}></slot>`;\r\n }\r\n\r\n // O grid compara a árvore e ignora quando nada mudou.\r\n readonly #onSlotChange = (): void => this.#notify('columns');\r\n\r\n #deprecated(name: string, replacement: string): void {\r\n if (this.#warnedDeprecations.has(name)) {\r\n return;\r\n }\r\n\r\n this.#warnedDeprecations.add(name);\r\n console.warn(`<u-grid-column>: \"${name}\" is deprecated, use \"${replacement}\" instead.`);\r\n }\r\n\r\n #notify(change: GridColumnChange): void {\r\n // Coluna aninhada: sobe pelas bandas até o grid.\r\n let host = this.parentElement;\r\n\r\n while (host && !isColumnHost(host) && isColumnElement(host)) {\r\n host = host.parentElement;\r\n }\r\n\r\n if (isColumnHost(host)) {\r\n host._columnChanged(this, change);\r\n }\r\n }\r\n}\r\n\r\ndeclare global {\r\n interface HTMLElementTagNameMap {\r\n 'u-grid-column': DataGridColumn;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"grid-column.js","sourceRoot":"","sources":["../src/grid-column.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAuB,MAAM,KAAK,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,QAAQ,EA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IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;kDAAgD;AAQ/C;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;wDAA0D;AAO/C;IAAzC,QAAQ,CAAC,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC;iDAAkC;AAQjC;IAAzC,QAAQ,CAAC,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC;kDAAmC;AAQlC;IAAzC,QAAQ,CAAC,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC;kDAAmC;AAOQ;IAAnF,QAAQ,CAAC,EAAE,SAAS,EAAE,yBAAyB,EAAE,SAAS,EAAE,mBAAmB,EAAE,CAAC;wDAAgE;AAOzD;IAAzF,QAAQ,CAAC,EAAE,SAAS,EAAE,wBAAwB,EAAE,SAAS,EAAE,0BAA0B,EAAE,CAAC;8DAA2D;AAO1G;IAAzC,QAAQ,CAAC,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC;gDAAiC;AAG1C;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;sDAAkD;AAGjD;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;uDAA8D;AAG7D;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;mDAA4C;AAtOhE,cAAc;IAD1B,aAAa,CAAC,eAAe,CAAC;GAClB,cAAc,CAkU1B","sourcesContent":["import { html, LitElement, type PropertyValues } from 'lit';\r\nimport { customElement, property } from 'lit/decorators.js';\r\n\r\nimport { booleanAttribute, filterOperationAttribute, filterOperationsAttribute, type LegacyAttributes, optionalBooleanAttribute, optionalNumberAttribute } from './attribute-converters.js';\r\nimport type {\r\n GridCellRenderer,\r\n GridColumnAlignment,\r\n GridColumnBooleanDisplay,\r\n GridColumnComparator,\r\n GridColumnDataType,\r\n GridColumnDef,\r\n GridColumnFixed,\r\n GridColumnFormat,\r\n GridEditorRenderer,\r\n GridFilterOperation,\r\n GridGroupRenderer,\r\n GridHeaderRenderer,\r\n GridSortOrder,\r\n GridValidationRule,\r\n GridValueSetter,\r\n} from './grid-column-def.js';\r\n\r\n/**\r\n * `value`: muda o valor das células; `display`: só a exibição/layout.\r\n * @internal\r\n */\r\nexport type GridColumnChange = 'width' | 'groupIndex' | 'value' | 'display' | 'columns';\r\n\r\nconst optionalBoolean = optionalBooleanAttribute;\r\n\r\n/** Atributos renomeados na revisão de API (spec 15): antigo → novo. */\r\nconst LEGACY_ATTRIBUTES: LegacyAttributes = {\r\n 'data-type': 'type',\r\n};\r\n\r\n/** @internal */\r\ninterface ColumnHost extends HTMLElement {\r\n _columnChanged(column: GridColumnDef, change: GridColumnChange): void;\r\n}\r\n\r\nconst isColumnHost = (element: Element | null): element is ColumnHost =>\r\n !!element && typeof (element as Partial<ColumnHost>)._columnChanged === 'function';\r\n\r\nconst isColumnElement = (node: Node): node is DataGridColumn =>\r\n node instanceof Element && node.localName === 'u-grid-column';\r\n\r\nconst sameElements = (a: readonly Element[], b: readonly Element[]): boolean =>\r\n a.length === b.length && a.every((element, index) => element === b[index]);\r\n\r\nconst fixedSide = {\r\n fromAttribute: (value: string | null): GridColumnFixed =>\r\n value === 'start' || value === 'end' ? value : null,\r\n};\r\n\r\n/**\r\n * Declarative column of a `<u-grid>`: one direct child `<u-grid-column>` per\r\n * column. The text content is the header label. Every option mirrors a\r\n * `GridColumnDef` field with the same property name. A `<u-grid-column>`\r\n * with nested `<u-grid-column>` elements is a band (multi-level header).\r\n *\r\n * @slot - Header label text and, in a band, the nested `<u-grid-column>` elements.\r\n */\r\n@customElement('u-grid-column')\r\nexport class DataGridColumn extends LitElement implements GridColumnDef {\r\n\r\n static override get observedAttributes(): string[] {\r\n return [...super.observedAttributes, ...Object.keys(LEGACY_ATTRIBUTES)];\r\n }\r\n\r\n readonly #warnedDeprecations = new Set<string>();\r\n #nested: readonly DataGridColumn[] = Object.freeze([]);\r\n\r\n #width: number | null = null;\r\n #groupIndex: number | null = null;\r\n\r\n /**\r\n * Width in px. Changing it after the column is rendered overrides the width\r\n * chosen by the user. Under virtual column rendering (`columnRenderingMode`)\r\n * a column without `width` takes its auto-size width or `max(minWidth, 150)` px.\r\n */\r\n @property({ type: Number })\r\n get width(): number | null {\r\n return this.#width;\r\n }\r\n\r\n set width(value: number | null) {\r\n\r\n if (this.#width === value) {\r\n return;\r\n }\r\n\r\n this.#width = value;\r\n this.#notify('width');\r\n }\r\n\r\n /**\r\n * INITIAL grouping level. Afterwards grouping is grid state: use\r\n * `grid.groupColumn()` / `grid.ungroupColumn()`. Changing it after the\r\n * column is rendered still regroups, but is deprecated.\r\n */\r\n @property({ type: Number, attribute: 'group-index' })\r\n get groupIndex(): number | null {\r\n return this.#groupIndex;\r\n }\r\n\r\n set groupIndex(value: number | null) {\r\n\r\n if (this.#groupIndex === value) {\r\n return;\r\n }\r\n\r\n this.#groupIndex = value;\r\n this.#notify('groupIndex');\r\n }\r\n\r\n /** Dot path of the cell value in the row item (`\"address.city\"`). */\r\n @property() path = '';\r\n\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`) and, for a column without `path`, in filter conditions\r\n * (`filterValue`). Default: `path`. A column without `name` and `path` is\r\n * left out of the state.\r\n */\r\n @property() name = '';\r\n\r\n /**\r\n * Builds the cell content (property only): a Lit `TemplateResult`\r\n * (recommended), a string (text) or an `HTMLElement` (placed in the grid's\r\n * light DOM). `null`, `undefined` and Lit's `nothing` render an empty cell.\r\n */\r\n @property({ attribute: false }) renderer: GridCellRenderer | null = null;\r\n\r\n /**\r\n * Builds the header label (property only); sort arrow, filter button and resize handle stay. Keep\r\n * the text content: it still names the column outside the header (menus, chooser, announcements, export).\r\n */\r\n @property({ attribute: false }) headerRenderer: GridHeaderRenderer | null = null;\r\n\r\n /** Builds the label of the group rows of this column (property only); the expand button and aligned summaries stay. */\r\n @property({ attribute: false }) groupRenderer: GridGroupRenderer | null = null;\r\n\r\n /**\r\n * Data type of the column (`string`, `number`, `date`, `datetime`,\r\n * `boolean`); attribute `type`. Without it, inferred from the first\r\n * non-null value. The `data-type` attribute is deprecated (`data-*`\r\n * belongs to the page author).\r\n */\r\n @property({ attribute: 'type' }) dataType: GridColumnDataType | null = null;\r\n\r\n /** `Intl` options or a formatter function (property only). */\r\n @property({ attribute: false }) format: GridColumnFormat | null = null;\r\n\r\n /** Logical alignment (`start`, `center`, `end`); follows RTL. Default by data type. In a band, of the header label (default `start`). */\r\n @property() alignment: GridColumnAlignment | null = null;\r\n\r\n /** Computes the cell value used to group, sort and filter (property only). Default: read `path`. */\r\n @property({ attribute: false }) valueGetter: ((item: any) => unknown) | null = null;\r\n\r\n /** Displayed text (cell and group row); wins over `format` (property only). */\r\n @property({ attribute: false }) displayValue: ((value: unknown, item: any) => string) | null = null;\r\n\r\n /**\r\n * `text` (default), `icon` (read-only check/cross icon) or `check` (check\r\n * icon for `true`, nothing visible for `false`) for boolean columns.\r\n */\r\n @property({ attribute: 'boolean-display' }) booleanDisplay: GridColumnBooleanDisplay | null = null;\r\n\r\n /**\r\n * Text of `true` in this boolean column (cell, icon name, group row, filters,\r\n * copy/paste, summaries, export). Empty or unset: the language's `trueText`;\r\n * a fixed text, it does not follow `language`.\r\n */\r\n @property({ attribute: 'true-text' }) trueText: string | null = null;\r\n\r\n /** Text of `false` in this boolean column, like `trueText`. Empty or unset: the language's `falseText`. */\r\n @property({ attribute: 'false-text' }) falseText: string | null = null;\r\n\r\n /** Wraps the text in several lines instead of an ellipsis (`wrap=\"false\"` turns it off). */\r\n @property({ type: Boolean, converter: booleanAttribute(false) }) wrap = false;\r\n\r\n /**\r\n * Wraps the header label in several lines (`header-wrap`); `header-wrap=\"false\"`\r\n * turns off the grid's `header-wrap` for this column. Unset: the grid's.\r\n */\r\n @property({ converter: optionalBoolean, attribute: 'header-wrap' }) headerWrap: boolean | null = null;\r\n\r\n /** Minimum width in px (also when resizing and auto-sizing). */\r\n @property({ type: Number, attribute: 'min-width' }) minWidth: number | null = null;\r\n\r\n /** Text for empty values (`null`/`undefined`). */\r\n @property({ attribute: 'empty-text' }) emptyText: string | null = null;\r\n\r\n /** Maximum width in px when resizing and auto-sizing. */\r\n @property({ type: Number, attribute: 'max-width' }) maxWidth: number | null = null;\r\n\r\n /**\r\n * Order in which the column leaves the table when the grid is too narrow\r\n * (`auto-hide-columns`; its values move to the row details): the lowest\r\n * goes first, ties from the end. When any column has a `hiding-priority`\r\n * (grouped or hidden ones included), only those columns hide; otherwise\r\n * columns hide from the last one. Fixed columns never hide. Empty or not a\r\n * number = none. Ignored on bands.\r\n */\r\n @property({ converter: optionalNumberAttribute, attribute: 'hiding-priority' }) hidingPriority: number | null = null;\r\n\r\n /** `resizable=\"false\"` prevents resizing this column even with `column-resizing`. */\r\n @property({ converter: optionalBoolean }) resizable: boolean | null = null;\r\n\r\n /**\r\n * Fixes the column at the `start` or `end` of the scrollable area (logical:\r\n * mirrors in RTL). A fixed band fixes its columns; ignored on nested columns.\r\n */\r\n @property({ converter: fixedSide }) fixed: GridColumnFixed = null;\r\n\r\n /** INITIAL visibility (`visible=\"false\"` hides). Afterwards the user changes it in the chooser. */\r\n @property({ converter: optionalBoolean }) visible: boolean | null = null;\r\n\r\n /** `show-in-chooser=\"false\"` removes the column from the chooser (the user cannot hide it). */\r\n @property({ converter: optionalBoolean, attribute: 'show-in-chooser' }) showInChooser: boolean | null = null;\r\n\r\n /** Allows sorting by this column. Default: `true` when it has a `path`, `valueGetter` or `comparator`. */\r\n @property({ converter: optionalBoolean }) sortable: boolean | null = null;\r\n\r\n /** Initial sort direction. Afterwards the sorting is grid state. */\r\n @property({ attribute: 'sort-order' }) sortOrder: GridSortOrder | null = null;\r\n\r\n /** Priority of the initial sort among columns (lower first). */\r\n @property({ type: Number, attribute: 'sort-index' }) sortIndex: number | null = null;\r\n\r\n /** Custom ascending comparator: `(valueA, valueB, itemA, itemB) => number`. */\r\n @property({ attribute: false }) comparator: GridColumnComparator | null = null;\r\n\r\n /**\r\n * Value used to GROUP by this column (a range or bucket: decade, initial\r\n * letter), property only. Groups are identified, sorted and shown by the\r\n * returned value; `dataType`, `comparator`, `format` and `displayValue` do\r\n * not apply to it.\r\n */\r\n @property({ attribute: false }) groupValueGetter: ((item: any) => unknown) | null = null;\r\n\r\n /**\r\n * Allows the user to group by this column (`groupable=\"false\"` prevents\r\n * it). Default: `true` when it has a `path`, `valueGetter` or\r\n * `groupValueGetter`. Only limits the user: `groupColumn()` still works.\r\n */\r\n @property({ converter: optionalBoolean }) groupable: boolean | null = null;\r\n\r\n /**\r\n * Allows filtering by this column (filter row, header filter and, by\r\n * default, the search panel). Default (`null`): `true` with a `path`, or\r\n * with a `valueGetter` and a `name` (not with remote filtering).\r\n * `filterable=\"false\"` disables it.\r\n */\r\n @property({ converter: optionalBoolean }) filterable: boolean | null = null;\r\n\r\n /**\r\n * Includes this column in exports (`exportCsv`, `getExportData`, the\r\n * xlsx adapter) and in Ctrl+C. Default (`null`): `true` when it has a\r\n * `path`, `valueGetter` or `displayValue` (a `renderer`-only column has no\r\n * text). `exportable=\"false\"` leaves it out.\r\n */\r\n @property({ converter: optionalBoolean }) exportable: boolean | null = null;\r\n\r\n /**\r\n * Operations of the filter row operation menu. Attribute: space separated\r\n * list (`filter-operations=\"contains startswith =\"`); unknown tokens are\r\n * ignored with a warning. Default by data type.\r\n */\r\n @property({ converter: filterOperationsAttribute, attribute: 'filter-operations' }) filterOperations: readonly GridFilterOperation[] | null = null;\r\n\r\n /**\r\n * Operation of the filter row editor. Default: `contains` for text, `=`\r\n * otherwise; one outside `filterOperations` falls back to the first of the\r\n * list. Unknown attribute values are ignored with a warning.\r\n */\r\n @property({ converter: filterOperationAttribute, attribute: 'default-filter-operation' }) defaultFilterOperation: GridFilterOperation | null = null;\r\n\r\n /**\r\n * Allows editing the cells of this column (with `allow-editing` on the\r\n * grid). Default (`null`): `true` when it has a `path` or a\r\n * `valueSetter`. `editable=\"false\"` makes it read-only.\r\n */\r\n @property({ converter: optionalBoolean }) editable: boolean | null = null;\r\n\r\n /** Builds the cell editor instead of the built-in one (property only). See `GridEditorRenderer`. */\r\n @property({ attribute: false }) editorRenderer: GridEditorRenderer | null = null;\r\n\r\n /** Rules checked when a value is committed and before saving (property only). See `GridValidationRule`. */\r\n @property({ attribute: false }) validationRules: readonly GridValidationRule[] | null = null;\r\n\r\n /** Writes an edited value into the pending change of the row (property only). Default: sets `path`. */\r\n @property({ attribute: false }) valueSetter: GridValueSetter | null = null;\r\n\r\n override attributeChangedCallback(name: string, old: string | null, value: string | null): void {\r\n const renamed = LEGACY_ATTRIBUTES[name];\r\n\r\n if (renamed) {\r\n this.#deprecated(`${name} attribute`, `${renamed} attribute`);\r\n // Conversor e propriedade são os do atributo novo.\r\n super.attributeChangedCallback(renamed, old, value);\r\n return;\r\n }\r\n\r\n super.attributeChangedCallback(name, old, value);\r\n }\r\n\r\n override willUpdate(changed: PropertyValues<this>): void {\r\n // Os valores iniciais o grid já lê ao montar as colunas.\r\n if (!this.hasUpdated) {\r\n return;\r\n }\r\n\r\n if (changed.has('path') || changed.has('valueGetter') || changed.has('dataType') || changed.has('comparator') || changed.has('groupValueGetter')) {\r\n this.#notify('value');\r\n } else if (changed.size) {\r\n this.#notify('display');\r\n }\r\n }\r\n\r\n /**\r\n * Nested `<u-grid-column>` elements (read-only): when there is at least\r\n * one, this column is a band. `null` without nested columns. The array is\r\n * frozen and stays the same while the nested columns don't change.\r\n */\r\n get columns(): readonly DataGridColumn[] | null {\r\n const nested = Array.from(this.children).filter(isColumnElement);\r\n\r\n if (!sameElements(nested, this.#nested)) {\r\n this.#nested = Object.freeze(nested);\r\n }\r\n\r\n return this.#nested.length ? this.#nested : null;\r\n }\r\n\r\n /**\r\n * Header label: the trimmed text content of the element, without the text of nested columns. Also\r\n * the column's name outside the header. Empty: the header shows `path`; elsewhere `path`, then `name`, as is.\r\n */\r\n get label(): string {\r\n if (!this.columns) {\r\n return (this.textContent ?? '').trim();\r\n }\r\n\r\n let text = '';\r\n\r\n for (const node of this.childNodes) {\r\n if (!isColumnElement(node)) {\r\n text += node.textContent ?? '';\r\n }\r\n }\r\n\r\n return text.trim();\r\n }\r\n\r\n // Só para saber quando as colunas aninhadas mudam (o grid não mostra este conteúdo).\r\n protected override render() {\r\n return html`<slot @slotchange=${this.#onSlotChange}></slot>`;\r\n }\r\n\r\n // O grid compara a árvore e ignora quando nada mudou.\r\n readonly #onSlotChange = (): void => this.#notify('columns');\r\n\r\n #deprecated(name: string, replacement: string): void {\r\n if (this.#warnedDeprecations.has(name)) {\r\n return;\r\n }\r\n\r\n this.#warnedDeprecations.add(name);\r\n console.warn(`<u-grid-column>: \"${name}\" is deprecated, use \"${replacement}\" instead.`);\r\n }\r\n\r\n #notify(change: GridColumnChange): void {\r\n // Coluna aninhada: sobe pelas bandas até o grid.\r\n let host = this.parentElement;\r\n\r\n while (host && !isColumnHost(host) && isColumnElement(host)) {\r\n host = host.parentElement;\r\n }\r\n\r\n if (isColumnHost(host)) {\r\n host._columnChanged(this, change);\r\n }\r\n }\r\n}\r\n\r\ndeclare global {\r\n interface HTMLElementTagNameMap {\r\n 'u-grid-column': DataGridColumn;\r\n }\r\n}\r\n"]}
package/dist/grid-i18n.js CHANGED
@@ -51,7 +51,7 @@ export const DEFAULT_GRID_LANGUAGE = 'en';
51
51
  export const gridTranslations = Object.assign(Object.create(null), {
52
52
  en: {
53
53
  noData: 'No data',
54
- dragToGroup: 'Drag a column header here, or press Ctrl+G on a header, to group by it',
54
+ dragToGroup: 'Drag a column header here, or press Ctrl+G on one, to group',
55
55
  groupLabelSeparator: ': ',
56
56
  sortAscending: 'ascending',
57
57
  sortDescending: 'descending',
@@ -266,7 +266,7 @@ export const gridTranslations = Object.assign(Object.create(null), {
266
266
  },
267
267
  es: {
268
268
  noData: 'Sin datos',
269
- dragToGroup: 'Arrastre aquí el encabezado de una columna, o pulse Ctrl+G en un encabezado, para agrupar',
269
+ dragToGroup: 'Arrastre un encabezado aquí o pulse Ctrl+G en él para agrupar',
270
270
  groupLabelSeparator: ': ',
271
271
  sortAscending: 'ascendente',
272
272
  sortDescending: 'descendente',
@@ -481,7 +481,7 @@ export const gridTranslations = Object.assign(Object.create(null), {
481
481
  },
482
482
  pt: {
483
483
  noData: 'Sem dados',
484
- dragToGroup: 'Arraste o cabeçalho de uma coluna aqui, ou pressione Ctrl+G num cabeçalho, para agrupar',
484
+ dragToGroup: 'Arraste um cabeçalho aqui ou pressione Ctrl+G nele para agrupar',
485
485
  groupLabelSeparator: ': ',
486
486
  sortAscending: 'crescente',
487
487
  sortDescending: 'decrescente',
@@ -696,7 +696,7 @@ export const gridTranslations = Object.assign(Object.create(null), {
696
696
  },
697
697
  fr: {
698
698
  noData: 'Aucune donnée',
699
- dragToGroup: 'Faites glisser l’en-tête d’une colonne ici, ou appuyez sur Ctrl+G sur un en-tête, pour regrouper',
699
+ dragToGroup: 'Glissez un en-tête ici ou appuyez sur Ctrl+G dessus pour regrouper',
700
700
  groupLabelSeparator: ' : ',
701
701
  sortAscending: 'croissant',
702
702
  sortDescending: 'décroissant',
@@ -911,7 +911,7 @@ export const gridTranslations = Object.assign(Object.create(null), {
911
911
  },
912
912
  de: {
913
913
  noData: 'Keine Daten',
914
- dragToGroup: 'Ziehen Sie eine Spaltenüberschrift hierher oder drücken Sie Strg+G auf einer Überschrift, um zu gruppieren',
914
+ dragToGroup: 'Spaltenüberschrift hierher ziehen oder Strg+G darauf drücken, um zu gruppieren',
915
915
  groupLabelSeparator: ': ',
916
916
  sortAscending: 'aufsteigend',
917
917
  sortDescending: 'absteigend',
@@ -1126,7 +1126,7 @@ export const gridTranslations = Object.assign(Object.create(null), {
1126
1126
  },
1127
1127
  it: {
1128
1128
  noData: 'Nessun dato',
1129
- dragToGroup: 'Trascina qui l’intestazione di una colonna, o premi Ctrl+G su un’intestazione, per raggruppare',
1129
+ dragToGroup: 'Trascina qui un’intestazione o premi Ctrl+G su di essa per raggruppare',
1130
1130
  groupLabelSeparator: ': ',
1131
1131
  sortAscending: 'crescente',
1132
1132
  sortDescending: 'decrescente',
@@ -1341,7 +1341,7 @@ export const gridTranslations = Object.assign(Object.create(null), {
1341
1341
  },
1342
1342
  nl: {
1343
1343
  noData: 'Geen gegevens',
1344
- dragToGroup: 'Sleep een kolomkop hierheen, of druk op Ctrl+G op een kolomkop, om te groeperen',
1344
+ dragToGroup: 'Sleep een kolomkop hierheen of druk erop op Ctrl+G om te groeperen',
1345
1345
  groupLabelSeparator: ': ',
1346
1346
  sortAscending: 'oplopend',
1347
1347
  sortDescending: 'aflopend',
@@ -1556,7 +1556,7 @@ export const gridTranslations = Object.assign(Object.create(null), {
1556
1556
  },
1557
1557
  ru: {
1558
1558
  noData: 'Нет данных',
1559
- dragToGroup: 'Перетащите сюда заголовок столбца или нажмите Ctrl+G на заголовке для группировки',
1559
+ dragToGroup: 'Перетащите сюда заголовок или нажмите на нём Ctrl+G для группировки',
1560
1560
  groupLabelSeparator: ': ',
1561
1561
  sortAscending: 'по возрастанию',
1562
1562
  sortDescending: 'по убыванию',
@@ -1771,7 +1771,7 @@ export const gridTranslations = Object.assign(Object.create(null), {
1771
1771
  },
1772
1772
  pl: {
1773
1773
  noData: 'Brak danych',
1774
- dragToGroup: 'Przeciągnij tutaj nagłówek kolumny lub naciśnij Ctrl+G na nagłówku, aby pogrupować',
1774
+ dragToGroup: 'Przeciągnij tu nagłówek lub naciśnij na nim Ctrl+G, aby pogrupować',
1775
1775
  groupLabelSeparator: ': ',
1776
1776
  sortAscending: 'rosnąco',
1777
1777
  sortDescending: 'malejąco',
@@ -1986,7 +1986,7 @@ export const gridTranslations = Object.assign(Object.create(null), {
1986
1986
  },
1987
1987
  tr: {
1988
1988
  noData: 'Veri yok',
1989
- dragToGroup: 'Gruplamak için bir sütun başlığını buraya sürükleyin veya bir başlıkta Ctrl+G tuşlarına basın',
1989
+ dragToGroup: 'Gruplamak için bir başlığı buraya sürükleyin veya üzerinde Ctrl+G’ye basın',
1990
1990
  groupLabelSeparator: ': ',
1991
1991
  sortAscending: 'artan',
1992
1992
  sortDescending: 'azalan',
@@ -2201,7 +2201,7 @@ export const gridTranslations = Object.assign(Object.create(null), {
2201
2201
  },
2202
2202
  ja: {
2203
2203
  noData: 'データがありません',
2204
- dragToGroup: '列ヘッダーをここにドラッグするか、ヘッダーで Ctrl+G を押してグループ化します',
2204
+ dragToGroup: '列ヘッダーをここにドラッグするか、ヘッダーで Ctrl+G を押してグループ化',
2205
2205
  groupLabelSeparator: ':',
2206
2206
  sortAscending: '昇順',
2207
2207
  sortDescending: '降順',
@@ -2416,7 +2416,7 @@ export const gridTranslations = Object.assign(Object.create(null), {
2416
2416
  },
2417
2417
  ko: {
2418
2418
  noData: '데이터 없음',
2419
- dragToGroup: '열 머리글을 여기로 끌거나 머리글에서 Ctrl+G를 눌러 그룹화하세요',
2419
+ dragToGroup: '머리글을 여기로 끌거나 머리글에서 Ctrl+G를 눌러 그룹화',
2420
2420
  groupLabelSeparator: ': ',
2421
2421
  sortAscending: '오름차순',
2422
2422
  sortDescending: '내림차순',
@@ -2631,7 +2631,7 @@ export const gridTranslations = Object.assign(Object.create(null), {
2631
2631
  },
2632
2632
  zh: {
2633
2633
  noData: '无数据',
2634
- dragToGroup: '将列标题拖到此处,或在列标题上按 Ctrl+G 进行分组',
2634
+ dragToGroup: '将列标题拖到此处,或在列标题上按 Ctrl+G 分组',
2635
2635
  groupLabelSeparator: ':',
2636
2636
  sortAscending: '升序',
2637
2637
  sortDescending: '降序',
@@ -2846,7 +2846,7 @@ export const gridTranslations = Object.assign(Object.create(null), {
2846
2846
  },
2847
2847
  ar: {
2848
2848
  noData: 'لا توجد بيانات',
2849
- dragToGroup: 'اسحب عنوان عمود إلى هنا، أو اضغط Ctrl+G على عنوان، للتجميع حسبه',
2849
+ dragToGroup: 'اسحب عنوانًا إلى هنا أو اضغط Ctrl+G عليه للتجميع',
2850
2850
  groupLabelSeparator: ': ',
2851
2851
  sortAscending: 'تصاعدي',
2852
2852
  sortDescending: 'تنازلي',