@vaadin/grid 25.4.0-alpha1 → 25.4.0-alpha3
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 +18 -18
- package/package.json +12 -12
- package/src/styles/vaadin-grid-base-styles.js +4 -0
- package/src/vaadin-grid-column-reordering-mixin.js +2 -2
- package/src/vaadin-grid-column-resizing-mixin.js +3 -4
- package/src/vaadin-grid-data-provider-mixin.d.ts +0 -15
- package/src/vaadin-grid-data-provider-mixin.js +0 -42
- package/src/vaadin-grid-helpers.js +5 -3
- package/src/vaadin-grid-keyboard-navigation-mixin.js +5 -3
- package/src/vaadin-grid-mixin.js +7 -44
- package/src/vaadin-grid-row-details-mixin.js +3 -10
- package/src/vaadin-grid-scroll-mixin.d.ts +15 -0
- package/src/vaadin-grid-scroll-mixin.js +46 -4
- package/web-types.json +4 -4
- package/web-types.lit.json +4 -4
package/custom-elements.json
CHANGED
|
@@ -2428,20 +2428,6 @@
|
|
|
2428
2428
|
"description": "Number of items fetched at a time from the dataprovider.",
|
|
2429
2429
|
"attribute": "page-size"
|
|
2430
2430
|
},
|
|
2431
|
-
{
|
|
2432
|
-
"kind": "method",
|
|
2433
|
-
"name": "scrollToIndex",
|
|
2434
|
-
"parameters": [
|
|
2435
|
-
{
|
|
2436
|
-
"name": "indexes",
|
|
2437
|
-
"description": "Row indexes to scroll to",
|
|
2438
|
-
"type": {
|
|
2439
|
-
"text": "...number"
|
|
2440
|
-
}
|
|
2441
|
-
}
|
|
2442
|
-
],
|
|
2443
|
-
"description": "Scroll to a specific row index in the virtual list. Note that the row index is\nnot always the same for any particular item. For example, sorting or filtering\nitems can affect the row index related to an item.\n\nThe `indexes` parameter can be either a single number or multiple numbers.\nThe grid will first try to scroll to the item at the first index on the top level.\nIn case the item at the first index is expanded, the grid will then try scroll to the\nitem at the second index within the children of the expanded first item, and so on.\nEach given index points to a child of the item at the previous index.\n\nUsing `Infinity` as an index will point to the last item on the level."
|
|
2444
|
-
},
|
|
2445
2431
|
{
|
|
2446
2432
|
"kind": "field",
|
|
2447
2433
|
"name": "size",
|
|
@@ -4452,8 +4438,8 @@
|
|
|
4452
4438
|
],
|
|
4453
4439
|
"description": "Scroll to a specific row index in the virtual list. Note that the row index is\nnot always the same for any particular item. For example, sorting or filtering\nitems can affect the row index related to an item.\n\nThe `indexes` parameter can be either a single number or multiple numbers.\nThe grid will first try to scroll to the item at the first index on the top level.\nIn case the item at the first index is expanded, the grid will then try scroll to the\nitem at the second index within the children of the expanded first item, and so on.\nEach given index points to a child of the item at the previous index.\n\nUsing `Infinity` as an index will point to the last item on the level.",
|
|
4454
4440
|
"inheritedFrom": {
|
|
4455
|
-
"name": "
|
|
4456
|
-
"module": "src/vaadin-grid-
|
|
4441
|
+
"name": "ScrollMixin",
|
|
4442
|
+
"module": "src/vaadin-grid-scroll-mixin.js"
|
|
4457
4443
|
}
|
|
4458
4444
|
},
|
|
4459
4445
|
{
|
|
@@ -5063,6 +5049,20 @@
|
|
|
5063
5049
|
}
|
|
5064
5050
|
],
|
|
5065
5051
|
"description": "Scrolls horizontally so that the column becomes visible in the viewport.\n\nThe column can be specified either by its index (among visible columns\nin visual order) or by the column element itself."
|
|
5052
|
+
},
|
|
5053
|
+
{
|
|
5054
|
+
"kind": "method",
|
|
5055
|
+
"name": "scrollToIndex",
|
|
5056
|
+
"parameters": [
|
|
5057
|
+
{
|
|
5058
|
+
"name": "indexes",
|
|
5059
|
+
"description": "Row indexes to scroll to",
|
|
5060
|
+
"type": {
|
|
5061
|
+
"text": "...number"
|
|
5062
|
+
}
|
|
5063
|
+
}
|
|
5064
|
+
],
|
|
5065
|
+
"description": "Scroll to a specific row index in the virtual list. Note that the row index is\nnot always the same for any particular item. For example, sorting or filtering\nitems can affect the row index related to an item.\n\nThe `indexes` parameter can be either a single number or multiple numbers.\nThe grid will first try to scroll to the item at the first index on the top level.\nIn case the item at the first index is expanded, the grid will then try scroll to the\nitem at the second index within the children of the expanded first item, and so on.\nEach given index points to a child of the item at the previous index.\n\nUsing `Infinity` as an index will point to the last item on the level."
|
|
5066
5066
|
}
|
|
5067
5067
|
],
|
|
5068
5068
|
"attributes": [
|
|
@@ -8266,8 +8266,8 @@
|
|
|
8266
8266
|
],
|
|
8267
8267
|
"description": "Scroll to a specific row index in the virtual list. Note that the row index is\nnot always the same for any particular item. For example, sorting or filtering\nitems can affect the row index related to an item.\n\nThe `indexes` parameter can be either a single number or multiple numbers.\nThe grid will first try to scroll to the item at the first index on the top level.\nIn case the item at the first index is expanded, the grid will then try scroll to the\nitem at the second index within the children of the expanded first item, and so on.\nEach given index points to a child of the item at the previous index.\n\nUsing `Infinity` as an index will point to the last item on the level.",
|
|
8268
8268
|
"inheritedFrom": {
|
|
8269
|
-
"name": "
|
|
8270
|
-
"module": "src/vaadin-grid-
|
|
8269
|
+
"name": "ScrollMixin",
|
|
8270
|
+
"module": "src/vaadin-grid-scroll-mixin.js"
|
|
8271
8271
|
}
|
|
8272
8272
|
},
|
|
8273
8273
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/grid",
|
|
3
|
-
"version": "25.4.0-
|
|
3
|
+
"version": "25.4.0-alpha3",
|
|
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.4.0-
|
|
49
|
-
"@vaadin/checkbox": "25.4.0-
|
|
50
|
-
"@vaadin/component-base": "25.4.0-
|
|
51
|
-
"@vaadin/lit-renderer": "25.4.0-
|
|
52
|
-
"@vaadin/text-field": "25.4.0-
|
|
53
|
-
"@vaadin/vaadin-themable-mixin": "25.4.0-
|
|
48
|
+
"@vaadin/a11y-base": "25.4.0-alpha3",
|
|
49
|
+
"@vaadin/checkbox": "25.4.0-alpha3",
|
|
50
|
+
"@vaadin/component-base": "25.4.0-alpha3",
|
|
51
|
+
"@vaadin/lit-renderer": "25.4.0-alpha3",
|
|
52
|
+
"@vaadin/text-field": "25.4.0-alpha3",
|
|
53
|
+
"@vaadin/vaadin-themable-mixin": "25.4.0-alpha3",
|
|
54
54
|
"lit": "^3.0.0"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@vaadin/aura": "25.4.0-
|
|
58
|
-
"@vaadin/chai-plugins": "25.4.0-
|
|
59
|
-
"@vaadin/test-runner-commands": "25.4.0-
|
|
57
|
+
"@vaadin/aura": "25.4.0-alpha3",
|
|
58
|
+
"@vaadin/chai-plugins": "25.4.0-alpha3",
|
|
59
|
+
"@vaadin/test-runner-commands": "25.4.0-alpha3",
|
|
60
60
|
"@vaadin/testing-helpers": "^2.0.0",
|
|
61
|
-
"@vaadin/vaadin-lumo-styles": "25.4.0-
|
|
61
|
+
"@vaadin/vaadin-lumo-styles": "25.4.0-alpha3",
|
|
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": "db7e679c1a8af00840cc05ddcbefff68dfed1e45"
|
|
70
70
|
}
|
|
@@ -36,7 +36,7 @@ export const ColumnReorderingMixin = (superClass) =>
|
|
|
36
36
|
ready() {
|
|
37
37
|
super.ready();
|
|
38
38
|
addListener(this, 'track', this._onTrackEvent);
|
|
39
|
-
this._reorderGhost = this.shadowRoot.querySelector('
|
|
39
|
+
this._reorderGhost = this.shadowRoot.querySelector('.reorder-ghost');
|
|
40
40
|
|
|
41
41
|
this.addEventListener('touchstart', this._onTouchStart.bind(this));
|
|
42
42
|
this.addEventListener('touchmove', this._onTouchMove.bind(this));
|
|
@@ -422,7 +422,7 @@ export const ColumnReorderingMixin = (superClass) =>
|
|
|
422
422
|
* @protected
|
|
423
423
|
*/
|
|
424
424
|
_isSwappableByPosition(targetColumn, clientX) {
|
|
425
|
-
const targetCell = Array.from(this.$.header.querySelectorAll('tr:not([hidden])
|
|
425
|
+
const targetCell = Array.from(this.$.header.querySelectorAll('tr:not([hidden]) .header-cell')).find((cell) =>
|
|
426
426
|
targetColumn.contains(cell._column),
|
|
427
427
|
);
|
|
428
428
|
const sourceCellRect = this.$.header
|
|
@@ -63,8 +63,8 @@ export const ColumnResizingMixin = (superClass) =>
|
|
|
63
63
|
|
|
64
64
|
const isRTL = this.__isRTL;
|
|
65
65
|
const eventX = e.detail.x;
|
|
66
|
-
const
|
|
67
|
-
const
|
|
66
|
+
const targetCell = column._headerCell;
|
|
67
|
+
const columnRowCells = [...targetCell.parentElement.children];
|
|
68
68
|
// Resize the target column
|
|
69
69
|
if (targetCell.offsetWidth) {
|
|
70
70
|
const style = getComputedStyle(targetCell._content);
|
|
@@ -123,8 +123,7 @@ export const ColumnResizingMixin = (superClass) =>
|
|
|
123
123
|
);
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
-
|
|
127
|
-
this._resizeHandler();
|
|
126
|
+
this.__updateHorizontalScrollPosition();
|
|
128
127
|
}
|
|
129
128
|
}
|
|
130
129
|
};
|
|
@@ -116,19 +116,4 @@ export declare class DataProviderMixinClass<TItem> {
|
|
|
116
116
|
* Clears the cached pages and reloads data from dataprovider when needed.
|
|
117
117
|
*/
|
|
118
118
|
clearCache(): void;
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* Scroll to a specific row index in the virtual list. Note that the row index is
|
|
122
|
-
* not always the same for any particular item. For example, sorting or filtering
|
|
123
|
-
* items can affect the row index related to an item.
|
|
124
|
-
*
|
|
125
|
-
* The `indexes` parameter can be either a single number or multiple numbers.
|
|
126
|
-
* The grid will first try to scroll to the item at the first index on the top level.
|
|
127
|
-
* In case the item at the first index is expanded, the grid will then try scroll to the
|
|
128
|
-
* item at the second index within the children of the expanded first item, and so on.
|
|
129
|
-
* Each given index points to a child of the item at the previous index.
|
|
130
|
-
*
|
|
131
|
-
* Using `Infinity` as an index will point to the last item on the level.
|
|
132
|
-
*/
|
|
133
|
-
scrollToIndex(...indexes: number[]): void;
|
|
134
119
|
}
|
|
@@ -393,46 +393,4 @@ export const DataProviderMixin = (superClass) =>
|
|
|
393
393
|
_itemsEqual(item1, item2) {
|
|
394
394
|
return this.getItemId(item1) === this.getItemId(item2);
|
|
395
395
|
}
|
|
396
|
-
|
|
397
|
-
/**
|
|
398
|
-
* Scroll to a specific row index in the virtual list. Note that the row index is
|
|
399
|
-
* not always the same for any particular item. For example, sorting or filtering
|
|
400
|
-
* items can affect the row index related to an item.
|
|
401
|
-
*
|
|
402
|
-
* The `indexes` parameter can be either a single number or multiple numbers.
|
|
403
|
-
* The grid will first try to scroll to the item at the first index on the top level.
|
|
404
|
-
* In case the item at the first index is expanded, the grid will then try scroll to the
|
|
405
|
-
* item at the second index within the children of the expanded first item, and so on.
|
|
406
|
-
* Each given index points to a child of the item at the previous index.
|
|
407
|
-
*
|
|
408
|
-
* Using `Infinity` as an index will point to the last item on the level.
|
|
409
|
-
*
|
|
410
|
-
* @param indexes {...number} Row indexes to scroll to
|
|
411
|
-
*/
|
|
412
|
-
scrollToIndex(...indexes) {
|
|
413
|
-
if (!this.__virtualizer || !this.clientHeight || !this._columnTree) {
|
|
414
|
-
this.__pendingScrollToIndexes = indexes;
|
|
415
|
-
return;
|
|
416
|
-
}
|
|
417
|
-
// Synchronous data provider may cause changes to the cache on scroll without
|
|
418
|
-
// ending up in a loading state. Try scrolling to the index until the target
|
|
419
|
-
// index stabilizes.
|
|
420
|
-
let targetIndex;
|
|
421
|
-
while (targetIndex !== (targetIndex = this._dataProviderController.getFlatIndexByPath(indexes))) {
|
|
422
|
-
this._scrollToFlatIndex(targetIndex);
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
if (this._dataProviderController.isLoading()) {
|
|
426
|
-
this.__pendingScrollToIndexes = indexes;
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
/** @private */
|
|
431
|
-
__scrollToPendingIndexes() {
|
|
432
|
-
if (this.__pendingScrollToIndexes) {
|
|
433
|
-
const indexes = this.__pendingScrollToIndexes;
|
|
434
|
-
delete this.__pendingScrollToIndexes;
|
|
435
|
-
this.scrollToIndex(...indexes);
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
396
|
};
|
|
@@ -27,7 +27,7 @@ export function getClosestCell(node) {
|
|
|
27
27
|
*/
|
|
28
28
|
export function getBodyRowCells(row) {
|
|
29
29
|
// If available, return the cached cells. Otherwise, query the cells directly from the row.
|
|
30
|
-
return row.__cells || Array.from(row.querySelectorAll('
|
|
30
|
+
return row.__cells || Array.from(row.querySelectorAll('.body-cell'));
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
/**
|
|
@@ -48,8 +48,10 @@ export function iterateChildren(container, callback) {
|
|
|
48
48
|
*/
|
|
49
49
|
export function iterateRowCells(row, callback) {
|
|
50
50
|
getBodyRowCells(row).forEach(callback);
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
|
|
52
|
+
const detailsCell = row.querySelector('.details-cell');
|
|
53
|
+
if (detailsCell) {
|
|
54
|
+
callback(detailsCell);
|
|
53
55
|
}
|
|
54
56
|
}
|
|
55
57
|
|
|
@@ -17,7 +17,7 @@ function isCell(element) {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
function isDetailsCell(element) {
|
|
20
|
-
return element.
|
|
20
|
+
return element.classList.contains('details-cell');
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
export const KeyboardNavigationMixin = (superClass) =>
|
|
@@ -641,6 +641,8 @@ export const KeyboardNavigationMixin = (superClass) =>
|
|
|
641
641
|
|
|
642
642
|
/** @private */
|
|
643
643
|
_predictFocusStepTarget(srcElement, step) {
|
|
644
|
+
this._debounceColumnContentVisibility?.flush();
|
|
645
|
+
|
|
644
646
|
const tabOrder = [
|
|
645
647
|
this.$.table,
|
|
646
648
|
this._headerFocusable,
|
|
@@ -676,8 +678,8 @@ export const KeyboardNavigationMixin = (superClass) =>
|
|
|
676
678
|
if (focusStepTarget === this._headerFocusable) {
|
|
677
679
|
focusStepTarget = firstVisibleColumn._headerCell;
|
|
678
680
|
} else if (focusStepTarget === this._itemsFocusable) {
|
|
679
|
-
const
|
|
680
|
-
focusStepTarget =
|
|
681
|
+
const row = focusStepTarget.parentElement;
|
|
682
|
+
focusStepTarget = [...row.children].find((cell) => cell._column === firstVisibleColumn);
|
|
681
683
|
} else if (focusStepTarget === this._footerFocusable) {
|
|
682
684
|
focusStepTarget = firstVisibleColumn._footerCell;
|
|
683
685
|
}
|
package/src/vaadin-grid-mixin.js
CHANGED
|
@@ -434,14 +434,16 @@ export const GridMixin = (superClass) =>
|
|
|
434
434
|
iterateRowCells(row, (cell) => {
|
|
435
435
|
cell._vacant = true;
|
|
436
436
|
});
|
|
437
|
+
|
|
438
|
+
const detailsCell = row.querySelector('.details-cell');
|
|
439
|
+
if (detailsCell) {
|
|
440
|
+
this.__teardownDetailsCell(detailsCell);
|
|
441
|
+
}
|
|
442
|
+
|
|
437
443
|
row.innerHTML = '';
|
|
438
444
|
if (section === 'body') {
|
|
439
445
|
// Clear the cached cell references
|
|
440
446
|
row.__cells = [];
|
|
441
|
-
if (row.__detailsCell) {
|
|
442
|
-
this.__teardownDetailsCell(row.__detailsCell);
|
|
443
|
-
}
|
|
444
|
-
row.__detailsCell = null;
|
|
445
447
|
}
|
|
446
448
|
|
|
447
449
|
columns
|
|
@@ -490,8 +492,6 @@ export const GridMixin = (superClass) =>
|
|
|
490
492
|
this._configureDetailsCell(detailsCell);
|
|
491
493
|
detailsCell.__parentRow = row;
|
|
492
494
|
row.appendChild(detailsCell);
|
|
493
|
-
// Cache the details cell reference
|
|
494
|
-
row.__detailsCell = detailsCell;
|
|
495
495
|
this.__a11ySetRowDetailsCell(row, detailsCell);
|
|
496
496
|
detailsCell._vacant = false;
|
|
497
497
|
}
|
|
@@ -575,7 +575,7 @@ export const GridMixin = (superClass) =>
|
|
|
575
575
|
// Sizer rows
|
|
576
576
|
this.__initRow(this.$.sizer, columnTree[columnTree.length - 1]);
|
|
577
577
|
|
|
578
|
-
this.
|
|
578
|
+
this.__updateHorizontalScrollPosition();
|
|
579
579
|
this.__a11yUpdateHeaderRows();
|
|
580
580
|
this.__a11yUpdateFooterRows();
|
|
581
581
|
this.__updateHeaderAndFooter();
|
|
@@ -645,12 +645,6 @@ export const GridMixin = (superClass) =>
|
|
|
645
645
|
this.__a11yUpdateRowExpanded(row, model.expanded);
|
|
646
646
|
}
|
|
647
647
|
|
|
648
|
-
/** @private */
|
|
649
|
-
_resizeHandler() {
|
|
650
|
-
this._updateDetailsCellHeights();
|
|
651
|
-
this.__updateHorizontalScrollPosition();
|
|
652
|
-
}
|
|
653
|
-
|
|
654
648
|
/**
|
|
655
649
|
* @param {!HTMLTableRowElement} row
|
|
656
650
|
* @return {!GridItemModel}
|
|
@@ -678,10 +672,6 @@ export const GridMixin = (superClass) =>
|
|
|
678
672
|
if (tooltip?.isConnected) {
|
|
679
673
|
const target = event.target;
|
|
680
674
|
|
|
681
|
-
if (!this.__isCellFullyVisible(target)) {
|
|
682
|
-
return;
|
|
683
|
-
}
|
|
684
|
-
|
|
685
675
|
this._tooltipController.setTarget(target);
|
|
686
676
|
this._tooltipController.setContext(this.getEventContext(event));
|
|
687
677
|
|
|
@@ -693,33 +683,6 @@ export const GridMixin = (superClass) =>
|
|
|
693
683
|
}
|
|
694
684
|
}
|
|
695
685
|
|
|
696
|
-
/** @private */
|
|
697
|
-
__isCellFullyVisible(cell) {
|
|
698
|
-
if (cell.hasAttribute('frozen') || cell.hasAttribute('frozen-to-end')) {
|
|
699
|
-
// Frozen cells are always fully visible
|
|
700
|
-
return true;
|
|
701
|
-
}
|
|
702
|
-
|
|
703
|
-
let { left, right } = this.getBoundingClientRect();
|
|
704
|
-
|
|
705
|
-
const frozen = [...cell.parentNode.children].find((cell) => cell.hasAttribute('last-frozen'));
|
|
706
|
-
if (frozen) {
|
|
707
|
-
const frozenRect = frozen.getBoundingClientRect();
|
|
708
|
-
left = this.__isRTL ? left : frozenRect.right;
|
|
709
|
-
right = this.__isRTL ? frozenRect.left : right;
|
|
710
|
-
}
|
|
711
|
-
|
|
712
|
-
const frozenToEnd = [...cell.parentNode.children].find((cell) => cell.hasAttribute('first-frozen-to-end'));
|
|
713
|
-
if (frozenToEnd) {
|
|
714
|
-
const frozenToEndRect = frozenToEnd.getBoundingClientRect();
|
|
715
|
-
left = this.__isRTL ? frozenToEndRect.right : left;
|
|
716
|
-
right = this.__isRTL ? right : frozenToEndRect.left;
|
|
717
|
-
}
|
|
718
|
-
|
|
719
|
-
const cellRect = cell.getBoundingClientRect();
|
|
720
|
-
return cellRect.left >= left && cellRect.right <= right;
|
|
721
|
-
}
|
|
722
|
-
|
|
723
686
|
/** @protected */
|
|
724
687
|
_hideTooltip(immediate) {
|
|
725
688
|
this._tooltipController.close(immediate);
|
|
@@ -86,7 +86,7 @@ export const RowDetailsMixin = (superClass) =>
|
|
|
86
86
|
if (this._columnTree) {
|
|
87
87
|
// Only update the rows if the column tree has already been initialized
|
|
88
88
|
this._getRenderedRows().forEach((row) => {
|
|
89
|
-
if (!row.querySelector('
|
|
89
|
+
if (!row.querySelector('.details-cell')) {
|
|
90
90
|
this.__initRow(row, this._columnTree[this._columnTree.length - 1]);
|
|
91
91
|
this.__updateRow(row);
|
|
92
92
|
return;
|
|
@@ -133,7 +133,7 @@ export const RowDetailsMixin = (superClass) =>
|
|
|
133
133
|
* @protected
|
|
134
134
|
*/
|
|
135
135
|
_toggleDetailsCell(row, detailsOpened) {
|
|
136
|
-
const cell = row.querySelector('
|
|
136
|
+
const cell = row.querySelector('.details-cell');
|
|
137
137
|
if (!cell) {
|
|
138
138
|
return;
|
|
139
139
|
}
|
|
@@ -153,7 +153,7 @@ export const RowDetailsMixin = (superClass) =>
|
|
|
153
153
|
|
|
154
154
|
/** @protected */
|
|
155
155
|
_updateDetailsCellHeight(row) {
|
|
156
|
-
const cell = row.querySelector('
|
|
156
|
+
const cell = row.querySelector('.details-cell');
|
|
157
157
|
if (!cell) {
|
|
158
158
|
return;
|
|
159
159
|
}
|
|
@@ -172,13 +172,6 @@ export const RowDetailsMixin = (superClass) =>
|
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
174
|
|
|
175
|
-
/** @protected */
|
|
176
|
-
_updateDetailsCellHeights() {
|
|
177
|
-
this._getRenderedRows().forEach((row) => {
|
|
178
|
-
this._updateDetailsCellHeight(row);
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
|
|
182
175
|
/**
|
|
183
176
|
* @param {!GridItem} item
|
|
184
177
|
* @return {boolean}
|
|
@@ -49,6 +49,21 @@ export declare class ScrollMixinClass {
|
|
|
49
49
|
*/
|
|
50
50
|
columnRendering: ColumnRendering;
|
|
51
51
|
|
|
52
|
+
/**
|
|
53
|
+
* Scroll to a specific row index in the virtual list. Note that the row index is
|
|
54
|
+
* not always the same for any particular item. For example, sorting or filtering
|
|
55
|
+
* items can affect the row index related to an item.
|
|
56
|
+
*
|
|
57
|
+
* The `indexes` parameter can be either a single number or multiple numbers.
|
|
58
|
+
* The grid will first try to scroll to the item at the first index on the top level.
|
|
59
|
+
* In case the item at the first index is expanded, the grid will then try scroll to the
|
|
60
|
+
* item at the second index within the children of the expanded first item, and so on.
|
|
61
|
+
* Each given index points to a child of the item at the previous index.
|
|
62
|
+
*
|
|
63
|
+
* Using `Infinity` as an index will point to the last item on the level.
|
|
64
|
+
*/
|
|
65
|
+
scrollToIndex(...indexes: number[]): void;
|
|
66
|
+
|
|
52
67
|
/**
|
|
53
68
|
* Scroll to a flat index in the grid. The method doesn't take into account
|
|
54
69
|
* the hierarchy of the items.
|
|
@@ -134,6 +134,39 @@ export const ScrollMixin = (superClass) =>
|
|
|
134
134
|
this.addController(this.__overflowController);
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
+
/**
|
|
138
|
+
* Scroll to a specific row index in the virtual list. Note that the row index is
|
|
139
|
+
* not always the same for any particular item. For example, sorting or filtering
|
|
140
|
+
* items can affect the row index related to an item.
|
|
141
|
+
*
|
|
142
|
+
* The `indexes` parameter can be either a single number or multiple numbers.
|
|
143
|
+
* The grid will first try to scroll to the item at the first index on the top level.
|
|
144
|
+
* In case the item at the first index is expanded, the grid will then try scroll to the
|
|
145
|
+
* item at the second index within the children of the expanded first item, and so on.
|
|
146
|
+
* Each given index points to a child of the item at the previous index.
|
|
147
|
+
*
|
|
148
|
+
* Using `Infinity` as an index will point to the last item on the level.
|
|
149
|
+
*
|
|
150
|
+
* @param indexes {...number} Row indexes to scroll to
|
|
151
|
+
*/
|
|
152
|
+
scrollToIndex(...indexes) {
|
|
153
|
+
if (!this.clientHeight || !this._columnTree) {
|
|
154
|
+
this.__pendingScrollToIndexes = indexes;
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
// Synchronous data provider may cause changes to the cache on scroll without
|
|
158
|
+
// ending up in a loading state. Try scrolling to the index until the target
|
|
159
|
+
// index stabilizes.
|
|
160
|
+
let targetIndex;
|
|
161
|
+
while (targetIndex !== (targetIndex = this._dataProviderController.getFlatIndexByPath(indexes))) {
|
|
162
|
+
this._scrollToFlatIndex(targetIndex);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
if (this._dataProviderController.isLoading()) {
|
|
166
|
+
this.__pendingScrollToIndexes = indexes;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
137
170
|
/**
|
|
138
171
|
* Scroll to a flat index in the grid. The method doesn't take into account
|
|
139
172
|
* the hierarchy of the items.
|
|
@@ -193,6 +226,15 @@ export const ScrollMixin = (superClass) =>
|
|
|
193
226
|
this.__updateColumnsBodyContentHidden();
|
|
194
227
|
}
|
|
195
228
|
|
|
229
|
+
/** @private */
|
|
230
|
+
__scrollToPendingIndexes() {
|
|
231
|
+
if (this.__pendingScrollToIndexes) {
|
|
232
|
+
const indexes = this.__pendingScrollToIndexes;
|
|
233
|
+
delete this.__pendingScrollToIndexes;
|
|
234
|
+
this.scrollToIndex(...indexes);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
196
238
|
/** @private */
|
|
197
239
|
__scrollToPendingColumn() {
|
|
198
240
|
if (this.__pendingScrollToColumn !== undefined) {
|
|
@@ -364,7 +406,7 @@ export const ScrollMixin = (superClass) =>
|
|
|
364
406
|
/** @protected */
|
|
365
407
|
_frozenCellsChanged() {
|
|
366
408
|
this._debouncerCacheElements = Debouncer.debounce(this._debouncerCacheElements, microTask, () => {
|
|
367
|
-
Array.from(this.shadowRoot.querySelectorAll('
|
|
409
|
+
Array.from(this.shadowRoot.querySelectorAll('.cell')).forEach((cell) => {
|
|
368
410
|
cell.style.transform = '';
|
|
369
411
|
});
|
|
370
412
|
this._frozenCells = Array.prototype.slice.call(this.$.table.querySelectorAll('[frozen]'));
|
|
@@ -476,18 +518,18 @@ export const ScrollMixin = (superClass) =>
|
|
|
476
518
|
}
|
|
477
519
|
});
|
|
478
520
|
|
|
479
|
-
const focusedRow = this.shadowRoot.querySelector(
|
|
521
|
+
const focusedRow = this.shadowRoot.querySelector('.row:focus');
|
|
480
522
|
if (focusedRow) {
|
|
481
523
|
// Update the horizontal scroll position property of the focused row
|
|
482
524
|
this.__updateRowScrollPositionProperty(focusedRow);
|
|
483
525
|
}
|
|
484
526
|
|
|
485
|
-
const lastHeaderRow = this.$.header.querySelector(
|
|
527
|
+
const lastHeaderRow = this.$.header.querySelector('.last-header-row');
|
|
486
528
|
if (lastHeaderRow) {
|
|
487
529
|
this.__updateRowScrollPositionProperty(lastHeaderRow);
|
|
488
530
|
}
|
|
489
531
|
|
|
490
|
-
const firstFooterRow = this.$.footer.querySelector(
|
|
532
|
+
const firstFooterRow = this.$.footer.querySelector('.first-footer-row');
|
|
491
533
|
if (firstFooterRow) {
|
|
492
534
|
this.__updateRowScrollPositionProperty(firstFooterRow);
|
|
493
535
|
}
|
package/web-types.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@vaadin/grid",
|
|
4
|
-
"version": "25.4.0-
|
|
4
|
+
"version": "25.4.0-alpha3",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
@@ -203,7 +203,7 @@
|
|
|
203
203
|
},
|
|
204
204
|
{
|
|
205
205
|
"name": "vaadin-grid-column",
|
|
206
|
-
"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/25.4.0-
|
|
206
|
+
"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/25.4.0-alpha3/#/elements/vaadin-grid) documentation for instructions on how\nto configure the `<vaadin-grid-column>`.",
|
|
207
207
|
"attributes": [
|
|
208
208
|
{
|
|
209
209
|
"name": "auto-width",
|
|
@@ -820,7 +820,7 @@
|
|
|
820
820
|
},
|
|
821
821
|
{
|
|
822
822
|
"name": "vaadin-grid-selection-column",
|
|
823
|
-
"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>\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/25.4.0-
|
|
823
|
+
"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>\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/25.4.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__",
|
|
824
824
|
"attributes": [
|
|
825
825
|
{
|
|
826
826
|
"name": "auto-select",
|
|
@@ -1880,7 +1880,7 @@
|
|
|
1880
1880
|
},
|
|
1881
1881
|
{
|
|
1882
1882
|
"name": "vaadin-grid",
|
|
1883
|
-
"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/25.4.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/25.4.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`hasChildren` | Boolean | True if the item has children\n\nThe following helper elements can be used for further customization:\n- [`<vaadin-grid-column-group>`](https://cdn.vaadin.com/vaadin-web-components/25.4.0-alpha1/#/elements/vaadin-grid-column-group)\n- [`<vaadin-grid-filter>`](https://cdn.vaadin.com/vaadin-web-components/25.4.0-alpha1/#/elements/vaadin-grid-filter)\n- [`<vaadin-grid-sorter>`](https://cdn.vaadin.com/vaadin-web-components/25.4.0-alpha1/#/elements/vaadin-grid-sorter)\n- [`<vaadin-grid-selection-column>`](https://cdn.vaadin.com/vaadin-web-components/25.4.0-alpha1/#/elements/vaadin-grid-selection-column)\n- [`<vaadin-grid-tree-toggle>`](https://cdn.vaadin.com/vaadin-web-components/25.4.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.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`](https://cdn.vaadin.com/vaadin-web-components/25.4.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/25.4.0-alpha1/#/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.",
|
|
1883
|
+
"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/25.4.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/25.4.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`hasChildren` | Boolean | True if the item has children\n\nThe following helper elements can be used for further customization:\n- [`<vaadin-grid-column-group>`](https://cdn.vaadin.com/vaadin-web-components/25.4.0-alpha3/#/elements/vaadin-grid-column-group)\n- [`<vaadin-grid-filter>`](https://cdn.vaadin.com/vaadin-web-components/25.4.0-alpha3/#/elements/vaadin-grid-filter)\n- [`<vaadin-grid-sorter>`](https://cdn.vaadin.com/vaadin-web-components/25.4.0-alpha3/#/elements/vaadin-grid-sorter)\n- [`<vaadin-grid-selection-column>`](https://cdn.vaadin.com/vaadin-web-components/25.4.0-alpha3/#/elements/vaadin-grid-selection-column)\n- [`<vaadin-grid-tree-toggle>`](https://cdn.vaadin.com/vaadin-web-components/25.4.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.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`](https://cdn.vaadin.com/vaadin-web-components/25.4.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/25.4.0-alpha3/#/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.",
|
|
1884
1884
|
"attributes": [
|
|
1885
1885
|
{
|
|
1886
1886
|
"name": "accessible-name",
|
package/web-types.lit.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@vaadin/grid",
|
|
4
|
-
"version": "25.4.0-
|
|
4
|
+
"version": "25.4.0-alpha3",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"framework": "lit",
|
|
7
7
|
"framework-config": {
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
},
|
|
101
101
|
{
|
|
102
102
|
"name": "vaadin-grid-column",
|
|
103
|
-
"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/25.4.0-
|
|
103
|
+
"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/25.4.0-alpha3/#/elements/vaadin-grid) documentation for instructions on how\nto configure the `<vaadin-grid-column>`.",
|
|
104
104
|
"extension": true,
|
|
105
105
|
"attributes": [
|
|
106
106
|
{
|
|
@@ -366,7 +366,7 @@
|
|
|
366
366
|
},
|
|
367
367
|
{
|
|
368
368
|
"name": "vaadin-grid-selection-column",
|
|
369
|
-
"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>\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/25.4.0-
|
|
369
|
+
"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>\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/25.4.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__",
|
|
370
370
|
"extension": true,
|
|
371
371
|
"attributes": [
|
|
372
372
|
{
|
|
@@ -835,7 +835,7 @@
|
|
|
835
835
|
},
|
|
836
836
|
{
|
|
837
837
|
"name": "vaadin-grid",
|
|
838
|
-
"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/25.4.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/25.4.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`hasChildren` | Boolean | True if the item has children\n\nThe following helper elements can be used for further customization:\n- [`<vaadin-grid-column-group>`](https://cdn.vaadin.com/vaadin-web-components/25.4.0-alpha1/#/elements/vaadin-grid-column-group)\n- [`<vaadin-grid-filter>`](https://cdn.vaadin.com/vaadin-web-components/25.4.0-alpha1/#/elements/vaadin-grid-filter)\n- [`<vaadin-grid-sorter>`](https://cdn.vaadin.com/vaadin-web-components/25.4.0-alpha1/#/elements/vaadin-grid-sorter)\n- [`<vaadin-grid-selection-column>`](https://cdn.vaadin.com/vaadin-web-components/25.4.0-alpha1/#/elements/vaadin-grid-selection-column)\n- [`<vaadin-grid-tree-toggle>`](https://cdn.vaadin.com/vaadin-web-components/25.4.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.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`](https://cdn.vaadin.com/vaadin-web-components/25.4.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/25.4.0-alpha1/#/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.",
|
|
838
|
+
"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/25.4.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/25.4.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`hasChildren` | Boolean | True if the item has children\n\nThe following helper elements can be used for further customization:\n- [`<vaadin-grid-column-group>`](https://cdn.vaadin.com/vaadin-web-components/25.4.0-alpha3/#/elements/vaadin-grid-column-group)\n- [`<vaadin-grid-filter>`](https://cdn.vaadin.com/vaadin-web-components/25.4.0-alpha3/#/elements/vaadin-grid-filter)\n- [`<vaadin-grid-sorter>`](https://cdn.vaadin.com/vaadin-web-components/25.4.0-alpha3/#/elements/vaadin-grid-sorter)\n- [`<vaadin-grid-selection-column>`](https://cdn.vaadin.com/vaadin-web-components/25.4.0-alpha3/#/elements/vaadin-grid-selection-column)\n- [`<vaadin-grid-tree-toggle>`](https://cdn.vaadin.com/vaadin-web-components/25.4.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.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`](https://cdn.vaadin.com/vaadin-web-components/25.4.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/25.4.0-alpha3/#/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.",
|
|
839
839
|
"extension": true,
|
|
840
840
|
"attributes": [
|
|
841
841
|
{
|