@vaadin/vaadin-grid 5.9.3 → 5.9.4

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
@@ -15,7 +15,7 @@
15
15
  "repository": "vaadin/vaadin-grid",
16
16
  "homepage": "https://vaadin.com/components",
17
17
  "name": "@vaadin/vaadin-grid",
18
- "version": "5.9.3",
18
+ "version": "5.9.4",
19
19
  "main": "vaadin-grid.js",
20
20
  "author": "Vaadin Ltd",
21
21
  "license": "Apache-2.0",
@@ -0,0 +1,34 @@
1
+ /**
2
+ * DO NOT EDIT
3
+ *
4
+ * This file was automatically generated by
5
+ * https://github.com/Polymer/tools/tree/master/packages/gen-typescript-declarations
6
+ *
7
+ * To modify these typings, edit the source file(s):
8
+ * src/vaadin-grid-disabled-mixin.js
9
+ */
10
+
11
+
12
+ // tslint:disable:variable-name Describing an API that's defined elsewhere.
13
+ // tslint:disable:no-any describes the API as best we are able today
14
+
15
+ export {DisabledMixin};
16
+
17
+ declare function DisabledMixin<T extends new (...args: any[]) => {}>(base: T): T & DisabledMixinConstructor;
18
+
19
+ interface DisabledMixinConstructor {
20
+ new(...args: any[]): DisabledMixin;
21
+ }
22
+
23
+ export {DisabledMixinConstructor};
24
+
25
+ interface DisabledMixin {
26
+ disabled: boolean|null|undefined;
27
+ _disabledChanged(disabled: any): void;
28
+
29
+ /**
30
+ * Overrides the default element `click` method in order to prevent
31
+ * firing the `click` event when the element is disabled.
32
+ */
33
+ click(): void;
34
+ }
@@ -0,0 +1,43 @@
1
+ /**
2
+ @license
3
+ Copyright (c) 2017 Vaadin Ltd.
4
+ This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
+ */
6
+ /**
7
+ * @polymerMixin
8
+ */
9
+ export const DisabledMixin = superClass => class DisabledMixin extends superClass {
10
+ static get properties() {
11
+ return {
12
+ disabled: {
13
+ type: Boolean,
14
+ value: false,
15
+ observer: '_disabledChanged',
16
+ reflectToAttribute: true
17
+ }
18
+ };
19
+ }
20
+
21
+ /** @protected */
22
+ _disabledChanged(disabled) {
23
+ if (disabled) {
24
+ this.setAttribute('tabindex', '-1');
25
+ this.setAttribute('aria-disabled', 'true');
26
+ } else {
27
+ this.removeAttribute('tabindex');
28
+ this.removeAttribute('aria-disabled');
29
+ }
30
+ }
31
+
32
+ /**
33
+ * Overrides the default element `click` method in order to prevent
34
+ * firing the `click` event when the element is disabled.
35
+ * @protected
36
+ * @override
37
+ */
38
+ click() {
39
+ if (!this.disabled) {
40
+ super.click();
41
+ }
42
+ }
43
+ };
@@ -31,6 +31,11 @@ VaadinGridStyles.appendChild(
31
31
  display: none !important;
32
32
  }
33
33
 
34
+ :host([disabled]) {
35
+ pointer-events: none;
36
+ animation: none;
37
+ }
38
+
34
39
  #scroller {
35
40
  display: block;
36
41
  transform: translateY(0);
@@ -13,6 +13,8 @@
13
13
 
14
14
  import {ThemableMixin} from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
15
15
 
16
+ import {DisabledMixin} from './vaadin-grid-disabled-mixin.js';
17
+
16
18
  import {ScrollerElement} from './vaadin-grid-scroller.js';
17
19
 
18
20
  import {A11yMixin} from './vaadin-grid-a11y-mixin.js';
@@ -6,6 +6,7 @@ This program is available under Apache License Version 2.0, available at https:/
6
6
  import '@polymer/polymer/polymer-legacy.js';
7
7
 
8
8
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
9
+ import { DisabledMixin } from './vaadin-grid-disabled-mixin.js';
9
10
  import { ScrollerElement } from './vaadin-grid-scroller.js';
10
11
  import { A11yMixin } from './vaadin-grid-a11y-mixin.js';
11
12
  import { ActiveItemMixin } from './vaadin-grid-active-item-mixin.js';
@@ -294,7 +295,8 @@ class GridElement extends
294
295
  EventContextMixin(
295
296
  DragAndDropMixin(
296
297
  StylingMixin(
297
- ScrollerElement)))))))))))))))))) {
298
+ DisabledMixin(
299
+ ScrollerElement))))))))))))))))))) {
298
300
  static get template() {
299
301
  return html`
300
302
  <style include="vaadin-grid-styles"></style>
@@ -323,7 +325,7 @@ class GridElement extends
323
325
  }
324
326
 
325
327
  static get version() {
326
- return '5.9.3';
328
+ return '5.9.4';
327
329
  }
328
330
 
329
331
  static get observers() {
@@ -29,6 +29,10 @@ const $_documentContainer = html`<dom-module id="lumo-grid" theme-for="vaadin-gr
29
29
  --_lumo-grid-selected-row-color: var(--lumo-primary-color-10pct);
30
30
  }
31
31
 
32
+ :host([disabled]) {
33
+ opacity: 0.7;
34
+ }
35
+
32
36
  /* No (outer) border */
33
37
 
34
38
  :host(:not([theme~="no-border"])) {
@@ -13,6 +13,10 @@ const $_documentContainer = html`<dom-module id="material-grid" theme-for="vaadi
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;