@vaadin/grid 23.0.0-alpha1 → 23.0.0-alpha5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/package.json +10 -9
  2. package/src/all-imports.js +1 -1
  3. package/src/array-data-provider.js +2 -3
  4. package/src/vaadin-grid-a11y-mixin.js +1 -1
  5. package/src/vaadin-grid-active-item-mixin.d.ts +1 -1
  6. package/src/vaadin-grid-active-item-mixin.js +1 -1
  7. package/src/vaadin-grid-array-data-provider-mixin.d.ts +1 -1
  8. package/src/vaadin-grid-array-data-provider-mixin.js +1 -1
  9. package/src/vaadin-grid-column-group.d.ts +1 -1
  10. package/src/vaadin-grid-column-group.js +2 -2
  11. package/src/vaadin-grid-column-reordering-mixin.d.ts +1 -1
  12. package/src/vaadin-grid-column-reordering-mixin.js +5 -8
  13. package/src/vaadin-grid-column-resizing-mixin.js +3 -4
  14. package/src/vaadin-grid-column.d.ts +1 -1
  15. package/src/vaadin-grid-column.js +25 -14
  16. package/src/vaadin-grid-data-provider-mixin.d.ts +1 -1
  17. package/src/vaadin-grid-data-provider-mixin.js +4 -6
  18. package/src/vaadin-grid-drag-and-drop-mixin.d.ts +1 -1
  19. package/src/vaadin-grid-drag-and-drop-mixin.js +1 -1
  20. package/src/vaadin-grid-dynamic-columns-mixin.js +6 -9
  21. package/src/vaadin-grid-event-context-mixin.d.ts +1 -1
  22. package/src/vaadin-grid-event-context-mixin.js +1 -1
  23. package/src/vaadin-grid-filter-column.d.ts +1 -1
  24. package/src/vaadin-grid-filter-column.js +1 -1
  25. package/src/vaadin-grid-filter-mixin.js +1 -1
  26. package/src/vaadin-grid-filter.d.ts +1 -1
  27. package/src/vaadin-grid-filter.js +1 -1
  28. package/src/vaadin-grid-helpers.js +3 -3
  29. package/src/vaadin-grid-keyboard-navigation-mixin.js +77 -70
  30. package/src/vaadin-grid-row-details-mixin.d.ts +1 -1
  31. package/src/vaadin-grid-row-details-mixin.js +1 -2
  32. package/src/vaadin-grid-scroll-mixin.d.ts +1 -1
  33. package/src/vaadin-grid-scroll-mixin.js +6 -6
  34. package/src/vaadin-grid-selection-column.d.ts +1 -1
  35. package/src/vaadin-grid-selection-column.js +2 -2
  36. package/src/vaadin-grid-selection-mixin.d.ts +1 -1
  37. package/src/vaadin-grid-selection-mixin.js +1 -1
  38. package/src/vaadin-grid-sort-column.d.ts +1 -1
  39. package/src/vaadin-grid-sort-column.js +1 -1
  40. package/src/vaadin-grid-sort-mixin.d.ts +1 -1
  41. package/src/vaadin-grid-sort-mixin.js +8 -10
  42. package/src/vaadin-grid-sorter.d.ts +1 -1
  43. package/src/vaadin-grid-sorter.js +1 -1
  44. package/src/vaadin-grid-styles.js +1 -1
  45. package/src/vaadin-grid-styling-mixin.d.ts +1 -1
  46. package/src/vaadin-grid-styling-mixin.js +1 -1
  47. package/src/vaadin-grid-tree-column.d.ts +1 -1
  48. package/src/vaadin-grid-tree-column.js +1 -1
  49. package/src/vaadin-grid-tree-toggle.d.ts +1 -1
  50. package/src/vaadin-grid-tree-toggle.js +1 -1
  51. package/src/vaadin-grid.d.ts +19 -27
  52. package/src/vaadin-grid.js +34 -35
  53. package/theme/lumo/vaadin-grid-styles.js +4 -0
  54. package/theme/material/vaadin-grid-styles.js +4 -2
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
 
@@ -160,6 +160,8 @@ export const KeyboardNavigationMixin = (superClass) =>
160
160
  case ' ':
161
161
  keyGroup = 'Space';
162
162
  break;
163
+ default:
164
+ break;
163
165
  }
164
166
 
165
167
  this._detectInteracting(e);
