@vaadin/vaadin-grid-pro
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -13,3 +13,3 @@ { | ||
"name": "@vaadin/vaadin-grid-pro", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"main": "vaadin-grid-pro.js", | ||
@@ -16,0 +16,0 @@ "author": "Vaadin Ltd", |
@@ -105,3 +105,3 @@ /** | ||
} else if (!this._grid.keepEditorOpen) { | ||
this._grid._stopEdit(); | ||
this._grid._stopEdit(false, true); | ||
} | ||
@@ -108,0 +108,0 @@ } |
@@ -48,2 +48,13 @@ /** | ||
this.__boundEditorFocusOut = this._onEditorFocusOut.bind(this); | ||
this._addEditColumnListener('mousedown', e => { | ||
// prevent grid from resetting navigating state | ||
e.stopImmediatePropagation(); | ||
this._toggleAttribute('navigating', true, this); | ||
}); | ||
this._addEditColumnListener('focusout', e => { | ||
// prevent grid from resetting navigating state | ||
e.stopImmediatePropagation(); | ||
}); | ||
} | ||
@@ -120,2 +131,25 @@ | ||
_addEditColumnListener(type, callback) { | ||
this.addEventListener(type, e => { | ||
const context = this.getEventContext(e); | ||
const column = context.column; | ||
const edited = this.__edited; | ||
if (context.item && this._isEditColumn(column)) { | ||
const path = e.composedPath(); | ||
const cell = path[path.indexOf(this.$.table) - 3]; | ||
if (!cell || cell.getAttribute('part').indexOf('details-cell') > -1) { | ||
return; | ||
} | ||
if (edited && edited.cell === cell) { | ||
return; | ||
} | ||
callback(e); | ||
} | ||
}); | ||
} | ||
_onItemPropertyChanged(e) { | ||
@@ -208,3 +242,3 @@ if (!e.defaultPrevented) { | ||
_stopEdit(shouldCancel) { | ||
_stopEdit(shouldCancel, shouldRestoreFocus) { | ||
if (!this.__edited) { | ||
@@ -240,2 +274,6 @@ return; | ||
this.removeEventListener('item-property-changed', this.__boundItemPropertyChanged); | ||
if (shouldRestoreFocus) { | ||
cell.focus(); | ||
} | ||
} | ||
@@ -242,0 +280,0 @@ |
@@ -35,3 +35,3 @@ /** | ||
static get version() { | ||
return '1.0.0'; | ||
return '1.0.1'; | ||
} | ||
@@ -38,0 +38,0 @@ } |
@@ -14,2 +14,13 @@ import '@vaadin/vaadin-lumo-styles/color.js'; | ||
<style include="lumo-grid"> | ||
/* keep the focus-ring on active */ | ||
:host([navigating]) [part~="cell"]:active::before { | ||
content: ""; | ||
position: absolute; | ||
top: 0; | ||
right: 0; | ||
bottom: 0; | ||
left: 0; | ||
pointer-events: none; | ||
box-shadow: inset 0 0 0 2px var(--lumo-primary-color-50pct); | ||
} | ||
</style> | ||
@@ -16,0 +27,0 @@ </template> |
import '@vaadin/vaadin-grid/theme/material/vaadin-grid-styles.js'; | ||
import './vaadin-grid-pro-styles.js'; | ||
import '../../src/vaadin-grid-pro.js'; |
57486
1025