Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@vaadin/grid

Package Overview
Dependencies
Maintainers
12
Versions
405
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vaadin/grid - npm Package Compare versions

Comparing version 23.3.0-alpha3 to 24.0.0-alpha1

20

package.json
{
"name": "@vaadin/grid",
"version": "23.3.0-alpha3",
"version": "24.0.0-alpha1",
"publishConfig": {

@@ -48,13 +48,13 @@ "access": "public"

"@polymer/polymer": "^3.0.0",
"@vaadin/checkbox": "23.3.0-alpha3",
"@vaadin/component-base": "23.3.0-alpha3",
"@vaadin/lit-renderer": "23.3.0-alpha3",
"@vaadin/text-field": "23.3.0-alpha3",
"@vaadin/vaadin-lumo-styles": "23.3.0-alpha3",
"@vaadin/vaadin-material-styles": "23.3.0-alpha3",
"@vaadin/vaadin-themable-mixin": "23.3.0-alpha3"
"@vaadin/checkbox": "24.0.0-alpha1",
"@vaadin/component-base": "24.0.0-alpha1",
"@vaadin/lit-renderer": "24.0.0-alpha1",
"@vaadin/text-field": "24.0.0-alpha1",
"@vaadin/vaadin-lumo-styles": "24.0.0-alpha1",
"@vaadin/vaadin-material-styles": "24.0.0-alpha1",
"@vaadin/vaadin-themable-mixin": "24.0.0-alpha1"
},
"devDependencies": {
"@esm-bundle/chai": "^4.3.4",
"@vaadin/polymer-legacy-adapter": "23.3.0-alpha3",
"@vaadin/polymer-legacy-adapter": "24.0.0-alpha1",
"@vaadin/testing-helpers": "^0.3.2",

@@ -68,3 +68,3 @@ "lit": "^2.0.0",

],
"gitHead": "e86cd2abf3e28bade37711291331415d92c454ec"
"gitHead": "427527c27c4b27822d61fd41d38d7b170134770b"
}

@@ -826,2 +826,15 @@ /**

/**
* When true, wraps the cell's slot into an element with role="button", and sets
* the tabindex attribute on the button element, instead of the cell itself.
* This is needed to keep focus in sync with VoiceOver cursor when navigating
* with Control + Option + arrow keys: focusing the `<td>` element does not fire
* a focus event, but focusing an element with role="button" inside a cell fires it.
* @protected
*/
_focusButtonMode: {
type: Boolean,
value: false,
},
/**
* @type {Array<!HTMLElement>}

@@ -828,0 +841,0 @@ * @protected

@@ -6,2 +6,3 @@ /**

*/
import { addValueToAttribute, removeValueFromAttribute } from '@vaadin/component-base/src/dom-utils.js';
import { isKeyboardActive } from '@vaadin/component-base/src/focus-utils.js';

@@ -52,2 +53,8 @@

/** @private */
_focusedCell: {
type: Object,
observer: '_focusedCellChanged',
},
/**

@@ -114,7 +121,17 @@ * Indicates whether the grid is currently in interaction mode.

set __rowFocusMode(value) {
['_itemsFocusable', '_footerFocusable', '_headerFocusable'].forEach((focusable) => {
if (value && this.__isCell(this[focusable])) {
this[focusable] = this[focusable].parentElement;
} else if (!value && this.__isRow(this[focusable])) {
this[focusable] = this[focusable].firstElementChild;
['_itemsFocusable', '_footerFocusable', '_headerFocusable'].forEach((prop) => {
const focusable = this[prop];
if (value) {
const parent = focusable && focusable.parentElement;
if (this.__isCell(focusable)) {
// Cell itself focusable (default)
this[prop] = parent;
} else if (this.__isCell(parent)) {
// Focus button mode is enabled for the column,
// button element inside the cell is focusable.
this[prop] = parent.parentElement;
}
} else if (!value && this.__isRow(focusable)) {
const cell = focusable.firstElementChild;
this[prop] = cell._focusButton || cell;
}

@@ -135,2 +152,13 @@ });

/** @private */
_focusedCellChanged(focusedCell, oldFocusedCell) {
if (oldFocusedCell) {
removeValueFromAttribute(oldFocusedCell, 'part', 'focused-cell');
}
if (focusedCell) {
addValueToAttribute(focusedCell, 'part', 'focused-cell');
}
}
/** @private */
_interactingChanged() {

@@ -161,6 +189,18 @@ // Update focus targets when entering / exiting interaction mode

this._itemsFocusable = row;
} else if (this._itemsFocusable.parentElement) {
} else {
// Cell focus mode
const cellIndex = [...this._itemsFocusable.parentElement.children].indexOf(this._itemsFocusable);
this._itemsFocusable = row.children[cellIndex];
let parent = this._itemsFocusable.parentElement;
let cell = this._itemsFocusable;
if (parent) {
// Focus button mode is enabled for the column,
// button element inside the cell is focusable.
if (this.__isCell(parent)) {
cell = parent;
parent = parent.parentElement;
}
const cellIndex = [...parent.children].indexOf(cell);
this._itemsFocusable = this.__getFocusable(row, row.children[cellIndex]);
}
}

