@vaadin/grid 23.0.0-beta2 → 23.0.0-beta3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/grid",
3
- "version": "23.0.0-beta2",
3
+ "version": "23.0.0-beta3",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -41,19 +41,19 @@
41
41
  "dependencies": {
42
42
  "@open-wc/dedupe-mixin": "^1.3.0",
43
43
  "@polymer/polymer": "^3.0.0",
44
- "@vaadin/checkbox": "23.0.0-beta2",
45
- "@vaadin/component-base": "23.0.0-beta2",
46
- "@vaadin/text-field": "23.0.0-beta2",
47
- "@vaadin/vaadin-lumo-styles": "23.0.0-beta2",
48
- "@vaadin/vaadin-material-styles": "23.0.0-beta2",
49
- "@vaadin/vaadin-themable-mixin": "23.0.0-beta2"
44
+ "@vaadin/checkbox": "23.0.0-beta3",
45
+ "@vaadin/component-base": "23.0.0-beta3",
46
+ "@vaadin/text-field": "23.0.0-beta3",
47
+ "@vaadin/vaadin-lumo-styles": "23.0.0-beta3",
48
+ "@vaadin/vaadin-material-styles": "23.0.0-beta3",
49
+ "@vaadin/vaadin-themable-mixin": "23.0.0-beta3"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@esm-bundle/chai": "^4.3.4",
53
- "@vaadin/polymer-legacy-adapter": "23.0.0-beta2",
53
+ "@vaadin/polymer-legacy-adapter": "23.0.0-beta3",
54
54
  "@vaadin/testing-helpers": "^0.3.2",
55
55
  "lit": "^2.0.0",
56
56
  "sinon": "^9.2.0"
57
57
  },
58
- "gitHead": "a276f7a0fd00e5459b87267468e0dd0d4fb6f7f3"
58
+ "gitHead": "4c87216666541f9eb58f56c475964727822aad53"
59
59
  }
@@ -94,24 +94,12 @@ export const A11yMixin = (superClass) =>
94
94
  * @protected
95
95
  */
96
96
  _a11yUpdateRowLevel(row, level) {
97
- row.setAttribute('aria-level', level + 1);
98
- }
99
-
100
- /**
101
- * @param {!HTMLElement} row
102
- * @param {boolean} detailsOpened
103
- * @protected
104
- */
105
- _a11yUpdateRowDetailsOpened(row, detailsOpened) {
106
- const detailsCell = row.querySelector('[part~=details-cell]');
107
-
108
- Array.from(row.children).forEach((cell) => {
109
- if (detailsCell) {
110
- cell.setAttribute('aria-expanded', detailsOpened);
111
- } else {
112
- cell.removeAttribute('aria-expanded');
113
- }
114
- });
97
+ // Set level for the expandable rows itself, and all the nested rows.
98
+ if (level > 0 || this.__isRowCollapsible(row) || this.__isRowExpandable(row)) {
99
+ row.setAttribute('aria-level', level + 1);
100
+ } else {
101
+ row.removeAttribute('aria-level');
102
+ }
115
103
  }
116
104
 
117
105
  /**
@@ -84,7 +84,6 @@ export const RowDetailsMixin = (superClass) =>
84
84
  if (!row.querySelector('[part~=details-cell]')) {
85
85
  this._updateRow(row, this._columnTree[this._columnTree.length - 1]);
86
86
  const isDetailsOpened = this._isDetailsOpened(row._item);
87
- this._a11yUpdateRowDetailsOpened(row, isDetailsOpened);
88
87
  this._toggleDetailsCell(row, isDetailsOpened);
89
88
  }
90
89
  });
@@ -27,6 +27,10 @@ registerStyles(
27
27
  display: none !important;
28
28
  }
29
29
 
30
+ :host([disabled]) {
31
+ pointer-events: none;
32
+ }
33
+
30
34
  #scroller {
31
35
  display: block;
32
36
  transform: translateY(0);
@@ -3,6 +3,7 @@
3
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
+ import { DisabledMixinClass } from '@vaadin/component-base/src/disabled-mixin.js';
6
7
  import { ElementMixinClass } from '@vaadin/component-base/src/element-mixin.js';
7
8
  import { ThemableMixinClass } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
8
9
  import { ActiveItemMixinClass } from './vaadin-grid-active-item-mixin.js';
@@ -389,7 +390,8 @@ declare class Grid<TItem = GridDefaultItem> extends HTMLElement {
389
390
  }
390
391
 
391
392
  interface Grid<TItem = GridDefaultItem>
392
- extends ElementMixinClass,
393
+ extends DisabledMixinClass,
394
+ ElementMixinClass,
393
395
  ThemableMixinClass,
394
396
  ActiveItemMixinClass<TItem>,
395
397
  ArrayDataProviderMixinClass<TItem>,
@@ -9,6 +9,7 @@ import { beforeNextRender } from '@polymer/polymer/lib/utils/render-status.js';
9
9
  import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
10
10
  import { isAndroid, isFirefox, isIOS, isSafari, isTouch } from '@vaadin/component-base/src/browser-utils.js';
11
11
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
12
+ import { TabindexMixin } from '@vaadin/component-base/src/tabindex-mixin.js';
12
13
  import { processTemplates } from '@vaadin/component-base/src/templates.js';
13
14
  import { Virtualizer } from '@vaadin/component-base/src/virtualizer.js';
14
15
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
@@ -256,7 +257,9 @@ class Grid extends ElementMixin(
256
257
  A11yMixin(
257
258
  FilterMixin(
258
259
  ColumnReorderingMixin(
259
- ColumnResizingMixin(EventContextMixin(DragAndDropMixin(StylingMixin(PolymerElement))))
260
+ ColumnResizingMixin(
261
+ EventContextMixin(DragAndDropMixin(StylingMixin(TabindexMixin(PolymerElement))))
262
+ )
260
263
  )
261
264
  )
262
265
  )
@@ -337,6 +340,11 @@ class Grid extends ElementMixin(
337
340
  value: isTouch
338
341
  },
339
342
 
343
+ /** @protected */
344
+ tabindex: {
345
+ value: undefined
346
+ },
347
+
340
348
  /**
341
349
  * If true, the grid's height is defined by its rows.
342
350
  *
@@ -465,6 +473,23 @@ class Grid extends ElementMixin(
465
473
  }
466
474
  }
467
475
 
476
+ /**
477
+ * Override an observer from `DisabledMixin` to not
478
+ * set `tabindex` on the grid when it is re-enabled.
479
+ *
480
+ * @param {boolean} disabled
481
+ * @param {boolean} oldDisabled
482
+ * @protected
483
+ * @override
484
+ */
485
+ _disabledChanged(disabled, oldDisabled) {
486
+ super._disabledChanged(disabled, oldDisabled);
487
+
488
+ if (oldDisabled) {
489
+ this.removeAttribute('tabindex');
490
+ }
491
+ }
492
+
468
493
  /** @private */
469
494
  __getBodyCellCoordinates(cell) {
470
495
  if (this.$.items.contains(cell) && cell.localName === 'td') {
@@ -910,7 +935,6 @@ class Grid extends ElementMixin(
910
935
 
911
936
  this._a11yUpdateRowLevel(row, model.level);
912
937
  this._a11yUpdateRowSelected(row, model.selected);
913
- this._a11yUpdateRowDetailsOpened(row, model.detailsOpened);
914
938
 
915
939
  row.toggleAttribute('expanded', model.expanded);
916
940
  row.toggleAttribute('selected', model.selected);
@@ -35,6 +35,10 @@ registerStyles(
35
35
  border: var(--_lumo-grid-border-width) solid var(--_lumo-grid-border-color);
36
36
  }
37
37
 
38
+ :host([disabled]) {
39
+ opacity: 0.7;
40
+ }
41
+
38
42
  /* Cell styles */
39
43
 
40
44
  [part~='cell'] {
@@ -13,6 +13,10 @@ registerStyles(
13
13
  color: var(--material-body-text-color);
14
14
  }
15
15
 
16
+ :host([disabled]) {
17
+ opacity: 0.7;
18
+ }
19
+
16
20
  [part~='cell'] {
17
21
  min-height: 48px;
18
22
  -webkit-tap-highlight-color: transparent;