@@ -240,28 +242,24 @@ export const KeyboardNavigationMixin = (superClass) =>
240
242
  if (this.__rowFocusMode) {
241
243
  // "If focus is on a row, moves focus to the first row. If focus is in the first row, focus does not move."
242
244
  dy = -Infinity;
245
+ } else if (e.ctrlKey) {
246
+ // "If focus is on a cell, moves focus to the first cell in the column. If focus is in the first row, focus does not move."
247
+ dy = -Infinity;
243
248
  } else {
244
- if (e.ctrlKey) {
245
- // "If focus is on a cell, moves focus to the first cell in the column. If focus is in the first row, focus does not move."
246
- dy = -Infinity;
247
- } else {
248
- // "If focus is on a cell, moves focus to the first cell in the row. If focus is in the first cell of the row, focus does not move."
249
- dx = -Infinity;
250
- }
249
+ // "If focus is on a cell, moves focus to the first cell in the row. If focus is in the first cell of the row, focus does not move."
250
+ dx = -Infinity;
251
251
  }
252
252
  break;
253
253
  case 'End':
254
254
  if (this.__rowFocusMode) {
255
255
  // "If focus is on a row, moves focus to the last row. If focus is in the last row, focus does not move."
256
256
  dy = Infinity;
257
+ } else if (e.ctrlKey) {
258
+ // "If focus is on a cell, moves focus to the last cell in the column. If focus is in the last row, focus does not move."
259
+ dy = Infinity;
257
260
  } else {
258
- if (e.ctrlKey) {
259
- // "If focus is on a cell, moves focus to the last cell in the column. If focus is in the last row, focus does not move."
260
- dy = Infinity;
261
- } else {
262
- // "If focus is on a cell, moves focus to the last cell in the row. If focus is in the last cell of the row, focus does not move."
263
- dx = Infinity;
264
- }
261
+ // "If focus is on a cell, moves focus to the last cell in the row. If focus is in the last cell of the row, focus does not move."
262
+ dx = Infinity;
265
263
  }
266
264
  break;
267
265
  case 'ArrowDown':
@@ -276,6 +274,8 @@ export const KeyboardNavigationMixin = (superClass) =>
276
274
  case 'PageUp':
277
275
  dy = -visibleItemsCount;
278
276
  break;
277
+ default:
278
+ break;
279
279
  }
280
280
 
281
281
  const activeRow = e.composedPath().find((el) => this.__isRow(el));
@@ -296,13 +296,12 @@ export const KeyboardNavigationMixin = (superClass) =>
296
296
  // "If focus is on a collapsed row, expands the row."
297
297
  this.expandItem(activeRow._item);
298
298
  return;
299
- } else {
300
- // "If focus is on an expanded row or is on a row that does not have child rows,
301
- // moves focus to the first cell in the row."
302
- this.__rowFocusMode = false;
303
- this._onCellNavigation(activeRow.firstElementChild, 0, 0);
304
- return;
305
299
  }
300
+ // "If focus is on an expanded row or is on a row that does not have child rows,
301
+ // moves focus to the first cell in the row."
302
+ this.__rowFocusMode = false;
303
+ this._onCellNavigation(activeRow.firstElementChild, 0, 0);
304
+ return;
306
305
  }
307
306
  } else if (key === backwardsKey) {
308
307
  // "Left Arrow:"
@@ -354,14 +353,13 @@ export const KeyboardNavigationMixin = (superClass) =>
354
353
  // Body rows have index property, otherwise DOM child index of the row is used.
355
354
  if (rowGroup === this.$.items) {
356
355
  return bodyFallbackIndex !== undefined ? bodyFallbackIndex : row.index;
357
- } else {
358
- return this.__getIndexOfChildElement(row);
359
356
  }
357
+ return this.__getIndexOfChildElement(row);
360
358
  }
361
359
 
362
360
  /**
363
361
  * Returns the target row after navigating by the given dy offset.
364
- * Also returns infromation whether the details cell should be the target on the target row.
362
+ * Also returns information whether the details cell should be the target on the target row.
365
363
  * If the row is not in the viewport, it is first scrolled to.
366
364
  * @private
367
365
  **/
@@ -381,62 +379,58 @@ export const KeyboardNavigationMixin = (superClass) =>
381
379
  // in vertical keyboard navigation.
382
380
  if (dstRowIndex > currentRowIndex) {
383
381
  while (dstRowIndex < maxRowIndex && activeRowGroup.children[dstRowIndex].hidden) {
384
- dstRowIndex++;
382
+ dstRowIndex += 1;
385
383
  }
386
384
  } else if (dstRowIndex < currentRowIndex) {
387
385
  while (dstRowIndex > 0 && activeRowGroup.children[dstRowIndex].hidden) {
388
- dstRowIndex--;
386
+ dstRowIndex -= 1;
389
387
  }
390
388
  }
