@vaadin/grid-pro
Advanced tools
Comparing version
{ | ||
"name": "@vaadin/grid-pro", | ||
"version": "22.0.0-beta1", | ||
"version": "22.0.0-beta2", | ||
"publishConfig": { | ||
@@ -35,20 +35,21 @@ "access": "public" | ||
"dependencies": { | ||
"@open-wc/dedupe-mixin": "^1.3.0", | ||
"@polymer/polymer": "^3.0.0", | ||
"@vaadin/checkbox": "22.0.0-beta1", | ||
"@vaadin/component-base": "22.0.0-beta1", | ||
"@vaadin/grid": "22.0.0-beta1", | ||
"@vaadin/item": "22.0.0-beta1", | ||
"@vaadin/list-box": "22.0.0-beta1", | ||
"@vaadin/select": "22.0.0-beta1", | ||
"@vaadin/text-field": "22.0.0-beta1", | ||
"@vaadin/checkbox": "22.0.0-beta2", | ||
"@vaadin/component-base": "22.0.0-beta2", | ||
"@vaadin/grid": "22.0.0-beta2", | ||
"@vaadin/item": "22.0.0-beta2", | ||
"@vaadin/list-box": "22.0.0-beta2", | ||
"@vaadin/select": "22.0.0-beta2", | ||
"@vaadin/text-field": "22.0.0-beta2", | ||
"@vaadin/vaadin-license-checker": "^2.1.0", | ||
"@vaadin/vaadin-lumo-styles": "22.0.0-beta1", | ||
"@vaadin/vaadin-material-styles": "22.0.0-beta1", | ||
"@vaadin/vaadin-themable-mixin": "22.0.0-beta1" | ||
"@vaadin/vaadin-lumo-styles": "22.0.0-beta2", | ||
"@vaadin/vaadin-material-styles": "22.0.0-beta2", | ||
"@vaadin/vaadin-themable-mixin": "22.0.0-beta2" | ||
}, | ||
"devDependencies": { | ||
"@esm-bundle/chai": "^4.3.4", | ||
"@vaadin/date-picker": "22.0.0-beta1", | ||
"@vaadin/dialog": "22.0.0-beta1", | ||
"@vaadin/polymer-legacy-adapter": "22.0.0-beta1", | ||
"@vaadin/date-picker": "22.0.0-beta2", | ||
"@vaadin/dialog": "22.0.0-beta2", | ||
"@vaadin/polymer-legacy-adapter": "22.0.0-beta2", | ||
"@vaadin/testing-helpers": "^0.3.0", | ||
@@ -58,3 +59,3 @@ "lit": "^2.0.0", | ||
}, | ||
"gitHead": "4cf8a9d0504994200c610e44b3676114fef49c1e" | ||
"gitHead": "f13833683e6667f6ca6678452db14aa6b7eac4a4" | ||
} |
@@ -1,11 +0,10 @@ | ||
# <vaadin-grid-pro> | ||
# @vaadin/grid-pro | ||
[Live Demo ↗](https://vaadin.com/components/vaadin-grid-pro/html-examples) | ||
| | ||
[API documentation ↗](https://vaadin.com/components/vaadin-grid-pro/html-api) | ||
An extension of the `vaadin-grid` component that provides inline editing with full keyboard navigation. | ||
[<vaadin-grid-pro>](https://vaadin.com/components/vaadin-grid-pro) is a high quality data grid / data table Web Component with extended functionality, part of the [Vaadin components](https://vaadin.com/components). | ||
> ℹ️ A commercial Vaadin [subscription](https://vaadin.com/pricing) is required to use Grid Pro in your project. | ||
[Documentation + Live Demo ↗](https://vaadin.com/docs/latest/ds/components/grid-pro) | ||
[](https://www.npmjs.com/package/@vaadin/grid-pro) | ||
[](https://vaadin.com/directory/component/vaadinvaadin-grid-pro) | ||
[](https://discord.gg/PHmkCKC) | ||
@@ -28,38 +27,45 @@ | ||
[<img src="https://raw.githubusercontent.com/vaadin/vaadin-grid-pro/master/screenshot.png" width="900" alt="Screenshot of vaadin-grid-pro">](https://vaadin.com/components/vaadin-grid-pro) | ||
[<img src="https://raw.githubusercontent.com/vaadin/web-components/master/packages/grid-pro/screenshot.png" width="900" alt="Screenshot of vaadin-grid-pro">](https://vaadin.com/docs/latest/ds/components/grid-pro) | ||
## Installation | ||
Install `vaadin-grid-pro`: | ||
Install the component: | ||
```sh | ||
npm i @vaadin/vaadin-pro --save | ||
npm i @vaadin/grid-pro | ||
``` | ||
Once installed, import it in your application: | ||
Once installed, import the component in your application: | ||
```js | ||
import '@vaadin/grid-pro/vaadin-grid-pro.js'; | ||
import '@vaadin/grid-pro'; | ||
import '@vaadin/grid-pro/vaadin-grid-pro-edit-column.js'; | ||
``` | ||
## Getting started | ||
## Themes | ||
Vaadin components use the Lumo theme by default. | ||
Vaadin components come with two built-in [themes](https://vaadin.com/docs/latest/ds/customization/using-themes), Lumo and Material. | ||
The [main entrypoint](https://github.com/vaadin/web-components/blob/master/packages/grid-pro/vaadin-grid-pro.js) of the package uses the Lumo theme. | ||
To use the Material theme, import the correspondent file from the `theme/material` folder. | ||
To use the Material theme, import the components from the `theme/material` folder: | ||
## Entry points | ||
```js | ||
import '@vaadin/grid-pro/theme/material/vaadin-grid-pro.js'; | ||
import '@vaadin/grid-pro/theme/material/vaadin-grid-pro-edit-column.js'; | ||
``` | ||
- The component with the Lumo theme: | ||
You can also import the Lumo version of the components explicitly: | ||
`theme/lumo/vaadin-grid-pro.js` | ||
```js | ||
import '@vaadin/grid-pro/theme/lumo/vaadin-grid-pro.js'; | ||
import '@vaadin/grid-pro/theme/lumo/vaadin-grid-pro-edit-column.js'; | ||
``` | ||
- The component with the Material theme: | ||
Finally, you can import the un-themed components from the `src` folder to get a minimal starting point: | ||
`theme/material/vaadin-grid-pro.js` | ||
```js | ||
import '@vaadin/grid-pro/src/vaadin-grid-pro.js'; | ||
import '@vaadin/grid-pro/src/vaadin-grid-pro-edit-column.js'; | ||
``` | ||
- Alias for `theme/lumo/vaadin-grid-pro.js`: | ||
`vaadin-grid-pro.js` | ||
## Contributing | ||
@@ -73,2 +79,3 @@ | ||
Vaadin collects development time usage statistics to improve this product. For details and to opt-out, see https://github.com/vaadin/vaadin-usage-statistics. | ||
Vaadin collects usage statistics at development time to improve this product. | ||
For grid-pro and to opt-out, see https://github.com/vaadin/vaadin-usage-statistics. |
@@ -7,4 +7,4 @@ /** | ||
*/ | ||
import { GridBodyRenderer, GridDefaultItem, GridItemModel } from '@vaadin/grid/src/vaadin-grid.js'; | ||
import { GridColumn } from '@vaadin/grid/src/vaadin-grid-column.js'; | ||
import { GridDefaultItem, GridBodyRenderer, GridItemModel } from '@vaadin/grid/src/vaadin-grid.js'; | ||
@@ -74,11 +74,9 @@ export type GridProEditorType = 'text' | 'checkbox' | 'select' | 'custom'; | ||
_getEditorTagName(cell: HTMLElement): string; | ||
protected _getEditorComponent(cell: HTMLElement): HTMLElement | null; | ||
_getEditorComponent(cell: HTMLElement): HTMLElement | null; | ||
protected _getEditorValue(editor: HTMLElement): unknown | null; | ||
_getEditorValue(editor: HTMLElement): unknown | null; | ||
protected _startCellEdit(cell: HTMLElement, model: GridItemModel<TItem>): void; | ||
_startCellEdit(cell: HTMLElement, model: GridItemModel<TItem>): void; | ||
_stopCellEdit(cell: HTMLElement, model: GridItemModel<TItem>): void; | ||
protected _stopCellEdit(cell: HTMLElement, model: GridItemModel<TItem>): void; | ||
} | ||
@@ -85,0 +83,0 @@ |
@@ -7,7 +7,7 @@ /** | ||
*/ | ||
import { get, set } from '@polymer/polymer/lib/utils/path.js'; | ||
import { GridColumn } from '@vaadin/grid/src/vaadin-grid-column.js'; | ||
import './vaadin-grid-pro-edit-checkbox.js'; | ||
import './vaadin-grid-pro-edit-select.js'; | ||
import './vaadin-grid-pro-edit-text-field.js'; | ||
import { get, set } from '@polymer/polymer/lib/utils/path.js'; | ||
import { GridColumn } from '@vaadin/grid/src/vaadin-grid-column.js'; | ||
@@ -14,0 +14,0 @@ /** |
@@ -7,5 +7,5 @@ /** | ||
*/ | ||
import { Select } from '@vaadin/select/src/vaadin-select.js'; | ||
import '@vaadin/item/src/vaadin-item.js'; | ||
import '@vaadin/list-box/src/vaadin-list-box.js'; | ||
import { Select } from '@vaadin/select/src/vaadin-select.js'; | ||
@@ -48,5 +48,2 @@ /** | ||
this.setAttribute('theme', 'grid-pro-editor'); | ||
this.__boundOnKeyDown = this.__onOverlayKeyDown.bind(this); | ||
this._overlayElement.addEventListener('keydown', this.__boundOnKeyDown); | ||
} | ||
@@ -66,6 +63,21 @@ | ||
__onOverlayKeyDown(e) { | ||
if (e.keyCode === 9) { | ||
!this._grid.singleCellEdit && this._grid._switchEditCell(e); | ||
/** | ||
* Override list-box event listener inherited from `Select`: | ||
* - Enter: set flag for moving to next row on value change, | ||
* - Tab: switch to next cell when "singleCellEdit" is false. | ||
* @param {!KeyboardEvent} event | ||
* @protected | ||
* @override | ||
*/ | ||
_onKeyDownInside(event) { | ||
if (event.keyCode === 13) { | ||
this._enterKeydown = event; | ||
} | ||
if (event.keyCode === 9) { | ||
!this._grid.singleCellEdit && this._grid._switchEditCell(event); | ||
} | ||
// Call `super` to close overlay on Tab. | ||
super._onKeyDownInside(event); | ||
} | ||
@@ -106,9 +118,2 @@ | ||
// save the "keydown" event for Enter | ||
listBox.addEventListener('keydown', (e) => { | ||
if (e.keyCode === 13) { | ||
this._enterKeydown = e; | ||
} | ||
}); | ||
root.appendChild(listBox); | ||
@@ -115,0 +120,0 @@ }; |
@@ -7,10 +7,9 @@ /** | ||
*/ | ||
import { Constructor } from '@open-wc/dedupe-mixin'; | ||
declare function InlineEditingMixin<T extends new (...args: any[]) => {}>(base: T): T & InlineEditingMixinConstructor; | ||
export declare function InlineEditingMixin<T extends Constructor<HTMLElement>>( | ||
base: T | ||
): T & Constructor<InlineEditingMixinClass>; | ||
interface InlineEditingMixinConstructor { | ||
new (...args: any[]): InlineEditingMixin; | ||
} | ||
interface InlineEditingMixin { | ||
export declare class InlineEditingMixinClass { | ||
/** | ||
@@ -41,9 +40,5 @@ * When true, pressing Enter while in cell edit mode | ||
_checkImports(): void; | ||
protected _stopEdit(shouldCancel?: boolean, shouldRestoreFocus?: boolean): void; | ||
_stopEdit(shouldCancel?: boolean, shouldRestoreFocus?: boolean): void; | ||
_switchEditCell(e: KeyboardEvent): void; | ||
protected _switchEditCell(e: KeyboardEvent): void; | ||
} | ||
export { InlineEditingMixin, InlineEditingMixinConstructor }; |
@@ -7,5 +7,4 @@ /** | ||
*/ | ||
import { GridDefaultItem, Grid, GridCustomEventMap } from '@vaadin/grid/src/vaadin-grid.js'; | ||
import { InlineEditingMixin } from './vaadin-grid-pro-inline-editing-mixin.js'; | ||
import { Grid, GridCustomEventMap, GridDefaultItem } from '@vaadin/grid/src/vaadin-grid.js'; | ||
import { InlineEditingMixinClass } from './vaadin-grid-pro-inline-editing-mixin.js'; | ||
export { GridProEditorType } from './vaadin-grid-pro-edit-column.js'; | ||
@@ -80,4 +79,2 @@ | ||
declare class GridPro<TItem = GridDefaultItem> extends Grid<TItem> { | ||
static _finalizeClass(): void; | ||
addEventListener<K extends keyof GridProEventMap<TItem>>( | ||
@@ -96,3 +93,3 @@ type: K, | ||
interface GridPro extends InlineEditingMixin {} | ||
interface GridPro extends InlineEditingMixinClass {} | ||
@@ -99,0 +96,0 @@ declare global { |
@@ -7,5 +7,5 @@ /** | ||
*/ | ||
import '@vaadin/vaadin-license-checker/vaadin-license-checker.js'; | ||
import { Grid } from '@vaadin/grid/src/vaadin-grid.js'; | ||
import { InlineEditingMixin } from './vaadin-grid-pro-inline-editing-mixin.js'; | ||
import '@vaadin/vaadin-license-checker/vaadin-license-checker.js'; | ||
@@ -12,0 +12,0 @@ /** |
@@ -1,4 +0,4 @@ | ||
import { registerStyles, css } from '@vaadin/vaadin-themable-mixin/register-styles.js'; | ||
import '@vaadin/vaadin-lumo-styles/spacing.js'; | ||
import '@vaadin/vaadin-lumo-styles/typography.js'; | ||
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js'; | ||
import { gridProEditor } from './vaadin-grid-pro-editor-styles.js'; | ||
@@ -5,0 +5,0 @@ |
@@ -1,2 +0,2 @@ | ||
import { registerStyles } from '@vaadin/vaadin-themable-mixin/register-styles.js'; | ||
import { registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js'; | ||
import { gridProEditor } from './vaadin-grid-pro-editor-styles.js'; | ||
@@ -3,0 +3,0 @@ |
@@ -1,5 +0,5 @@ | ||
import { registerStyles, css } from '@vaadin/vaadin-themable-mixin/register-styles.js'; | ||
import '@vaadin/vaadin-lumo-styles/color.js'; | ||
import '@vaadin/vaadin-lumo-styles/spacing.js'; | ||
import '@vaadin/vaadin-lumo-styles/typography.js'; | ||
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js'; | ||
@@ -6,0 +6,0 @@ const gridProEditor = css` |
@@ -1,4 +0,4 @@ | ||
import { registerStyles, css } from '@vaadin/vaadin-themable-mixin/register-styles.js'; | ||
import '@vaadin/vaadin-lumo-styles/color.js'; | ||
import '@vaadin/vaadin-lumo-styles/style.js'; | ||
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js'; | ||
@@ -5,0 +5,0 @@ registerStyles( |
@@ -1,2 +0,2 @@ | ||
import { registerStyles, css } from '@vaadin/vaadin-themable-mixin/register-styles.js'; | ||
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js'; | ||
import { gridProEditor } from './vaadin-grid-pro-editor-styles.js'; | ||
@@ -3,0 +3,0 @@ |
@@ -1,2 +0,2 @@ | ||
import { registerStyles } from '@vaadin/vaadin-themable-mixin/register-styles.js'; | ||
import { registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js'; | ||
import { gridProEditor } from './vaadin-grid-pro-editor-styles.js'; | ||
@@ -3,0 +3,0 @@ |
@@ -1,2 +0,2 @@ | ||
import { registerStyles, css } from '@vaadin/vaadin-themable-mixin/register-styles.js'; | ||
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js'; | ||
@@ -3,0 +3,0 @@ const gridProEditor = css` |
@@ -1,4 +0,4 @@ | ||
import { registerStyles, css } from '@vaadin/vaadin-themable-mixin/register-styles.js'; | ||
import '@vaadin/vaadin-material-styles/color.js'; | ||
import '@vaadin/grid/theme/material/vaadin-grid-styles.js'; | ||
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js'; | ||
@@ -5,0 +5,0 @@ registerStyles( |
65930
0.69%1290
0.08%80
9.59%13
8.33%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated
Updated
Updated