@@ -735,2 +775,3 @@ }

this._hideTooltip();
this._focusedCell = null;
}

@@ -746,7 +787,7 @@

if (this.$.header === section) {
this._headerFocusable = this.__rowFocusMode ? row : cell;
this._headerFocusable = this.__getFocusable(row, cell);
} else if (this.$.items === section) {
this._itemsFocusable = this.__rowFocusMode ? row : cell;
this._itemsFocusable = this.__getFocusable(row, cell);
} else if (this.$.footer === section) {
this._footerFocusable = this.__rowFocusMode ? row : cell;
this._footerFocusable = this.__getFocusable(row, cell);
}

@@ -758,2 +799,3 @@

cell.dispatchEvent(new CustomEvent('cell-focus', { bubbles: true, composed: true, detail: { context } }));
this._focusedCell = cell._focusButton || cell;

@@ -763,2 +805,4 @@ if (isKeyboardActive() && e.target === cell) {

}
} else {
this._focusedCell = null;
}

@@ -771,2 +815,15 @@ }

/**
* Get the focusable element depending on the current focus mode.
* It can be a row, a cell, or a focusable div inside a cell.
*
* @param {HTMLElement} row
* @param {HTMLElement} cell
* @return {HTMLElement}
* @private
*/
__getFocusable(row, cell) {
return this.__rowFocusMode ? row : cell._focusButton || cell;
}
/**
* Enables interaction mode if a cells descendant receives focus or keyboard

@@ -860,3 +917,3 @@ * input. Disables it if the event is not related to cell content.

if (firstVisibleRow && firstVisibleCell) {
this[`_${section}Focusable`] = this.__rowFocusMode ? firstVisibleRow : firstVisibleCell;
this[`_${section}Focusable`] = this.__getFocusable(firstVisibleRow, firstVisibleCell);
}

@@ -874,3 +931,3 @@ }

delete this._focusedColumnOrder;
this._itemsFocusable = this.__rowFocusMode ? firstVisibleRow : firstVisibleCell;
this._itemsFocusable = this.__getFocusable(firstVisibleRow, firstVisibleCell);
}

@@ -877,0 +934,0 @@ } else {

@@ -140,2 +140,5 @@ /**

}
if (!this.hasAttribute('navigating')) {
this._hideTooltip(true);
}

@@ -142,0 +145,0 @@ this._updateOverflow();

@@ -145,2 +145,13 @@ /**

[part~='cell'] > [tabindex] {
display: flex;
align-items: inherit;
outline: none;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
[part~='details-cell'] {

@@ -147,0 +158,0 @@ position: absolute;

@@ -296,2 +296,3 @@ /**

* `details-cell` | Row details cell in the internal table
* `focused-cell` | Focused cell in the internal table
* `resize-handle` | Handle for resizing the columns

@@ -298,0 +299,0 @@ * `reorder-ghost` | Ghost element of the header cell being dragged

@@ -183,2 +183,3 @@ /**

* `details-cell` | Row details cell in the internal table
* `focused-cell` | Focused cell in the internal table
* `resize-handle` | Handle for resizing the columns

@@ -664,3 +665,3 @@ * `reorder-ghost` | Ghost element of the header cell being dragged

/** @private */
_createCell(tagName) {
_createCell(tagName, column) {
const contentId = (this._contentIndex = this._contentIndex + 1 || 0);

@@ -674,3 +675,2 @@ const slotName = `vaadin-grid-cell-content-${contentId}`;

cell.id = slotName.replace('-content-', '-');
cell.setAttribute('tabindex', '-1');
cell.setAttribute('role', tagName === 'td' ? 'gridcell' : 'columnheader');

@@ -681,3 +681,5 @@

cell.addEventListener('mouseenter', (event) => {
this._showTooltip(event);
if (!this.$.scroller.hasAttribute('scrolling')) {
this._showTooltip(event);
}
});

@@ -697,4 +699,20 @@

cell.appendChild(slot);
if (column && column._focusButtonMode) {
const div = document.createElement('div');
div.setAttribute('role', 'button');
div.setAttribute('tabindex', '-1');
cell.appendChild(div);
// Patch `focus()` to use the button
cell._focusButton = div;
cell.focus = function () {
cell._focusButton.focus();
};
div.appendChild(slot);
} else {
cell.setAttribute('tabindex', '-1');
cell.appendChild(slot);
}
cell._content = cellContent;

@@ -762,3 +780,3 @@

if (!cell) {
cell = this._createCell('td');
cell = this._createCell('td', column);
column._cells.push(cell);

@@ -765,0 +783,0 @@ }

@@ -72,3 +72,3 @@ import '@vaadin/vaadin-lumo-styles/color.js';

[part~='row']:focus,
[part~='cell']:focus {
[part~='focused-cell']:focus {
outline: none;

@@ -78,3 +78,3 @@ }

:host([navigating]) [part~='row']:focus::before,
:host([navigating]) [part~='cell']:focus::before {
:host([navigating]) [part~='focused-cell']:focus::before {
content: '';

@@ -81,0 +81,0 @@ position: absolute;

@@ -134,3 +134,3 @@ import '@vaadin/vaadin-material-styles/color.js';

[part~='row']:focus,
[part~='cell']:focus {
[part~='focused-cell']:focus {
outline: none;

@@ -140,3 +140,3 @@ }

:host([navigating]) [part~='row']:focus::before,
:host([navigating]) [part~='cell']:focus {
:host([navigating]) [part~='focused-cell']:focus {
box-shadow: inset 0 0 0 2px var(--material-primary-color);

@@ -143,0 +143,0 @@ }

{
"$schema": "https://json.schemastore.org/web-types",
"name": "@vaadin/grid",
"version": "23.3.0-alpha3",
"version": "24.0.0-alpha1",
"description-markup": "markdown",

@@ -19,3 +19,3 @@ "framework": "lit",

"name": "vaadin-grid-column",
"description": "A `<vaadin-grid-column>` is used to configure how a column in `<vaadin-grid>`\nshould look like.\n\nSee [`<vaadin-grid>`](https://cdn.vaadin.com/vaadin-web-components/23.3.0-alpha3/#/elements/vaadin-grid) documentation for instructions on how\nto configure the `<vaadin-grid-column>`.",
"description": "A `<vaadin-grid-column>` is used to configure how a column in `<vaadin-grid>`\nshould look like.\n\nSee [`<vaadin-grid>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha1/#/elements/vaadin-grid) documentation for instructions on how\nto configure the `<vaadin-grid-column>`.",
"extension": true,

@@ -307,3 +307,3 @@ "attributes": [

"name": "vaadin-grid-selection-column",
"description": "`<vaadin-grid-selection-column>` is a helper element for the `<vaadin-grid>`\nthat provides default renderers and functionality for item selection.\n\n#### Example:\n```html\n<vaadin-grid items=\"[[items]]\">\n <vaadin-grid-selection-column frozen auto-select></vaadin-grid-selection-column>\n\n <vaadin-grid-column>\n ...\n```\n\nBy default the selection column displays `<vaadin-checkbox>` elements in the\ncolumn cells. The checkboxes in the body rows toggle selection of the corresponding row items.\n\nWhen the grid data is provided as an array of [`items`](https://cdn.vaadin.com/vaadin-web-components/23.3.0-alpha3/#/elements/vaadin-grid#property-items),\nthe column header gets an additional checkbox that can be used for toggling\nselection for all the items at once.\n\n__The default content can also be overridden__",
"description": "`<vaadin-grid-selection-column>` is a helper element for the `<vaadin-grid>`\nthat provides default renderers and functionality for item selection.\n\n#### Example:\n```html\n<vaadin-grid items=\"[[items]]\">\n <vaadin-grid-selection-column frozen auto-select></vaadin-grid-selection-column>\n\n <vaadin-grid-column>\n ...\n```\n\nBy default the selection column displays `<vaadin-checkbox>` elements in the\ncolumn cells. The checkboxes in the body rows toggle selection of the corresponding row items.\n\nWhen the grid data is provided as an array of [`items`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha1/#/elements/vaadin-grid#property-items),\nthe column header gets an additional checkbox that can be used for toggling\nselection for all the items at once.\n\n__The default content can also be overridden__",
"extension": true,

@@ -707,3 +707,3 @@ "attributes": [

"name": "vaadin-grid",
"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`](https://cdn.vaadin.com/vaadin-web-components/23.3.0-alpha3/#/elements/vaadin-grid#property-items) property to visualize your data.\n\nUse the [`<vaadin-grid-column>`](https://cdn.vaadin.com/vaadin-web-components/23.3.0-alpha3/#/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\nThe following helper elements can be used for further customization:\n- [`<vaadin-grid-column-group>`](https://cdn.vaadin.com/vaadin-web-components/23.3.0-alpha3/#/elements/vaadin-grid-column-group)\n- [`<vaadin-grid-filter>`](https://cdn.vaadin.com/vaadin-web-components/23.3.0-alpha3/#/elements/vaadin-grid-filter)\n- [`<vaadin-grid-sorter>`](https://cdn.vaadin.com/vaadin-web-components/23.3.0-alpha3/#/elements/vaadin-grid-sorter)\n- [`<vaadin-grid-selection-column>`](https://cdn.vaadin.com/vaadin-web-components/23.3.0-alpha3/#/elements/vaadin-grid-selection-column)\n- [`<vaadin-grid-tree-toggle>`](https://cdn.vaadin.com/vaadin-web-components/23.3.0-alpha3/#/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.html` bundle.\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`](https://cdn.vaadin.com/vaadin-web-components/23.3.0-alpha3/#/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`](https://cdn.vaadin.com/vaadin-web-components/23.3.0-alpha3/#/elements/vaadin-grid#property-dataProvider) in\nthe API reference below for the detailed data provider arguments description,\nand the “Assigning Data” page in the demos.\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`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`resize-handle` | Handle for resizing the columns\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`last-frozen` | Last frozen cell | 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 drag of a row is starting. The value is a number when multiple rows are dragged | 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/custom-theme/styling-components) documentation.",
"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`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha1/#/elements/vaadin-grid#property-items) property to visualize your data.\n\nUse the [`<vaadin-grid-column>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha1/#/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\nThe following helper elements can be used for further customization:\n- [`<vaadin-grid-column-group>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha1/#/elements/vaadin-grid-column-group)\n- [`<vaadin-grid-filter>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha1/#/elements/vaadin-grid-filter)\n- [`<vaadin-grid-sorter>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha1/#/elements/vaadin-grid-sorter)\n- [`<vaadin-grid-selection-column>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha1/#/elements/vaadin-grid-selection-column)\n- [`<vaadin-grid-tree-toggle>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha1/#/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.html` bundle.\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`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha1/#/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`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha1/#/elements/vaadin-grid#property-dataProvider) in\nthe API reference below for the detailed data provider arguments description,\nand the “Assigning Data” page in the demos.\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`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`resize-handle` | Handle for resizing the columns\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`last-frozen` | Last frozen cell | 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 drag of a row is starting. The value is a number when multiple rows are dragged | 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/custom-theme/styling-components) documentation.",
"extension": true,

@@ -710,0 +710,0 @@ "attributes": [

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc