@vaadin/grid 25.3.0-dev.1fa5a51482 → 25.3.0-rc1
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.
- package/custom-elements.json +20 -20
- package/package.json +12 -12
- package/src/directives/cell-content-directive.js +2 -1
- package/src/vaadin-grid-a11y-mixin.js +15 -19
- package/src/vaadin-grid-active-item-mixin.js +1 -1
- package/src/vaadin-grid-column-auto-width-mixin.js +3 -8
- package/src/vaadin-grid-column-group-mixin.js +2 -6
- package/src/vaadin-grid-column-mixin.d.ts +3 -3
- package/src/vaadin-grid-column-mixin.js +35 -84
- package/src/vaadin-grid-column-reordering-mixin.js +1 -1
- package/src/vaadin-grid-column-resizing-mixin.js +4 -0
- package/src/vaadin-grid-data-provider-mixin.js +2 -2
- package/src/vaadin-grid-drag-and-drop-mixin.js +2 -5
- package/src/vaadin-grid-filter-column-mixin.js +1 -1
- package/src/vaadin-grid-filter-element-mixin.js +1 -3
- package/src/vaadin-grid-header-footer-rendering-mixin.js +43 -12
- package/src/vaadin-grid-keyboard-navigation-mixin.js +3 -7
- package/src/vaadin-grid-mixin.js +3 -27
- package/src/vaadin-grid-row-details-mixin.js +1 -1
- package/src/vaadin-grid-scroll-mixin.js +7 -32
- package/src/vaadin-grid-selection-column-base-mixin.js +3 -3
- package/src/vaadin-grid-sorter-mixin.js +3 -7
- package/src/vaadin-grid-tree-toggle.d.ts +5 -3
- package/src/vaadin-grid-tree-toggle.js +5 -3
- package/src/vaadin-grid.d.ts +23 -0
- package/src/vaadin-grid.js +23 -0
- package/web-types.json +17 -17
- package/web-types.lit.json +11 -11
package/custom-elements.json
CHANGED
|
@@ -497,7 +497,7 @@
|
|
|
497
497
|
"type": {
|
|
498
498
|
"text": "string"
|
|
499
499
|
},
|
|
500
|
-
"description": "Aligns the columns cell content horizontally
|
|
500
|
+
"description": "Aligns the columns cell content horizontally.",
|
|
501
501
|
"attribute": "text-align",
|
|
502
502
|
"inheritedFrom": {
|
|
503
503
|
"name": "ColumnBaseMixin",
|
|
@@ -651,7 +651,7 @@
|
|
|
651
651
|
"type": {
|
|
652
652
|
"text": "string"
|
|
653
653
|
},
|
|
654
|
-
"description": "Aligns the columns cell content horizontally
|
|
654
|
+
"description": "Aligns the columns cell content horizontally.",
|
|
655
655
|
"fieldName": "textAlign",
|
|
656
656
|
"inheritedFrom": {
|
|
657
657
|
"name": "ColumnBaseMixin",
|
|
@@ -863,7 +863,7 @@
|
|
|
863
863
|
"type": {
|
|
864
864
|
"text": "string"
|
|
865
865
|
},
|
|
866
|
-
"description": "Aligns the columns cell content horizontally
|
|
866
|
+
"description": "Aligns the columns cell content horizontally.",
|
|
867
867
|
"attribute": "text-align",
|
|
868
868
|
"inheritedFrom": {
|
|
869
869
|
"name": "ColumnBaseMixin",
|
|
@@ -1041,7 +1041,7 @@
|
|
|
1041
1041
|
"type": {
|
|
1042
1042
|
"text": "string"
|
|
1043
1043
|
},
|
|
1044
|
-
"description": "Aligns the columns cell content horizontally
|
|
1044
|
+
"description": "Aligns the columns cell content horizontally.",
|
|
1045
1045
|
"fieldName": "textAlign",
|
|
1046
1046
|
"inheritedFrom": {
|
|
1047
1047
|
"name": "ColumnBaseMixin",
|
|
@@ -1200,7 +1200,7 @@
|
|
|
1200
1200
|
"type": {
|
|
1201
1201
|
"text": "string"
|
|
1202
1202
|
},
|
|
1203
|
-
"description": "Aligns the columns cell content horizontally
|
|
1203
|
+
"description": "Aligns the columns cell content horizontally.",
|
|
1204
1204
|
"attribute": "text-align"
|
|
1205
1205
|
}
|
|
1206
1206
|
],
|
|
@@ -1291,7 +1291,7 @@
|
|
|
1291
1291
|
"type": {
|
|
1292
1292
|
"text": "string"
|
|
1293
1293
|
},
|
|
1294
|
-
"description": "Aligns the columns cell content horizontally
|
|
1294
|
+
"description": "Aligns the columns cell content horizontally.",
|
|
1295
1295
|
"fieldName": "textAlign"
|
|
1296
1296
|
}
|
|
1297
1297
|
],
|
|
@@ -1494,7 +1494,7 @@
|
|
|
1494
1494
|
"type": {
|
|
1495
1495
|
"text": "string"
|
|
1496
1496
|
},
|
|
1497
|
-
"description": "Aligns the columns cell content horizontally
|
|
1497
|
+
"description": "Aligns the columns cell content horizontally.",
|
|
1498
1498
|
"attribute": "text-align",
|
|
1499
1499
|
"inheritedFrom": {
|
|
1500
1500
|
"name": "ColumnBaseMixin",
|
|
@@ -1671,7 +1671,7 @@
|
|
|
1671
1671
|
"type": {
|
|
1672
1672
|
"text": "string"
|
|
1673
1673
|
},
|
|
1674
|
-
"description": "Aligns the columns cell content horizontally
|
|
1674
|
+
"description": "Aligns the columns cell content horizontally.",
|
|
1675
1675
|
"fieldName": "textAlign",
|
|
1676
1676
|
"inheritedFrom": {
|
|
1677
1677
|
"name": "ColumnBaseMixin",
|
|
@@ -2027,7 +2027,7 @@
|
|
|
2027
2027
|
"type": {
|
|
2028
2028
|
"text": "string"
|
|
2029
2029
|
},
|
|
2030
|
-
"description": "Aligns the columns cell content horizontally
|
|
2030
|
+
"description": "Aligns the columns cell content horizontally.",
|
|
2031
2031
|
"attribute": "text-align",
|
|
2032
2032
|
"inheritedFrom": {
|
|
2033
2033
|
"name": "ColumnBaseMixin",
|
|
@@ -2240,7 +2240,7 @@
|
|
|
2240
2240
|
"type": {
|
|
2241
2241
|
"text": "string"
|
|
2242
2242
|
},
|
|
2243
|
-
"description": "Aligns the columns cell content horizontally
|
|
2243
|
+
"description": "Aligns the columns cell content horizontally.",
|
|
2244
2244
|
"fieldName": "textAlign",
|
|
2245
2245
|
"inheritedFrom": {
|
|
2246
2246
|
"name": "ColumnBaseMixin",
|
|
@@ -2954,7 +2954,7 @@
|
|
|
2954
2954
|
"type": {
|
|
2955
2955
|
"text": "string"
|
|
2956
2956
|
},
|
|
2957
|
-
"description": "Aligns the columns cell content horizontally
|
|
2957
|
+
"description": "Aligns the columns cell content horizontally.",
|
|
2958
2958
|
"attribute": "text-align",
|
|
2959
2959
|
"inheritedFrom": {
|
|
2960
2960
|
"name": "GridColumn",
|
|
@@ -3163,7 +3163,7 @@
|
|
|
3163
3163
|
"type": {
|
|
3164
3164
|
"text": "string"
|
|
3165
3165
|
},
|
|
3166
|
-
"description": "Aligns the columns cell content horizontally
|
|
3166
|
+
"description": "Aligns the columns cell content horizontally.",
|
|
3167
3167
|
"fieldName": "textAlign",
|
|
3168
3168
|
"inheritedFrom": {
|
|
3169
3169
|
"name": "GridColumn",
|
|
@@ -5647,7 +5647,7 @@
|
|
|
5647
5647
|
"type": {
|
|
5648
5648
|
"text": "string"
|
|
5649
5649
|
},
|
|
5650
|
-
"description": "Aligns the columns cell content horizontally
|
|
5650
|
+
"description": "Aligns the columns cell content horizontally.",
|
|
5651
5651
|
"attribute": "text-align",
|
|
5652
5652
|
"inheritedFrom": {
|
|
5653
5653
|
"name": "GridColumn",
|
|
@@ -5901,7 +5901,7 @@
|
|
|
5901
5901
|
"type": {
|
|
5902
5902
|
"text": "string"
|
|
5903
5903
|
},
|
|
5904
|
-
"description": "Aligns the columns cell content horizontally
|
|
5904
|
+
"description": "Aligns the columns cell content horizontally.",
|
|
5905
5905
|
"fieldName": "textAlign",
|
|
5906
5906
|
"inheritedFrom": {
|
|
5907
5907
|
"name": "GridColumn",
|
|
@@ -6313,7 +6313,7 @@
|
|
|
6313
6313
|
"type": {
|
|
6314
6314
|
"text": "string"
|
|
6315
6315
|
},
|
|
6316
|
-
"description": "Aligns the columns cell content horizontally
|
|
6316
|
+
"description": "Aligns the columns cell content horizontally.",
|
|
6317
6317
|
"attribute": "text-align",
|
|
6318
6318
|
"inheritedFrom": {
|
|
6319
6319
|
"name": "GridColumn",
|
|
@@ -6543,7 +6543,7 @@
|
|
|
6543
6543
|
"type": {
|
|
6544
6544
|
"text": "string"
|
|
6545
6545
|
},
|
|
6546
|
-
"description": "Aligns the columns cell content horizontally
|
|
6546
|
+
"description": "Aligns the columns cell content horizontally.",
|
|
6547
6547
|
"fieldName": "textAlign",
|
|
6548
6548
|
"inheritedFrom": {
|
|
6549
6549
|
"name": "GridColumn",
|
|
@@ -7194,7 +7194,7 @@
|
|
|
7194
7194
|
"type": {
|
|
7195
7195
|
"text": "string"
|
|
7196
7196
|
},
|
|
7197
|
-
"description": "Aligns the columns cell content horizontally
|
|
7197
|
+
"description": "Aligns the columns cell content horizontally.",
|
|
7198
7198
|
"attribute": "text-align",
|
|
7199
7199
|
"inheritedFrom": {
|
|
7200
7200
|
"name": "GridColumn",
|
|
@@ -7403,7 +7403,7 @@
|
|
|
7403
7403
|
"type": {
|
|
7404
7404
|
"text": "string"
|
|
7405
7405
|
},
|
|
7406
|
-
"description": "Aligns the columns cell content horizontally
|
|
7406
|
+
"description": "Aligns the columns cell content horizontally.",
|
|
7407
7407
|
"fieldName": "textAlign",
|
|
7408
7408
|
"inheritedFrom": {
|
|
7409
7409
|
"name": "GridColumn",
|
|
@@ -7527,7 +7527,7 @@
|
|
|
7527
7527
|
"declarations": [
|
|
7528
7528
|
{
|
|
7529
7529
|
"kind": "class",
|
|
7530
|
-
"description": "`<vaadin-grid-tree-toggle>` is a helper element for the `<vaadin-grid>`\nthat provides toggle and level display functionality for the item tree.\n\n#### Example:\n```html\n<vaadin-grid-column id=\"column\"></vaadin-grid-column>\n```\n```js\nconst column = document.querySelector('#column');\ncolumn.renderer = (root, column, model) => {\n let treeToggle = root.firstElementChild;\n if (!treeToggle) {\n treeToggle = document.createElement('vaadin-grid-tree-toggle');\n treeToggle.addEventListener('expanded-changed', () => { ... });\n root.appendChild(treeToggle);\n }\n treeToggle.leaf = !model.item.hasChildren;\n treeToggle.level = level;\n treeToggle.expanded = expanded;\n treeToggle.textContent = model.item.name;\n};\n```\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n---|---\n`toggle` | The tree toggle icon\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n-----------|-------------------------------------\n`expanded` | When present, the toggle is expanded\n`leaf` | When present, the toggle is not expandable, i. e., the current item is a leaf\n\nThe following custom CSS properties are available for styling:\n\nCustom CSS property
|
|
7530
|
+
"description": "`<vaadin-grid-tree-toggle>` is a helper element for the `<vaadin-grid>`\nthat provides toggle and level display functionality for the item tree.\n\n#### Example:\n```html\n<vaadin-grid-column id=\"column\"></vaadin-grid-column>\n```\n```js\nconst column = document.querySelector('#column');\ncolumn.renderer = (root, column, model) => {\n let treeToggle = root.firstElementChild;\n if (!treeToggle) {\n treeToggle = document.createElement('vaadin-grid-tree-toggle');\n treeToggle.addEventListener('expanded-changed', () => { ... });\n root.appendChild(treeToggle);\n }\n treeToggle.leaf = !model.item.hasChildren;\n treeToggle.level = level;\n treeToggle.expanded = expanded;\n treeToggle.textContent = model.item.name;\n};\n```\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n---|---\n`toggle` | The tree toggle icon\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n-----------|-------------------------------------\n`expanded` | When present, the toggle is expanded\n`leaf` | When present, the toggle is not expandable, i. e., the current item is a leaf\n\nThe following custom CSS properties are available for styling:\n\nCustom CSS property |\n:--------------------------------------------|\n| `--vaadin-grid-tree-toggle-level-offset` |\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
7531
7531
|
"name": "GridTreeToggle",
|
|
7532
7532
|
"members": [
|
|
7533
7533
|
{
|
|
@@ -7674,7 +7674,7 @@
|
|
|
7674
7674
|
"declarations": [
|
|
7675
7675
|
{
|
|
7676
7676
|
"kind": "class",
|
|
7677
|
-
"description": "`<vaadin-grid>` is a free, high quality data grid / data table Web Component. The content of the\nthe grid can be populated by using renderer callback function.\n\n### Quick Start\n\nStart with an assigning an array to the [`items`](#/elements/vaadin-grid#property-items) property to visualize your data.\n\nUse the [`<vaadin-grid-column>`](#/elements/vaadin-grid-column) element to configure the grid columns. Set `path` and `header`\nshorthand properties for the columns to define what gets rendered in the cells of the column.\n\n#### Example:\n```html\n<vaadin-grid>\n <vaadin-grid-column path=\"name.first\" header=\"First name\"></vaadin-grid-column>\n <vaadin-grid-column path=\"name.last\" header=\"Last name\"></vaadin-grid-column>\n <vaadin-grid-column path=\"email\"></vaadin-grid-column>\n</vaadin-grid>\n```\n\nFor custom content `vaadin-grid-column` element provides you with three types of `renderer` callback functions: `headerRenderer`,\n`renderer` and `footerRenderer`.\n\nEach of those renderer functions provides `root`, `column`, `model` arguments when applicable.\nGenerate DOM content, append it to the `root` element and control the state\nof the host element by accessing `column`. Before generating new content,\nusers are able to check if there is already content in `root` for reusing it.\n\nRenderers are called on initialization of new column cells and each time the\nrelated row model is updated. DOM generated during the renderer call can be reused\nin the next renderer call and will be provided with the `root` argument.\nOn first call it will be empty.\n\n#### Example:\n```html\n<vaadin-grid>\n <vaadin-grid-column></vaadin-grid-column>\n <vaadin-grid-column></vaadin-grid-column>\n <vaadin-grid-column></vaadin-grid-column>\n</vaadin-grid>\n```\n```js\nconst grid = document.querySelector('vaadin-grid');\ngrid.items = [{'name': 'John', 'surname': 'Lennon', 'role': 'singer'},\n {'name': 'Ringo', 'surname': 'Starr', 'role': 'drums'}];\n\nconst columns = grid.querySelectorAll('vaadin-grid-column');\n\ncolumns[0].headerRenderer = function(root) {\n root.textContent = 'Name';\n};\ncolumns[0].renderer = function(root, column, model) {\n root.textContent = model.item.name;\n};\n\ncolumns[1].headerRenderer = function(root) {\n root.textContent = 'Surname';\n};\ncolumns[1].renderer = function(root, column, model) {\n root.textContent = model.item.surname;\n};\n\ncolumns[2].headerRenderer = function(root) {\n root.textContent = 'Role';\n};\ncolumns[2].renderer = function(root, column, model) {\n root.textContent = model.item.role;\n};\n```\n\nThe following properties are available in the `model` argument:\n\nProperty name | Type | Description\n--------------|------|------------\n`index`| Number | The index of the item.\n`item` | String or Object | The item.\n`level` | Number | Number of the item's tree sublevel, starts from 0.\n`expanded` | Boolean | True if the item's tree sublevel is expanded.\n`selected` | Boolean | True if the item is selected.\n`detailsOpened` | Boolean | True if the item's row details are open.\n`hasChildren` | Boolean | True if the item has children\n\nThe following helper elements can be used for further customization:\n- [`<vaadin-grid-column-group>`](#/elements/vaadin-grid-column-group)\n- [`<vaadin-grid-filter>`](#/elements/vaadin-grid-filter)\n- [`<vaadin-grid-sorter>`](#/elements/vaadin-grid-sorter)\n- [`<vaadin-grid-selection-column>`](#/elements/vaadin-grid-selection-column)\n- [`<vaadin-grid-tree-toggle>`](#/elements/vaadin-grid-tree-toggle)\n\n__Note that the helper elements must be explicitly imported.__\nIf you want to import everything at once you can use the `all-imports.js` entrypoint.\n\n### Lazy Loading with Function Data Provider\n\nIn addition to assigning an array to the items property, you can alternatively\nprovide the `<vaadin-grid>` data through the\n[`dataProvider`](#/elements/vaadin-grid#property-dataProvider) function property.\nThe `<vaadin-grid>` calls this function lazily, only when it needs more data\nto be displayed.\n\nSee the [`dataProvider`](#/elements/vaadin-grid#property-dataProvider) property\ndocumentation for the detailed data provider arguments description.\n\n__Note that expanding the tree grid's item will trigger a call to the `dataProvider`.__\n\n__Also, note that when using function data providers, the total number of items\nneeds to be set manually. The total number of items can be returned\nin the second argument of the data provider callback:__\n\n```javascript\ngrid.dataProvider = ({page, pageSize}, callback) => {\n // page: the requested page index\n // pageSize: number of items on one page\n const url = `https://api.example/data?page=${page}&per_page=${pageSize}`;\n\n fetch(url)\n .then((res) => res.json())\n .then(({ employees, totalSize }) => {\n callback(employees, totalSize);\n });\n};\n```\n\n__Alternatively, you can use the `size` property to set the total number of items:__\n\n```javascript\ngrid.size = 200; // The total number of items\ngrid.dataProvider = ({page, pageSize}, callback) => {\n const url = `https://api.example/data?page=${page}&per_page=${pageSize}`;\n\n fetch(url)\n .then((res) => res.json())\n .then((resJson) => callback(resJson.employees));\n};\n```\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n---------------------------|----------------\n`row` | Row in the internal table\n`body-row` | Body row in the internal table\n`header-row` | Header row in the internal table\n`footer-row` | Footer row in the internal table\n`collapsed-row` | Collapsed row\n`expanded-row` | Expanded row\n`selected-row` | Selected row\n`nonselectable-row` | Row that the user may not select or deselect\n`details-opened-row` | Row with details open\n`odd-row` | Odd row\n`even-row` | Even row\n`first-row` | The first body row\n`first-header-row` | The first header row\n`first-footer-row` | The first footer row\n`last-row` | The last body row\n`last-header-row` | The last header row\n`last-footer-row` | The last footer row\n`dragstart-row` | Set on the row for one frame when drag is starting.\n`dragover-above-row` | Set on the row when the a row is dragged over above\n`dragover-below-row` | Set on the row when the a row is dragged over below\n`dragover-on-top-row` | Set on the row when the a row is dragged over on top\n`drag-disabled-row` | Set to a row that isn't available for dragging\n`drop-disabled-row` | Set to a row that can't be dropped on top of\n`cell` | Cell in the internal table\n`header-cell` | Header cell in the internal table\n`body-cell` | Body cell in the internal table\n`footer-cell` | Footer cell in the internal table\n`details-cell` | Row details cell in the internal table\n`focused-cell` | Focused cell in the internal table\n`odd-row-cell` | Cell in an odd row\n`even-row-cell` | Cell in an even row\n`first-row-cell` | Cell in the first body row\n`last-row-cell` | Cell in the last body row\n`first-header-row-cell` | Cell in the first header row\n`first-footer-row-cell` | Cell in the first footer row\n`last-header-row-cell` | Cell in the last header row\n`last-footer-row-cell` | Cell in the last footer row\n`loading-row-cell` | Cell in a row that is waiting for data from data provider\n`selected-row-cell` | Cell in a selected row\n`nonselectable-row-cell` | Cell in a row that the user may not select or deselect\n`collapsed-row-cell` | Cell in a collapsed row\n`expanded-row-cell` | Cell in an expanded row\n`details-opened-row-cell` | Cell in an row with details open\n`dragstart-row-cell` | Cell in the ghost image row, but not in a source row\n`drag-source-row-cell` | Cell in a source row, but not in the ghost image\n`dragover-above-row-cell` | Cell in a row that has another row dragged over above\n`dragover-below-row-cell` | Cell in a row that has another row dragged over below\n`dragover-on-top-row-cell` | Cell in a row that has another row dragged over on top\n`drag-disabled-row-cell` | Cell in a row that isn't available for dragging\n`drop-disabled-row-cell` | Cell in a row that can't be dropped on top of\n`frozen-cell` | Frozen cell in the internal table\n`frozen-to-end-cell` | Frozen to end cell in the internal table\n`last-frozen-cell` | Last frozen cell\n`first-frozen-to-end-cell` | First cell frozen to end\n`first-column-cell` | First visible cell on a row\n`last-column-cell` | Last visible cell on a row\n`reorder-allowed-cell` | Cell in a column where another column can be reordered\n`reorder-dragging-cell` | Cell in a column currently being reordered\n`resize-handle` | Handle for resizing the columns\n`empty-state` | The container for the content to be displayed when there are no body rows to show\n`reorder-ghost` | Ghost element of the header cell being dragged\n\nThe following state attributes are available for styling:\n\nAttribute | Description | Part name\n----------------------|---------------------------------------------------------------------------------------------------|-----------\n`loading` | Set when the grid is loading data from data provider | :host\n`interacting` | Keyboard navigation in interaction mode | :host\n`navigating` | Keyboard navigation in navigation mode | :host\n`overflow` | Set when rows are overflowing the grid viewport. Possible values: `top`, `bottom`, `start`, `end` | :host\n`reordering` | Set when the grid's columns are being reordered | :host\n`dragover` | Set when the grid (not a specific row) is dragged over | :host\n`dragging-rows` | Set when grid rows are dragged | :host\n`reorder-status` | Reflects the status of a cell while columns are being reordered | cell\n`frozen` | Frozen cell | cell\n`frozen-to-end` | Cell frozen to end | cell\n`last-frozen` | Last frozen cell | cell\n`first-frozen-to-end` | First cell frozen to end | cell\n`first-column` | First visible cell on a row | cell\n`last-column` | Last visible cell on a row | cell\n`selected` | Selected row | row\n`expanded` | Expanded row | row\n`details-opened` | Row with details open | row\n`loading` | Row that is waiting for data from data provider | row\n`odd` | Odd row | row\n`first` | The first body row | row\n`last` | The last body row | row\n`dragstart` | Set for one frame when starting to drag a row. The value is a number when dragging multiple rows | row\n`dragover` | Set when the row is dragged over | row\n`drag-disabled` | Set to a row that isn't available for dragging | row\n`drop-disabled` | Set to a row that can't be dropped on top of | row\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
7677
|
+
"description": "`<vaadin-grid>` is a free, high quality data grid / data table Web Component. The content of the\nthe grid can be populated by using renderer callback function.\n\n### Quick Start\n\nStart with an assigning an array to the [`items`](#/elements/vaadin-grid#property-items) property to visualize your data.\n\nUse the [`<vaadin-grid-column>`](#/elements/vaadin-grid-column) element to configure the grid columns. Set `path` and `header`\nshorthand properties for the columns to define what gets rendered in the cells of the column.\n\n#### Example:\n```html\n<vaadin-grid>\n <vaadin-grid-column path=\"name.first\" header=\"First name\"></vaadin-grid-column>\n <vaadin-grid-column path=\"name.last\" header=\"Last name\"></vaadin-grid-column>\n <vaadin-grid-column path=\"email\"></vaadin-grid-column>\n</vaadin-grid>\n```\n\nFor custom content `vaadin-grid-column` element provides you with three types of `renderer` callback functions: `headerRenderer`,\n`renderer` and `footerRenderer`.\n\nEach of those renderer functions provides `root`, `column`, `model` arguments when applicable.\nGenerate DOM content, append it to the `root` element and control the state\nof the host element by accessing `column`. Before generating new content,\nusers are able to check if there is already content in `root` for reusing it.\n\nRenderers are called on initialization of new column cells and each time the\nrelated row model is updated. DOM generated during the renderer call can be reused\nin the next renderer call and will be provided with the `root` argument.\nOn first call it will be empty.\n\n#### Example:\n```html\n<vaadin-grid>\n <vaadin-grid-column></vaadin-grid-column>\n <vaadin-grid-column></vaadin-grid-column>\n <vaadin-grid-column></vaadin-grid-column>\n</vaadin-grid>\n```\n```js\nconst grid = document.querySelector('vaadin-grid');\ngrid.items = [{'name': 'John', 'surname': 'Lennon', 'role': 'singer'},\n {'name': 'Ringo', 'surname': 'Starr', 'role': 'drums'}];\n\nconst columns = grid.querySelectorAll('vaadin-grid-column');\n\ncolumns[0].headerRenderer = function(root) {\n root.textContent = 'Name';\n};\ncolumns[0].renderer = function(root, column, model) {\n root.textContent = model.item.name;\n};\n\ncolumns[1].headerRenderer = function(root) {\n root.textContent = 'Surname';\n};\ncolumns[1].renderer = function(root, column, model) {\n root.textContent = model.item.surname;\n};\n\ncolumns[2].headerRenderer = function(root) {\n root.textContent = 'Role';\n};\ncolumns[2].renderer = function(root, column, model) {\n root.textContent = model.item.role;\n};\n```\n\nThe following properties are available in the `model` argument:\n\nProperty name | Type | Description\n--------------|------|------------\n`index`| Number | The index of the item.\n`item` | String or Object | The item.\n`level` | Number | Number of the item's tree sublevel, starts from 0.\n`expanded` | Boolean | True if the item's tree sublevel is expanded.\n`selected` | Boolean | True if the item is selected.\n`detailsOpened` | Boolean | True if the item's row details are open.\n`hasChildren` | Boolean | True if the item has children\n\nThe following helper elements can be used for further customization:\n- [`<vaadin-grid-column-group>`](#/elements/vaadin-grid-column-group)\n- [`<vaadin-grid-filter>`](#/elements/vaadin-grid-filter)\n- [`<vaadin-grid-sorter>`](#/elements/vaadin-grid-sorter)\n- [`<vaadin-grid-selection-column>`](#/elements/vaadin-grid-selection-column)\n- [`<vaadin-grid-tree-toggle>`](#/elements/vaadin-grid-tree-toggle)\n\n__Note that the helper elements must be explicitly imported.__\nIf you want to import everything at once you can use the `all-imports.js` entrypoint.\n\n### Lazy Loading with Function Data Provider\n\nIn addition to assigning an array to the items property, you can alternatively\nprovide the `<vaadin-grid>` data through the\n[`dataProvider`](#/elements/vaadin-grid#property-dataProvider) function property.\nThe `<vaadin-grid>` calls this function lazily, only when it needs more data\nto be displayed.\n\nSee the [`dataProvider`](#/elements/vaadin-grid#property-dataProvider) property\ndocumentation for the detailed data provider arguments description.\n\n__Note that expanding the tree grid's item will trigger a call to the `dataProvider`.__\n\n__Also, note that when using function data providers, the total number of items\nneeds to be set manually. The total number of items can be returned\nin the second argument of the data provider callback:__\n\n```javascript\ngrid.dataProvider = ({page, pageSize}, callback) => {\n // page: the requested page index\n // pageSize: number of items on one page\n const url = `https://api.example/data?page=${page}&per_page=${pageSize}`;\n\n fetch(url)\n .then((res) => res.json())\n .then(({ employees, totalSize }) => {\n callback(employees, totalSize);\n });\n};\n```\n\n__Alternatively, you can use the `size` property to set the total number of items:__\n\n```javascript\ngrid.size = 200; // The total number of items\ngrid.dataProvider = ({page, pageSize}, callback) => {\n const url = `https://api.example/data?page=${page}&per_page=${pageSize}`;\n\n fetch(url)\n .then((res) => res.json())\n .then((resJson) => callback(resJson.employees));\n};\n```\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n---------------------------|----------------\n`row` | Row in the internal table\n`body-row` | Body row in the internal table\n`header-row` | Header row in the internal table\n`footer-row` | Footer row in the internal table\n`collapsed-row` | Collapsed row\n`expanded-row` | Expanded row\n`selected-row` | Selected row\n`nonselectable-row` | Row that the user may not select or deselect\n`details-opened-row` | Row with details open\n`odd-row` | Odd row\n`even-row` | Even row\n`first-row` | The first body row\n`first-header-row` | The first header row\n`first-footer-row` | The first footer row\n`last-row` | The last body row\n`last-header-row` | The last header row\n`last-footer-row` | The last footer row\n`dragstart-row` | Set on the row for one frame when drag is starting.\n`dragover-above-row` | Set on the row when the a row is dragged over above\n`dragover-below-row` | Set on the row when the a row is dragged over below\n`dragover-on-top-row` | Set on the row when the a row is dragged over on top\n`drag-disabled-row` | Set to a row that isn't available for dragging\n`drop-disabled-row` | Set to a row that can't be dropped on top of\n`cell` | Cell in the internal table\n`header-cell` | Header cell in the internal table\n`body-cell` | Body cell in the internal table\n`footer-cell` | Footer cell in the internal table\n`details-cell` | Row details cell in the internal table\n`focused-cell` | Focused cell in the internal table\n`odd-row-cell` | Cell in an odd row\n`even-row-cell` | Cell in an even row\n`first-row-cell` | Cell in the first body row\n`last-row-cell` | Cell in the last body row\n`first-header-row-cell` | Cell in the first header row\n`first-footer-row-cell` | Cell in the first footer row\n`last-header-row-cell` | Cell in the last header row\n`last-footer-row-cell` | Cell in the last footer row\n`loading-row-cell` | Cell in a row that is waiting for data from data provider\n`selected-row-cell` | Cell in a selected row\n`nonselectable-row-cell` | Cell in a row that the user may not select or deselect\n`collapsed-row-cell` | Cell in a collapsed row\n`expanded-row-cell` | Cell in an expanded row\n`details-opened-row-cell` | Cell in an row with details open\n`dragstart-row-cell` | Cell in the ghost image row, but not in a source row\n`drag-source-row-cell` | Cell in a source row, but not in the ghost image\n`dragover-above-row-cell` | Cell in a row that has another row dragged over above\n`dragover-below-row-cell` | Cell in a row that has another row dragged over below\n`dragover-on-top-row-cell` | Cell in a row that has another row dragged over on top\n`drag-disabled-row-cell` | Cell in a row that isn't available for dragging\n`drop-disabled-row-cell` | Cell in a row that can't be dropped on top of\n`frozen-cell` | Frozen cell in the internal table\n`frozen-to-end-cell` | Frozen to end cell in the internal table\n`last-frozen-cell` | Last frozen cell\n`first-frozen-to-end-cell` | First cell frozen to end\n`first-column-cell` | First visible cell on a row\n`last-column-cell` | Last visible cell on a row\n`reorder-allowed-cell` | Cell in a column where another column can be reordered\n`reorder-dragging-cell` | Cell in a column currently being reordered\n`resize-handle` | Handle for resizing the columns\n`empty-state` | The container for the content to be displayed when there are no body rows to show\n`reorder-ghost` | Ghost element of the header cell being dragged\n\nThe following state attributes are available for styling:\n\nAttribute | Description | Part name\n----------------------|---------------------------------------------------------------------------------------------------|-----------\n`loading` | Set when the grid is loading data from data provider | :host\n`interacting` | Keyboard navigation in interaction mode | :host\n`navigating` | Keyboard navigation in navigation mode | :host\n`overflow` | Set when rows are overflowing the grid viewport. Possible values: `top`, `bottom`, `start`, `end` | :host\n`reordering` | Set when the grid's columns are being reordered | :host\n`dragover` | Set when the grid (not a specific row) is dragged over | :host\n`dragging-rows` | Set when grid rows are dragged | :host\n`reorder-status` | Reflects the status of a cell while columns are being reordered | cell\n`frozen` | Frozen cell | cell\n`frozen-to-end` | Cell frozen to end | cell\n`last-frozen` | Last frozen cell | cell\n`first-frozen-to-end` | First cell frozen to end | cell\n`first-column` | First visible cell on a row | cell\n`last-column` | Last visible cell on a row | cell\n`selected` | Selected row | row\n`expanded` | Expanded row | row\n`details-opened` | Row with details open | row\n`loading` | Row that is waiting for data from data provider | row\n`odd` | Odd row | row\n`first` | The first body row | row\n`last` | The last body row | row\n`dragstart` | Set for one frame when starting to drag a row. The value is a number when dragging multiple rows | row\n`dragover` | Set when the row is dragged over | row\n`drag-disabled` | Set to a row that isn't available for dragging | row\n`drop-disabled` | Set to a row that can't be dropped on top of | row\n\nThe following custom CSS properties are available for styling:\n\nCustom CSS property |\n:--------------------------------------------------|\n| `--vaadin-grid-background` |\n| `--vaadin-grid-border-color` |\n| `--vaadin-grid-border-radius` |\n| `--vaadin-grid-border-width` |\n| `--vaadin-grid-cell-background-color` |\n| `--vaadin-grid-cell-padding` |\n| `--vaadin-grid-cell-text-overflow` |\n| `--vaadin-grid-column-border-width` |\n| `--vaadin-grid-column-resize-handle-color` |\n| `--vaadin-grid-header-font-size` |\n| `--vaadin-grid-header-font-weight` |\n| `--vaadin-grid-header-text-color` |\n| `--vaadin-grid-row-background-color` |\n| `--vaadin-grid-row-border-width` |\n| `--vaadin-grid-row-highlight-background-color` |\n| `--vaadin-grid-row-hover-background-color` |\n| `--vaadin-grid-row-odd-background-color` |\n| `--vaadin-grid-row-selected-background-color` |\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
7678
7678
|
"name": "Grid",
|
|
7679
7679
|
"members": [
|
|
7680
7680
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/grid",
|
|
3
|
-
"version": "25.3.0-
|
|
3
|
+
"version": "25.3.0-rc1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -45,20 +45,20 @@
|
|
|
45
45
|
],
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
48
|
-
"@vaadin/a11y-base": "25.3.0-
|
|
49
|
-
"@vaadin/checkbox": "25.3.0-
|
|
50
|
-
"@vaadin/component-base": "25.3.0-
|
|
51
|
-
"@vaadin/lit-renderer": "25.3.0-
|
|
52
|
-
"@vaadin/text-field": "25.3.0-
|
|
53
|
-
"@vaadin/vaadin-themable-mixin": "25.3.0-
|
|
48
|
+
"@vaadin/a11y-base": "25.3.0-rc1",
|
|
49
|
+
"@vaadin/checkbox": "25.3.0-rc1",
|
|
50
|
+
"@vaadin/component-base": "25.3.0-rc1",
|
|
51
|
+
"@vaadin/lit-renderer": "25.3.0-rc1",
|
|
52
|
+
"@vaadin/text-field": "25.3.0-rc1",
|
|
53
|
+
"@vaadin/vaadin-themable-mixin": "25.3.0-rc1",
|
|
54
54
|
"lit": "^3.0.0"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@vaadin/aura": "25.3.0-
|
|
58
|
-
"@vaadin/chai-plugins": "25.3.0-
|
|
59
|
-
"@vaadin/test-runner-commands": "25.3.0-
|
|
57
|
+
"@vaadin/aura": "25.3.0-rc1",
|
|
58
|
+
"@vaadin/chai-plugins": "25.3.0-rc1",
|
|
59
|
+
"@vaadin/test-runner-commands": "25.3.0-rc1",
|
|
60
60
|
"@vaadin/testing-helpers": "^2.0.0",
|
|
61
|
-
"@vaadin/vaadin-lumo-styles": "25.3.0-
|
|
61
|
+
"@vaadin/vaadin-lumo-styles": "25.3.0-rc1",
|
|
62
62
|
"sinon": "^22.0.0"
|
|
63
63
|
},
|
|
64
64
|
"customElements": "custom-elements.json",
|
|
@@ -66,5 +66,5 @@
|
|
|
66
66
|
"web-types.json",
|
|
67
67
|
"web-types.lit.json"
|
|
68
68
|
],
|
|
69
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "d4809590b2f61bd607e376ab3dec84f4bfb059a7"
|
|
70
70
|
}
|
|
@@ -12,10 +12,11 @@ import { AsyncDirective, directive } from 'lit/async-directive.js';
|
|
|
12
12
|
class CellContentDirective extends AsyncDirective {
|
|
13
13
|
#cell;
|
|
14
14
|
|
|
15
|
-
update(part, [grid, slotName]) {
|
|
15
|
+
update(part, [grid, slotName, { textAlign } = {}]) {
|
|
16
16
|
this.#cell = part.parentNode;
|
|
17
17
|
this.#cell._content ??= document.createElement('vaadin-grid-cell-content');
|
|
18
18
|
this.#cell._content.slot = slotName;
|
|
19
|
+
this.#cell._content.style.textAlign = textAlign ?? '';
|
|
19
20
|
|
|
20
21
|
if (!grid.contains(this.#cell._content)) {
|
|
21
22
|
grid.appendChild(this.#cell._content);
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Copyright (c) 2016 - 2026 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
+
import { setOrRemoveAttribute } from '@vaadin/component-base/src/dom-utils.js';
|
|
6
7
|
import { findTreeToggleCell, getClosestCell, iterateChildren, iterateRowCells } from './vaadin-grid-helpers.js';
|
|
7
8
|
|
|
8
9
|
export const A11yMixin = (superClass) =>
|
|
@@ -19,7 +20,7 @@ export const A11yMixin = (superClass) =>
|
|
|
19
20
|
};
|
|
20
21
|
}
|
|
21
22
|
static get observers() {
|
|
22
|
-
return ['__a11yUpdateGridSize(
|
|
23
|
+
return ['__a11yUpdateGridSize(_flatSize, _columnTree, __emptyState)', '__a11yI18nChanged(__effectiveI18n)'];
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
/** @private */
|
|
@@ -43,14 +44,14 @@ export const A11yMixin = (superClass) =>
|
|
|
43
44
|
}
|
|
44
45
|
|
|
45
46
|
/** @private */
|
|
46
|
-
__a11yUpdateGridSize(
|
|
47
|
-
if (
|
|
47
|
+
__a11yUpdateGridSize(flatSize, _columnTree, emptyState) {
|
|
48
|
+
if (flatSize === undefined || _columnTree === undefined) {
|
|
48
49
|
return;
|
|
49
50
|
}
|
|
50
51
|
|
|
51
52
|
const headerRowsCount = this.__a11yGetHeaderRowCount(_columnTree);
|
|
52
53
|
const footerRowsCount = this.__a11yGetFooterRowCount(_columnTree);
|
|
53
|
-
const bodyRowsCount = emptyState ? 1 :
|
|
54
|
+
const bodyRowsCount = emptyState ? 1 : flatSize;
|
|
54
55
|
const rowsCount = bodyRowsCount + headerRowsCount + footerRowsCount;
|
|
55
56
|
|
|
56
57
|
this.$.table.setAttribute('aria-rowcount', rowsCount);
|
|
@@ -75,8 +76,12 @@ export const A11yMixin = (superClass) =>
|
|
|
75
76
|
|
|
76
77
|
/** @private */
|
|
77
78
|
__a11yUpdateFooterRows() {
|
|
79
|
+
const bodyRowCount = this._flatSize || 0;
|
|
78
80
|
iterateChildren(this.$.footer, (footerRow, index) => {
|
|
79
|
-
footerRow.setAttribute(
|
|
81
|
+
footerRow.setAttribute(
|
|
82
|
+
'aria-rowindex',
|
|
83
|
+
this.__a11yGetHeaderRowCount(this._columnTree) + bodyRowCount + index + 1,
|
|
84
|
+
);
|
|
80
85
|
});
|
|
81
86
|
}
|
|
82
87
|
|
|
@@ -110,19 +115,13 @@ export const A11yMixin = (superClass) =>
|
|
|
110
115
|
const toggleCell = findTreeToggleCell(row);
|
|
111
116
|
if (this.__isRowExpandable(row)) {
|
|
112
117
|
row.setAttribute('aria-expanded', 'false');
|
|
113
|
-
|
|
114
|
-
toggleCell.setAttribute('aria-expanded', 'false');
|
|
115
|
-
}
|
|
118
|
+
toggleCell?.setAttribute('aria-expanded', 'false');
|
|
116
119
|
} else if (this.__isRowCollapsible(row)) {
|
|
117
120
|
row.setAttribute('aria-expanded', 'true');
|
|
118
|
-
|
|
119
|
-
toggleCell.setAttribute('aria-expanded', 'true');
|
|
120
|
-
}
|
|
121
|
+
toggleCell?.setAttribute('aria-expanded', 'true');
|
|
121
122
|
} else {
|
|
122
123
|
row.removeAttribute('aria-expanded');
|
|
123
|
-
|
|
124
|
-
toggleCell.removeAttribute('aria-expanded');
|
|
125
|
-
}
|
|
124
|
+
toggleCell?.removeAttribute('aria-expanded');
|
|
126
125
|
}
|
|
127
126
|
}
|
|
128
127
|
|
|
@@ -133,11 +132,8 @@ export const A11yMixin = (superClass) =>
|
|
|
133
132
|
*/
|
|
134
133
|
__a11yUpdateRowLevel(row, level) {
|
|
135
134
|
// Set level for the expandable rows itself, and all the nested rows.
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
} else {
|
|
139
|
-
row.removeAttribute('aria-level');
|
|
140
|
-
}
|
|
135
|
+
const hasLevel = level > 0 || this.__isRowCollapsible(row) || this.__isRowExpandable(row);
|
|
136
|
+
setOrRemoveAttribute(row, 'aria-level', hasLevel && level + 1);
|
|
141
137
|
}
|
|
142
138
|
|
|
143
139
|
/**
|
|
@@ -76,7 +76,7 @@ export const ActiveItemMixin = (superClass) =>
|
|
|
76
76
|
// Cell is the empty state cell
|
|
77
77
|
cell === this.$.emptystatecell ||
|
|
78
78
|
// Cell content is focused
|
|
79
|
-
cell._content.
|
|
79
|
+
cell._content.matches(':focus-within') ||
|
|
80
80
|
// Clicked on a focusable element
|
|
81
81
|
this._isFocusable(e.target) ||
|
|
82
82
|
// Clicked on a label element
|
|
@@ -214,11 +214,7 @@ export const ColumnAutoWidthMixin = (superClass) =>
|
|
|
214
214
|
}
|
|
215
215
|
});
|
|
216
216
|
|
|
217
|
-
|
|
218
|
-
this.$.scroller.setAttribute('measuring-auto-width', '');
|
|
219
|
-
} else {
|
|
220
|
-
this.$.scroller.removeAttribute('measuring-auto-width');
|
|
221
|
-
}
|
|
217
|
+
this.$.scroller.toggleAttribute('measuring-auto-width', autoWidth);
|
|
222
218
|
}
|
|
223
219
|
|
|
224
220
|
/**
|
|
@@ -311,10 +307,9 @@ export const ColumnAutoWidthMixin = (superClass) =>
|
|
|
311
307
|
// of the virtualizer update loop, ensuring the grid eventually reaches a stable state.
|
|
312
308
|
const hasRowsWithUndefinedIndex = [...this.$.items.children].some((row) => row.index === undefined);
|
|
313
309
|
|
|
314
|
-
const debouncingHiddenChanged = this._debouncerHiddenChanged
|
|
310
|
+
const debouncingHiddenChanged = this._debouncerHiddenChanged?.isActive();
|
|
315
311
|
|
|
316
|
-
const debouncingUpdateFrozenColumn =
|
|
317
|
-
this.__debounceUpdateFrozenColumn && this.__debounceUpdateFrozenColumn.isActive();
|
|
312
|
+
const debouncingUpdateFrozenColumn = this.__debounceUpdateFrozenColumn?.isActive();
|
|
318
313
|
|
|
319
314
|
// When using a percentage-based height, the grid's effective height may
|
|
320
315
|
// be 0 until the resize observer in grid-mixin calculates a min-height.
|
|
@@ -74,9 +74,7 @@ export const GridColumnGroupMixin = (superClass) =>
|
|
|
74
74
|
/** @protected */
|
|
75
75
|
disconnectedCallback() {
|
|
76
76
|
super.disconnectedCallback();
|
|
77
|
-
|
|
78
|
-
this._observer.disconnect();
|
|
79
|
-
}
|
|
77
|
+
this._observer?.disconnect();
|
|
80
78
|
}
|
|
81
79
|
|
|
82
80
|
/**
|
|
@@ -333,9 +331,7 @@ export const GridColumnGroupMixin = (superClass) =>
|
|
|
333
331
|
this._preventHiddenSynchronization = false;
|
|
334
332
|
|
|
335
333
|
// Update the column tree
|
|
336
|
-
|
|
337
|
-
this._grid._debounceUpdateColumnTree();
|
|
338
|
-
}
|
|
334
|
+
this._grid?._debounceUpdateColumnTree?.();
|
|
339
335
|
});
|
|
340
336
|
this._observer.flush();
|
|
341
337
|
}
|
|
@@ -12,7 +12,7 @@ export type GridBodyRenderer<TItem, Column extends GridColumnMixin<TItem, Column
|
|
|
12
12
|
model: GridItemModel<TItem>,
|
|
13
13
|
) => void;
|
|
14
14
|
|
|
15
|
-
export type GridColumnTextAlign = 'center' | 'end' | 'start' | null;
|
|
15
|
+
export type GridColumnTextAlign = 'center' | 'end' | 'left' | 'right' | 'start' | null;
|
|
16
16
|
|
|
17
17
|
export type GridHeaderFooterRenderer<TItem, Column extends ColumnBaseMixinClass<TItem, Column>> = (
|
|
18
18
|
root: HTMLElement,
|
|
@@ -71,8 +71,8 @@ export declare class ColumnBaseMixinClass<TItem, Column extends ColumnBaseMixinC
|
|
|
71
71
|
|
|
72
72
|
/**
|
|
73
73
|
* Aligns the columns cell content horizontally.
|
|
74
|
-
*
|
|
75
|
-
* @attr {start|center|end} text-align
|
|
74
|
+
*
|
|
75
|
+
* @attr {start|center|end|left|right} text-align
|
|
76
76
|
*/
|
|
77
77
|
textAlign: GridColumnTextAlign | null | undefined;
|
|
78
78
|
|