391
389
 
392
390
  this.toggleAttribute('navigating', true);
393
391
 
394
392
  return { dstRow: activeRowGroup.children[dstRowIndex] };
395
- } else {
396
- // Navigating body rows
397
-
398
- let dstIsRowDetails = false;
399
- if (activeCell) {
400
- const isRowDetails = this.__isDetailsCell(activeCell);
401
- // Row details navigation logic
402
- if (activeRowGroup === this.$.items) {
403
- const item = activeRow._item;
404
- const dstItem = this._cache.getItemForIndex(dstRowIndex);
405
- // Should we navigate to row details?
406
- if (isRowDetails) {
407
- dstIsRowDetails = dy === 0;
408
- } else {
409
- dstIsRowDetails =
410
- (dy === 1 && this._isDetailsOpened(item)) ||
411
- (dy === -1 && dstRowIndex !== currentRowIndex && this._isDetailsOpened(dstItem));
412
- }
413
- // Should we navigate between details and regular cells of the same row?
414
- if (
415
- dstIsRowDetails !== isRowDetails &&
416
- ((dy === 1 && dstIsRowDetails) || (dy === -1 && !dstIsRowDetails))
417
- ) {
418
- dstRowIndex = currentRowIndex;
419
- }
393
+ }
394
+ // Navigating body rows
395
+
396
+ let dstIsRowDetails = false;
397
+ if (activeCell) {
398
+ const isRowDetails = this.__isDetailsCell(activeCell);
399
+ // Row details navigation logic
400
+ if (activeRowGroup === this.$.items) {
401
+ const item = activeRow._item;
402
+ const dstItem = this._cache.getItemForIndex(dstRowIndex);
403
+ // Should we navigate to row details?
404
+ if (isRowDetails) {
405
+ dstIsRowDetails = dy === 0;
406
+ } else {
407
+ dstIsRowDetails =
408
+ (dy === 1 && this._isDetailsOpened(item)) ||
409
+ (dy === -1 && dstRowIndex !== currentRowIndex && this._isDetailsOpened(dstItem));
410
+ }
411
+ // Should we navigate between details and regular cells of the same row?
412
+ if (dstIsRowDetails !== isRowDetails && ((dy === 1 && dstIsRowDetails) || (dy === -1 && !dstIsRowDetails))) {
413
+ dstRowIndex = currentRowIndex;
420
414
  }
421
415
  }
416
+ }
422
417
 
423
- // Ensure correct vertical scroll position, destination row is visible
424
- this._ensureScrolledToIndex(dstRowIndex);
418
+ // Ensure correct vertical scroll position, destination row is visible
419
+ this._ensureScrolledToIndex(dstRowIndex);
425
420
 
426
- // When scrolling with repeated keydown, sometimes FocusEvent listeners
427
- // are too late to update _focusedItemIndex. Ensure next keydown
428
- // listener invocation gets updated _focusedItemIndex value.
429
- this._focusedItemIndex = dstRowIndex;
421
+ // When scrolling with repeated keydown, sometimes FocusEvent listeners
422
+ // are too late to update _focusedItemIndex. Ensure next keydown
423
+ // listener invocation gets updated _focusedItemIndex value.
424
+ this._focusedItemIndex = dstRowIndex;
430
425
 
431
- // This has to be set after scrolling, otherwise it can be removed by
432
- // `_preventScrollerRotatingCellFocus(row, index)` during scrolling.
433
- this.toggleAttribute('navigating', true);
426
+ // This has to be set after scrolling, otherwise it can be removed by
427
+ // `_preventScrollerRotatingCellFocus(row, index)` during scrolling.
428
+ this.toggleAttribute('navigating', true);
434
429
 
435
- return {
436
- dstRow: [...activeRowGroup.children].find((el) => !el.hidden && el.index === dstRowIndex),
437
- dstIsRowDetails
438
- };
439
- }
430
+ return {
431
+ dstRow: [...activeRowGroup.children].find((el) => !el.hidden && el.index === dstRowIndex),
432
+ dstIsRowDetails
433
+ };
440
434
  }
441
435
 
442
436
  /**
@@ -499,7 +493,10 @@ export const KeyboardNavigationMixin = (superClass) =>
499
493
  this._focusedColumnOrder = undefined;
500
494
  }
501
495
 
502
- const columnIndexByOrder = dstColumns.reduce((acc, col, i) => ((acc[col._order] = i), acc), {});
496
+ const columnIndexByOrder = dstColumns.reduce((acc, col, i) => {
497
+ acc[col._order] = i;
498
+ return acc;
499
+ }, {});
503
500
  const dstColumnIndex = columnIndexByOrder[dstSortedColumnOrders[dstOrderedColumnIndex]];
504
501
  const dstCell = dstRow.children[dstColumnIndex];
505
502
 
@@ -526,6 +523,8 @@ export const KeyboardNavigationMixin = (superClass) =>
526
523
  case 'F2':
527
524
  wantInteracting = !this.interacting;
528
525
  break;
526
+ default:
527
+ break;
529
528
  }
530
529
 
531
530
  const { cell } = this._getGridEventLocation(e);
@@ -730,7 +729,9 @@ export const KeyboardNavigationMixin = (superClass) =>
730
729
  * @param {HTMLElement} focusTarget
731
730
  */
732
731
  _updateGridSectionFocusTarget(focusTarget) {
733
- if (!focusTarget) return;
732
+ if (!focusTarget) {
733
+ return;
734
+ }
734
735
 
735
736
  const section = this._getGridSectionFromFocusTarget(focusTarget);
736
737
  const isInteractingWithinActiveSection = this.interacting && section === this._activeRowGroup;
@@ -888,9 +889,15 @@ export const KeyboardNavigationMixin = (superClass) =>
888
889
  * @private
889
890
  */
890
891
  _getGridSectionFromFocusTarget(focusTarget) {
891
- if (focusTarget === this._headerFocusable) return this.$.header;
892
- if (focusTarget === this._itemsFocusable) return this.$.items;
893
- if (focusTarget === this._footerFocusable) return this.$.footer;
892
+ if (focusTarget === this._headerFocusable) {
893
+ return this.$.header;
894
+ }
895
+ if (focusTarget === this._itemsFocusable) {
896
+ return this.$.items;
897
+ }
898
+ if (focusTarget === this._footerFocusable) {
899
+ return this.$.footer;
900
+ }
894
901
  return null;
895
902
  }
896
903
 
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { Constructor } from '@open-wc/dedupe-mixin';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
 
@@ -106,7 +106,6 @@ export const RowDetailsMixin = (superClass) =>
106
106
  // Re-renders the row to open the details when a row details renderer is provided.
107
107
  if (rowDetailsRenderer && this._isDetailsOpened(row._item)) {
108
108
  this._updateItem(row, row._item);
109
- return;
110
109
  }
111
110
  });
112
111
  }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { Constructor } from '@open-wc/dedupe-mixin';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { animationFrame, microTask, timeOut } from '@vaadin/component-base/src/async.js';
@@ -31,6 +31,11 @@ export const ScrollMixin = (superClass) =>
31
31
  };
32
32
  }
33
33
 
34
+ /** @private */
35
+ get _scrollTop() {
36
+ return this.$.table.scrollTop;
37
+ }
38
+
34
39
  /**
35
40
  * Override (from iron-scroll-target-behavior) to avoid document scroll
36
41
  * @private
@@ -39,11 +44,6 @@ export const ScrollMixin = (superClass) =>
39
44
  this.$.table.scrollTop = top;
40
45
  }
41
46
 
42
- /** @private */
43
- get _scrollTop() {
44
- return this.$.table.scrollTop;
45
- }
46
-
47
47
  /** @private */
48
48
  get _scrollLeft() {
49
49
  return this.$.table.scrollLeft;
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { GridDefaultItem } from './vaadin-grid.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import '@vaadin/checkbox/src/vaadin-checkbox.js';
@@ -235,7 +235,7 @@ class GridSelectionColumn extends GridColumn {
235
235
  }
236
236
 
237
237
  /**
238
- * iOS needs indeterminated + checked at the same time
238
+ * iOS needs indeterminate + checked at the same time
239
239
  * @private
240
240
  */
241
241
  __isChecked(selectAll, indeterminate) {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { Constructor } from '@open-wc/dedupe-mixin';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
 
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { GridDefaultItem } from './vaadin-grid.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import './vaadin-grid-sorter.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { Constructor } from '@open-wc/dedupe-mixin';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
 
@@ -88,15 +88,13 @@ export const SortMixin = (superClass) =>
88
88
  this._sorters.unshift(sorter);
89
89
  }
90
90
  this.__updateSortOrders();
91
- } else {
92
- if (sorter.direction) {
93
- const otherSorters = this._sorters.filter((s) => s != sorter);
94
- this._sorters = [sorter];
95
- otherSorters.forEach((sorter) => {
96
- sorter._order = null;
97
- sorter.direction = null;
98
- });
99
- }
91
+ } else if (sorter.direction) {
92
+ const otherSorters = this._sorters.filter((s) => s != sorter);
93
+ this._sorters = [sorter];
94
+ otherSorters.forEach((sorter) => {
95
+ sorter._order = null;
96
+ sorter.direction = null;
97
+ });
100
98
  }
101
99
  }
102
100
 
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { Constructor } from '@open-wc/dedupe-mixin';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
 
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { GridDefaultItem } from './vaadin-grid.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import './vaadin-grid-tree-toggle.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { ElementMixinClass } from '@vaadin/component-base/src/element-mixin.js';
@@ -253,20 +253,16 @@ export interface GridEventMap<TItem> extends HTMLElementEventMap, GridCustomEven
253
253
  * in the second argument of the data provider callback:__
254
254
  *
255
255
  * ```javascript
256
- * grid.dataProvider = function(params, callback) {
257
- * const url = 'https://api.example/data' +
258
- * '?page=' + params.page + // the requested page index
259
- * '&per_page=' + params.pageSize; // number of items on the page
260
- * const xhr = new XMLHttpRequest();
261
- * xhr.onload = function() {
262
- * const response = JSON.parse(xhr.responseText);
263
- * callback(
264
- * response.employees, // requested page of items
265
- * response.totalSize // total number of items
266
- * );
267
- * };
268
- * xhr.open('GET', url, true);
269
- * xhr.send();
256
+ * grid.dataProvider = ({page, pageSize}, callback) => {
257
+ * // page: the requested page index
258
+ * // pageSize: number of items on one page
259
+ * const url = `https://api.example/data?page=${page}&per_page=${pageSize}`;
260
+ *
261
+ * fetch(url)
262
+ * .then((res) => res.json())
263
+ * .then(({ employees, totalSize }) => {
264
+ * callback(employees, totalSize);
265
+ * });
270
266
  * };
271
267
  * ```
272
268
  *
@@ -274,17 +270,12 @@ export interface GridEventMap<TItem> extends HTMLElementEventMap, GridCustomEven
274
270
  *
275
271
  * ```javascript
276
272
  * grid.size = 200; // The total number of items
277
- * grid.dataProvider = function(params, callback) {
278
- * const url = 'https://api.example/data' +
279
- * '?page=' + params.page + // the requested page index
280
- * '&per_page=' + params.pageSize; // number of items on the page
281
- * const xhr = new XMLHttpRequest();
282
- * xhr.onload = function() {
283
- * const response = JSON.parse(xhr.responseText);
284
- * callback(response.employees);
285
- * };
286
- * xhr.open('GET', url, true);
287
- * xhr.send();
273
+ * grid.dataProvider = ({page, pageSize}, callback) => {
274
+ * const url = `https://api.example/data?page=${page}&per_page=${pageSize}`;
275
+ *
276
+ * fetch(url)
277
+ * .then((res) => res.json())
278
+ * .then((resJson) => callback(resJson.employees));
288
279
  * };
289
280
  * ```
290
281
  *
@@ -317,7 +308,7 @@ export interface GridEventMap<TItem> extends HTMLElementEventMap, GridCustomEven
317
308
  * `reorder-status` | Reflects the status of a cell while columns are being reordered | cell
318
309
  * `frozen` | Frozen cell | cell
319
310
  * `last-frozen` | Last frozen cell | cell
320
- * * `first-column` | First visible cell on a row | cell
311
+ * `first-column` | First visible cell on a row | cell
321
312
  * `last-column` | Last visible cell on a row | cell
322
313
  * `selected` | Selected row | row
323
314
  * `expanded` | Expanded row | row
@@ -325,6 +316,7 @@ export interface GridEventMap<TItem> extends HTMLElementEventMap, GridCustomEven
325
316
  * `loading` | Row that is waiting for data from data provider | row
326
317
  * `odd` | Odd row | row
327
318
  * `first` | The first body row | row
319
+ * `last` | The last body row | row
328
320
  * `dragstart` | Set for one frame when drag of a row is starting. The value is a number when multiple rows are dragged | row
329
321
  * `dragover` | Set when the row is dragged over | row
330
322
  * `drag-disabled` | Set to a row that isn't available for dragging | row