@vaadin/grid 22.0.0-alpha9 → 22.0.0
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/README.md +45 -26
- package/package.json +11 -11
- package/src/vaadin-grid-active-item-mixin.d.ts +5 -10
- package/src/vaadin-grid-array-data-provider-mixin.d.ts +4 -9
- package/src/vaadin-grid-column-group.d.ts +2 -2
- package/src/vaadin-grid-column-group.js +1 -1
- package/src/vaadin-grid-column-reordering-mixin.d.ts +4 -11
- package/src/vaadin-grid-column.d.ts +6 -9
- package/src/vaadin-grid-column.js +2 -2
- package/src/vaadin-grid-data-provider-mixin.d.ts +5 -10
- package/src/vaadin-grid-data-provider-mixin.js +1 -1
- package/src/vaadin-grid-drag-and-drop-mixin.d.ts +4 -9
- package/src/vaadin-grid-drag-and-drop-mixin.js +4 -3
- package/src/vaadin-grid-dynamic-columns-mixin.js +2 -2
- package/src/vaadin-grid-event-context-mixin.d.ts +4 -9
- package/src/vaadin-grid-filter-column.d.ts +1 -1
- package/src/vaadin-grid-filter-column.js +1 -1
- package/src/vaadin-grid-filter.js +3 -3
- package/src/vaadin-grid-keyboard-navigation-mixin.js +28 -15
- package/src/vaadin-grid-row-details-mixin.d.ts +4 -9
- package/src/vaadin-grid-scroll-mixin.d.ts +3 -8
- package/src/vaadin-grid-scroll-mixin.js +1 -1
- package/src/vaadin-grid-selection-column.d.ts +1 -1
- package/src/vaadin-grid-selection-column.js +34 -18
- package/src/vaadin-grid-selection-mixin.d.ts +4 -9
- package/src/vaadin-grid-sort-column.d.ts +1 -1
- package/src/vaadin-grid-sort-column.js +1 -1
- package/src/vaadin-grid-sort-mixin.d.ts +3 -8
- package/src/vaadin-grid-sorter.js +1 -1
- package/src/vaadin-grid-styles.js +1 -1
- package/src/vaadin-grid-styling-mixin.d.ts +6 -9
- package/src/vaadin-grid-tree-column.d.ts +1 -1
- package/src/vaadin-grid-tree-column.js +1 -1
- package/src/vaadin-grid-tree-toggle.js +1 -1
- package/src/vaadin-grid.d.ts +43 -52
- package/src/vaadin-grid.js +98 -79
- package/theme/lumo/vaadin-grid-sorter-styles.js +1 -1
- package/theme/lumo/vaadin-grid-styles.js +5 -1
- package/theme/lumo/vaadin-grid-tree-toggle-styles.js +1 -1
- package/theme/material/vaadin-grid-sorter-styles.js +1 -1
- package/theme/material/vaadin-grid-styles.js +5 -1
- package/theme/material/vaadin-grid-tree-toggle-styles.js +1 -1
package/README.md
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @vaadin/grid
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
|
5
|
-
[API documentation ↗](https://vaadin.com/components/vaadin-grid/html-api)
|
|
3
|
+
A web component for showing tabular data.
|
|
6
4
|
|
|
7
|
-
[
|
|
5
|
+
[Documentation + Live Demo ↗](https://vaadin.com/docs/latest/ds/components/grid)
|
|
8
6
|
|
|
9
7
|
[](https://www.npmjs.com/package/@vaadin/grid)
|
|
10
|
-
[](https://vaadin.com/directory/component/vaadinvaadin-grid)
|
|
11
8
|
[](https://discord.gg/PHmkCKC)
|
|
12
9
|
|
|
13
10
|
```html
|
|
@@ -15,12 +12,12 @@
|
|
|
15
12
|
<vaadin-grid-selection-column auto-select frozen></vaadin-grid-selection-column>
|
|
16
13
|
<vaadin-grid-sort-column width="9em" path="firstName"></vaadin-grid-sort-column>
|
|
17
14
|
<vaadin-grid-sort-column width="9em" path="lastName"></vaadin-grid-sort-column>
|
|
18
|
-
<vaadin-grid-column id="
|
|
15
|
+
<vaadin-grid-column id="address" width="15em" flex-grow="2" header="Address"></vaadin-grid-column>
|
|
19
16
|
</vaadin-grid>
|
|
20
17
|
|
|
21
18
|
<script>
|
|
22
19
|
// Customize the "Address" column's renderer
|
|
23
|
-
document.querySelector('#
|
|
20
|
+
document.querySelector('#address').renderer = (root, grid, model) => {
|
|
24
21
|
root.textContent = `${model.item.address.street}, ${model.item.address.city}`;
|
|
25
22
|
};
|
|
26
23
|
|
|
@@ -32,41 +29,62 @@
|
|
|
32
29
|
</script>
|
|
33
30
|
```
|
|
34
31
|
|
|
35
|
-
[<img src="https://raw.githubusercontent.com/vaadin/
|
|
32
|
+
[<img src="https://raw.githubusercontent.com/vaadin/web-components/master/packages/grid/screenshot.png" alt="Screenshot of vaadin-grid">](https://vaadin.com/docs/latest/ds/components/grid)
|
|
36
33
|
|
|
37
34
|
## Installation
|
|
38
35
|
|
|
39
|
-
Install
|
|
36
|
+
Install the component:
|
|
40
37
|
|
|
41
38
|
```sh
|
|
42
|
-
npm i @vaadin/grid
|
|
39
|
+
npm i @vaadin/grid
|
|
43
40
|
```
|
|
44
41
|
|
|
45
|
-
Once installed, import
|
|
42
|
+
Once installed, import the components in your application:
|
|
46
43
|
|
|
47
44
|
```js
|
|
48
|
-
import '@vaadin/grid
|
|
45
|
+
import '@vaadin/grid';
|
|
46
|
+
import '@vaadin/grid/vaadin-grid-column-group.js';
|
|
47
|
+
import '@vaadin/grid/vaadin-grid-filter-column.js';
|
|
48
|
+
import '@vaadin/grid/vaadin-grid-selection-column.js';
|
|
49
|
+
import '@vaadin/grid/vaadin-grid-sort-column.js';
|
|
50
|
+
import '@vaadin/grid/vaadin-grid-tree-column.js';
|
|
49
51
|
```
|
|
50
52
|
|
|
51
|
-
##
|
|
53
|
+
## Themes
|
|
52
54
|
|
|
53
|
-
Vaadin components
|
|
55
|
+
Vaadin components come with two built-in [themes](https://vaadin.com/docs/latest/ds/customization/using-themes), Lumo and Material.
|
|
56
|
+
The [main entrypoint](https://github.com/vaadin/web-components/blob/master/packages/grid/vaadin-grid.js) of the package uses the Lumo theme.
|
|
54
57
|
|
|
55
|
-
To use the Material theme, import the
|
|
58
|
+
To use the Material theme, import the components from the `theme/material` folder:
|
|
56
59
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
```js
|
|
61
|
+
import '@vaadin/grid/theme/material/vaadin-grid.js';
|
|
62
|
+
import '@vaadin/grid/theme/material/vaadin-grid-filter-column.js';
|
|
63
|
+
import '@vaadin/grid/theme/material/vaadin-grid-selection-column.js';
|
|
64
|
+
import '@vaadin/grid/theme/material/vaadin-grid-sort-column.js';
|
|
65
|
+
import '@vaadin/grid/theme/material/vaadin-grid-tree-column.js';
|
|
66
|
+
```
|
|
62
67
|
|
|
63
|
-
|
|
68
|
+
You can also import the Lumo version of the components explicitly:
|
|
64
69
|
|
|
65
|
-
|
|
70
|
+
```js
|
|
71
|
+
import '@vaadin/grid/theme/lumo/vaadin-grid.js';
|
|
72
|
+
import '@vaadin/grid/theme/lumo/vaadin-grid-filter-column.js';
|
|
73
|
+
import '@vaadin/grid/theme/lumo/vaadin-grid-selection-column.js';
|
|
74
|
+
import '@vaadin/grid/theme/lumo/vaadin-grid-sort-column.js';
|
|
75
|
+
import '@vaadin/grid/theme/lumo/vaadin-grid-tree-column.js';
|
|
76
|
+
```
|
|
66
77
|
|
|
67
|
-
-
|
|
78
|
+
Finally, you can import the un-themed components from the `src` folder to get a minimal starting point:
|
|
68
79
|
|
|
69
|
-
|
|
80
|
+
```js
|
|
81
|
+
import '@vaadin/grid/src/vaadin-grid.js';
|
|
82
|
+
import '@vaadin/grid/src/vaadin-grid-column-group.js';
|
|
83
|
+
import '@vaadin/grid/src/vaadin-grid-filter-column.js';
|
|
84
|
+
import '@vaadin/grid/src/vaadin-grid-selection-column.js';
|
|
85
|
+
import '@vaadin/grid/src/vaadin-grid-sort-column.js';
|
|
86
|
+
import '@vaadin/grid/src/vaadin-grid-tree-column.js';
|
|
87
|
+
```
|
|
70
88
|
|
|
71
89
|
## Contributing
|
|
72
90
|
|
|
@@ -76,4 +94,5 @@ Read the [contributing guide](https://vaadin.com/docs/latest/guide/contributing/
|
|
|
76
94
|
|
|
77
95
|
Apache License 2.0
|
|
78
96
|
|
|
79
|
-
Vaadin collects development time
|
|
97
|
+
Vaadin collects usage statistics at development time to improve this product.
|
|
98
|
+
For details and to opt-out, see https://github.com/vaadin/vaadin-usage-statistics.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/grid",
|
|
3
|
-
"version": "22.0.0
|
|
3
|
+
"version": "22.0.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -38,21 +38,21 @@
|
|
|
38
38
|
"data-table"
|
|
39
39
|
],
|
|
40
40
|
"dependencies": {
|
|
41
|
+
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
41
42
|
"@polymer/polymer": "^3.0.0",
|
|
42
|
-
"@vaadin/checkbox": "22.0.0
|
|
43
|
-
"@vaadin/component-base": "22.0.0
|
|
44
|
-
"@vaadin/text-field": "22.0.0
|
|
45
|
-
"@vaadin/vaadin-lumo-styles": "22.0.0
|
|
46
|
-
"@vaadin/vaadin-material-styles": "22.0.0
|
|
47
|
-
"@vaadin/vaadin-themable-mixin": "22.0.0
|
|
48
|
-
"@vaadin/virtual-list": "22.0.0-alpha9"
|
|
43
|
+
"@vaadin/checkbox": "^22.0.0",
|
|
44
|
+
"@vaadin/component-base": "^22.0.0",
|
|
45
|
+
"@vaadin/text-field": "^22.0.0",
|
|
46
|
+
"@vaadin/vaadin-lumo-styles": "^22.0.0",
|
|
47
|
+
"@vaadin/vaadin-material-styles": "^22.0.0",
|
|
48
|
+
"@vaadin/vaadin-themable-mixin": "^22.0.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@esm-bundle/chai": "^4.3.4",
|
|
52
|
-
"@vaadin/polymer-legacy-adapter": "22.0.0
|
|
53
|
-
"@vaadin/testing-helpers": "^0.3.
|
|
52
|
+
"@vaadin/polymer-legacy-adapter": "^22.0.0",
|
|
53
|
+
"@vaadin/testing-helpers": "^0.3.2",
|
|
54
54
|
"lit": "^2.0.0",
|
|
55
55
|
"sinon": "^9.2.0"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "b668e9b1a975227fbe34beb70d1cd5b03dce2348"
|
|
58
58
|
}
|
|
@@ -3,16 +3,13 @@
|
|
|
3
3
|
* Copyright (c) 2021 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
+
import { Constructor } from '@open-wc/dedupe-mixin';
|
|
6
7
|
|
|
7
|
-
declare function ActiveItemMixin<TItem, T extends
|
|
8
|
+
export declare function ActiveItemMixin<TItem, T extends Constructor<HTMLElement>>(
|
|
8
9
|
base: T
|
|
9
|
-
): T &
|
|
10
|
+
): T & Constructor<ActiveItemMixinClass<TItem>>;
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
new (...args: any[]): ActiveItemMixin<TItem>;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
interface ActiveItemMixin<TItem> {
|
|
12
|
+
export declare class ActiveItemMixinClass<TItem> {
|
|
16
13
|
/**
|
|
17
14
|
* The item user has last interacted with. Turns to `null` after user deactivates
|
|
18
15
|
* the item by re-interacting with the currently active item.
|
|
@@ -20,6 +17,4 @@ interface ActiveItemMixin<TItem> {
|
|
|
20
17
|
activeItem: TItem | null;
|
|
21
18
|
}
|
|
22
19
|
|
|
23
|
-
declare function isFocusable(target: Element): boolean;
|
|
24
|
-
|
|
25
|
-
export { ActiveItemMixin, ActiveItemMixinConstructor, isFocusable };
|
|
20
|
+
export declare function isFocusable(target: Element): boolean;
|
|
@@ -3,20 +3,15 @@
|
|
|
3
3
|
* Copyright (c) 2021 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
+
import { Constructor } from '@open-wc/dedupe-mixin';
|
|
6
7
|
|
|
7
|
-
declare function ArrayDataProviderMixin<TItem, T extends
|
|
8
|
+
export declare function ArrayDataProviderMixin<TItem, T extends Constructor<HTMLElement>>(
|
|
8
9
|
base: T
|
|
9
|
-
): T &
|
|
10
|
+
): T & Constructor<ArrayDataProviderMixinClass<TItem>>;
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
new (...args: any[]): ArrayDataProviderMixin<TItem>;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
declare interface ArrayDataProviderMixin<TItem> {
|
|
12
|
+
export declare class ArrayDataProviderMixinClass<TItem> {
|
|
16
13
|
/**
|
|
17
14
|
* An array containing the items which will be passed to renderer functions.
|
|
18
15
|
*/
|
|
19
16
|
items: TItem[] | null | undefined;
|
|
20
17
|
}
|
|
21
|
-
|
|
22
|
-
export { ArrayDataProviderMixin, ArrayDataProviderMixinConstructor };
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* Copyright (c) 2021 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import { ColumnBaseMixin } from './vaadin-grid-column.js';
|
|
7
6
|
import { GridDefaultItem } from './vaadin-grid.js';
|
|
7
|
+
import { ColumnBaseMixinClass } from './vaadin-grid-column.js';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* A `<vaadin-grid-column-group>` is used to make groups of columns in `<vaadin-grid>` and
|
|
@@ -48,7 +48,7 @@ declare class GridColumnGroup extends HTMLElement {
|
|
|
48
48
|
readonly width: string | null | undefined;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
interface GridColumnGroup<TItem = GridDefaultItem> extends
|
|
51
|
+
interface GridColumnGroup<TItem = GridDefaultItem> extends ColumnBaseMixinClass<TItem> {}
|
|
52
52
|
|
|
53
53
|
declare global {
|
|
54
54
|
interface HTMLElementTagNameMap {
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* Copyright (c) 2021 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import { PolymerElement } from '@polymer/polymer/polymer-element.js';
|
|
7
6
|
import { FlattenedNodesObserver } from '@polymer/polymer/lib/utils/flattened-nodes-observer.js';
|
|
7
|
+
import { PolymerElement } from '@polymer/polymer/polymer-element.js';
|
|
8
8
|
import { microTask } from '@vaadin/component-base/src/async.js';
|
|
9
9
|
import { ColumnBaseMixin } from './vaadin-grid-column.js';
|
|
10
10
|
import { updateColumnOrders } from './vaadin-grid-helpers.js';
|
|
@@ -3,23 +3,16 @@
|
|
|
3
3
|
* Copyright (c) 2021 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
+
import { Constructor } from '@open-wc/dedupe-mixin';
|
|
6
7
|
|
|
7
|
-
declare function ColumnReorderingMixin<T extends
|
|
8
|
+
export declare function ColumnReorderingMixin<T extends Constructor<HTMLElement>>(
|
|
8
9
|
base: T
|
|
9
|
-
): T &
|
|
10
|
+
): T & Constructor<ColumnReorderingMixinClass>;
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
new (...args: any[]): ColumnReorderingMixin;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export { ColumnReorderingMixinConstructor };
|
|
16
|
-
|
|
17
|
-
interface ColumnReorderingMixin {
|
|
12
|
+
export declare class ColumnReorderingMixinClass {
|
|
18
13
|
/**
|
|
19
14
|
* Set to true to allow column reordering.
|
|
20
15
|
* @attr {boolean} column-reordering-allowed
|
|
21
16
|
*/
|
|
22
17
|
columnReorderingAllowed: boolean;
|
|
23
18
|
}
|
|
24
|
-
|
|
25
|
-
export { ColumnReorderingMixin };
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Copyright (c) 2021 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
+
import { Constructor } from '@open-wc/dedupe-mixin';
|
|
6
7
|
import { GridDefaultItem, GridItemModel } from './vaadin-grid.js';
|
|
7
8
|
|
|
8
9
|
export type GridBodyRenderer<TItem> = (
|
|
@@ -15,15 +16,11 @@ export type GridColumnTextAlign = 'start' | 'center' | 'end' | null;
|
|
|
15
16
|
|
|
16
17
|
export type GridHeaderFooterRenderer<TItem> = (root: HTMLElement, column: GridColumn<TItem>) => void;
|
|
17
18
|
|
|
18
|
-
declare function ColumnBaseMixin<TItem, T extends
|
|
19
|
+
export declare function ColumnBaseMixin<TItem, T extends Constructor<HTMLElement>>(
|
|
19
20
|
base: T
|
|
20
|
-
): T &
|
|
21
|
+
): T & Constructor<ColumnBaseMixinClass<TItem>>;
|
|
21
22
|
|
|
22
|
-
export
|
|
23
|
-
new (...args: any[]): ColumnBaseMixin<TItem>;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
interface ColumnBaseMixin<TItem> {
|
|
23
|
+
export declare class ColumnBaseMixinClass<TItem> {
|
|
27
24
|
/**
|
|
28
25
|
* When set to true, the column is user-resizable.
|
|
29
26
|
*/
|
|
@@ -132,7 +129,7 @@ declare class GridColumn<TItem = GridDefaultItem> extends HTMLElement {
|
|
|
132
129
|
autoWidth: boolean;
|
|
133
130
|
}
|
|
134
131
|
|
|
135
|
-
interface GridColumn<TItem = GridDefaultItem> extends
|
|
132
|
+
interface GridColumn<TItem = GridDefaultItem> extends ColumnBaseMixinClass<TItem> {}
|
|
136
133
|
|
|
137
134
|
declare global {
|
|
138
135
|
interface HTMLElementTagNameMap {
|
|
@@ -140,4 +137,4 @@ declare global {
|
|
|
140
137
|
}
|
|
141
138
|
}
|
|
142
139
|
|
|
143
|
-
export {
|
|
140
|
+
export { GridColumn };
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import { PolymerElement } from '@polymer/polymer/polymer-element.js';
|
|
7
|
+
import { animationFrame } from '@vaadin/component-base/src/async.js';
|
|
8
|
+
import { Debouncer } from '@vaadin/component-base/src/debounce.js';
|
|
7
9
|
import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
|
|
8
10
|
import { processTemplates } from '@vaadin/component-base/src/templates.js';
|
|
9
|
-
import { Debouncer } from '@vaadin/component-base/src/debounce.js';
|
|
10
|
-
import { animationFrame } from '@vaadin/component-base/src/async.js';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* @polymerMixin
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Copyright (c) 2021 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
+
import { Constructor } from '@open-wc/dedupe-mixin';
|
|
6
7
|
import { GridSorterDirection } from './vaadin-grid-sorter.js';
|
|
7
8
|
|
|
8
9
|
export { GridSorterDirection };
|
|
@@ -32,7 +33,7 @@ export type GridDataProvider<TItem> = (
|
|
|
32
33
|
callback: GridDataProviderCallback<TItem>
|
|
33
34
|
) => void;
|
|
34
35
|
|
|
35
|
-
declare class ItemCache<TItem> {
|
|
36
|
+
export declare class ItemCache<TItem> {
|
|
36
37
|
grid: HTMLElement;
|
|
37
38
|
parentCache: ItemCache<TItem> | undefined;
|
|
38
39
|
parentItem: TItem | undefined;
|
|
@@ -55,15 +56,11 @@ declare class ItemCache<TItem> {
|
|
|
55
56
|
getCacheAndIndex(index: number): { cache: ItemCache<TItem>; scaledIndex: number };
|
|
56
57
|
}
|
|
57
58
|
|
|
58
|
-
declare function DataProviderMixin<TItem, T extends
|
|
59
|
+
export declare function DataProviderMixin<TItem, T extends Constructor<HTMLElement>>(
|
|
59
60
|
base: T
|
|
60
|
-
): T &
|
|
61
|
+
): T & Constructor<DataProviderMixinClass<TItem>>;
|
|
61
62
|
|
|
62
|
-
|
|
63
|
-
new (...args: any[]): DataProviderMixin<TItem>;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
interface DataProviderMixin<TItem> {
|
|
63
|
+
export declare class DataProviderMixinClass<TItem> {
|
|
67
64
|
/**
|
|
68
65
|
* Number of items fetched at a time from the dataprovider.
|
|
69
66
|
* @attr {number} page-size
|
|
@@ -136,5 +133,3 @@ interface DataProviderMixin<TItem> {
|
|
|
136
133
|
*/
|
|
137
134
|
clearCache(): void;
|
|
138
135
|
}
|
|
139
|
-
|
|
140
|
-
export { DataProviderMixin, DataProviderMixinConstructor, ItemCache };
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* Copyright (c) 2021 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import { Debouncer } from '@vaadin/component-base/src/debounce.js';
|
|
7
6
|
import { timeOut } from '@vaadin/component-base/src/async.js';
|
|
7
|
+
import { Debouncer } from '@vaadin/component-base/src/debounce.js';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* @private
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Copyright (c) 2021 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
+
import { Constructor } from '@open-wc/dedupe-mixin';
|
|
6
7
|
import { GridItemModel } from './vaadin-grid.js';
|
|
7
8
|
|
|
8
9
|
export type GridDragAndDropFilter<TItem> = (model: GridItemModel<TItem>) => boolean;
|
|
@@ -11,15 +12,11 @@ export type GridDropLocation = 'above' | 'on-top' | 'below' | 'empty';
|
|
|
11
12
|
|
|
12
13
|
export type GridDropMode = 'between' | 'on-top' | 'on-top-or-between' | 'on-grid';
|
|
13
14
|
|
|
14
|
-
declare function DragAndDropMixin<TItem, T extends
|
|
15
|
+
export declare function DragAndDropMixin<TItem, T extends Constructor<HTMLElement>>(
|
|
15
16
|
base: T
|
|
16
|
-
): T &
|
|
17
|
+
): T & Constructor<DragAndDropMixinClass<TItem>>;
|
|
17
18
|
|
|
18
|
-
|
|
19
|
-
new (...args: any[]): DragAndDropMixin<TItem>;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
interface DragAndDropMixin<TItem> {
|
|
19
|
+
export declare class DragAndDropMixinClass<TItem> {
|
|
23
20
|
/**
|
|
24
21
|
* Defines the locations within the Grid row where an element can be dropped.
|
|
25
22
|
*
|
|
@@ -76,5 +73,3 @@ interface DragAndDropMixin<TItem> {
|
|
|
76
73
|
*/
|
|
77
74
|
filterDragAndDrop(): void;
|
|
78
75
|
}
|
|
79
|
-
|
|
80
|
-
export { DragAndDropMixin, DragAndDropMixinConstructor };
|
|
@@ -85,7 +85,7 @@ export const DragAndDropMixin = (superClass) =>
|
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
static get observers() {
|
|
88
|
-
return ['_dragDropAccessChanged(rowsDraggable, dropMode, dragFilter, dropFilter)'];
|
|
88
|
+
return ['_dragDropAccessChanged(rowsDraggable, dropMode, dragFilter, dropFilter, loading)'];
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
/** @protected */
|
|
@@ -374,8 +374,9 @@ export const DragAndDropMixin = (superClass) =>
|
|
|
374
374
|
* @protected
|
|
375
375
|
*/
|
|
376
376
|
_filterDragAndDrop(row, model) {
|
|
377
|
-
const
|
|
378
|
-
const
|
|
377
|
+
const loading = this.loading || row.hasAttribute('loading');
|
|
378
|
+
const dragDisabled = !this.rowsDraggable || loading || (this.dragFilter && !this.dragFilter(model));
|
|
379
|
+
const dropDisabled = !this.dropMode || loading || (this.dropFilter && !this.dropFilter(model));
|
|
379
380
|
|
|
380
381
|
const draggableElements = Array.from(row.children).map((cell) => cell._content);
|
|
381
382
|
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
* Copyright (c) 2021 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import { PolymerElement } from '@polymer/polymer/polymer-element.js';
|
|
7
6
|
import { FlattenedNodesObserver } from '@polymer/polymer/lib/utils/flattened-nodes-observer.js';
|
|
8
|
-
import {
|
|
7
|
+
import { PolymerElement } from '@polymer/polymer/polymer-element.js';
|
|
9
8
|
import { timeOut } from '@vaadin/component-base/src/async.js';
|
|
9
|
+
import { Debouncer } from '@vaadin/component-base/src/debounce.js';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* @polymerMixin
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Copyright (c) 2021 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
+
import { Constructor } from '@open-wc/dedupe-mixin';
|
|
6
7
|
import { GridColumn } from './vaadin-grid-column.js';
|
|
7
8
|
|
|
8
9
|
export interface GridEventContext<TItem> {
|
|
@@ -16,15 +17,11 @@ export interface GridEventContext<TItem> {
|
|
|
16
17
|
level?: number;
|
|
17
18
|
}
|
|
18
19
|
|
|
19
|
-
declare function EventContextMixin<TItem, T extends
|
|
20
|
+
export declare function EventContextMixin<TItem, T extends Constructor<HTMLElement>>(
|
|
20
21
|
base: T
|
|
21
|
-
): T &
|
|
22
|
+
): T & Constructor<EventContextMixinClass<TItem>>;
|
|
22
23
|
|
|
23
|
-
|
|
24
|
-
new (...args: any[]): EventContextMixin<TItem>;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
interface EventContextMixin<TItem> {
|
|
24
|
+
export declare class EventContextMixinClass<TItem> {
|
|
28
25
|
/**
|
|
29
26
|
* Returns an object with context information about the event target:
|
|
30
27
|
* - `item`: the data object corresponding to the targeted row (not specified when targeting header or footer)
|
|
@@ -45,5 +42,3 @@ interface EventContextMixin<TItem> {
|
|
|
45
42
|
*/
|
|
46
43
|
getEventContext(event: Event): GridEventContext<TItem>;
|
|
47
44
|
}
|
|
48
|
-
|
|
49
|
-
export { EventContextMixin, EventContextMixinConstructor };
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* Copyright (c) 2021 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import { GridColumn } from './vaadin-grid-column.js';
|
|
7
6
|
import { GridDefaultItem } from './vaadin-grid.js';
|
|
7
|
+
import { GridColumn } from './vaadin-grid-column.js';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* `<vaadin-grid-filter-column>` is a helper element for the `<vaadin-grid>`
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* Copyright (c) 2021 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import { GridColumn } from './vaadin-grid-column.js';
|
|
7
6
|
import './vaadin-grid-filter.js';
|
|
7
|
+
import { GridColumn } from './vaadin-grid-column.js';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* `<vaadin-grid-filter-column>` is a helper element for the `<vaadin-grid>`
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
* Copyright (c) 2021 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import { PolymerElement, html } from '@polymer/polymer/polymer-element.js';
|
|
7
|
-
import { Debouncer } from '@vaadin/component-base/src/debounce.js';
|
|
8
|
-
import { timeOut } from '@vaadin/component-base/src/async.js';
|
|
9
6
|
import '@vaadin/text-field/src/vaadin-text-field.js';
|
|
7
|
+
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
|
|
8
|
+
import { timeOut } from '@vaadin/component-base/src/async.js';
|
|
9
|
+
import { Debouncer } from '@vaadin/component-base/src/debounce.js';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* `<vaadin-grid-filter>` is a helper element for the `<vaadin-grid>` that provides out-of-the-box UI controls,
|
|
@@ -97,7 +97,9 @@ export const KeyboardNavigationMixin = (superClass) =>
|
|
|
97
97
|
|
|
98
98
|
/** @private */
|
|
99
99
|
get __rowFocusMode() {
|
|
100
|
-
return
|
|
100
|
+
return (
|
|
101
|
+
this.__isRow(this._itemsFocusable) || this.__isRow(this._headerFocusable) || this.__isRow(this._footerFocusable)
|
|
102
|
+
);
|
|
101
103
|
}
|
|
102
104
|
|
|
103
105
|
set __rowFocusMode(value) {
|
|
@@ -561,7 +563,10 @@ export const KeyboardNavigationMixin = (superClass) =>
|
|
|
561
563
|
|
|
562
564
|
index += step;
|
|
563
565
|
while (index >= 0 && index <= tabOrder.length - 1) {
|
|
564
|
-
|
|
566
|
+
let rowElement = tabOrder[index];
|
|
567
|
+
if (rowElement && !this.__rowFocusMode) {
|
|
568
|
+
rowElement = tabOrder[index].parentNode;
|
|
569
|
+
}
|
|
565
570
|
|
|
566
571
|
if (!rowElement || rowElement.hidden) {
|
|
567
572
|
index += step;
|
|
@@ -592,9 +597,9 @@ export const KeyboardNavigationMixin = (superClass) =>
|
|
|
592
597
|
// assigned with a new index since last focus, probably because of
|
|
593
598
|
// scrolling. Focus the row for the stored focused item index instead.
|
|
594
599
|
const columnIndex = Array.from(targetRow.children).indexOf(this._itemsFocusable);
|
|
595
|
-
const focusedItemRow = Array.from(this.$.items.children).
|
|
596
|
-
(row) => row.index === this._focusedItemIndex
|
|
597
|
-
)
|
|
600
|
+
const focusedItemRow = Array.from(this.$.items.children).find(
|
|
601
|
+
(row) => !row.hidden && row.index === this._focusedItemIndex
|
|
602
|
+
);
|
|
598
603
|
if (focusedItemRow) {
|
|
599
604
|
itemsFocusTarget = focusedItemRow.children[columnIndex];
|
|
600
605
|
}
|
|
@@ -778,19 +783,27 @@ export const KeyboardNavigationMixin = (superClass) =>
|
|
|
778
783
|
|
|
779
784
|
/** @protected */
|
|
780
785
|
_resetKeyboardNavigation() {
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
786
|
+
// Header / footer
|
|
787
|
+
['header', 'footer'].forEach((section) => {
|
|
788
|
+
if (!this.__isValidFocusable(this[`_${section}Focusable`])) {
|
|
789
|
+
const firstVisibleRow = [...this.$[section].children].find((row) => row.offsetHeight);
|
|
790
|
+
const firstVisibleCell = firstVisibleRow ? [...firstVisibleRow.children].find((cell) => !cell.hidden) : null;
|
|
791
|
+
if (firstVisibleRow && firstVisibleCell) {
|
|
792
|
+
this[`_${section}Focusable`] = this.__rowFocusMode ? firstVisibleRow : firstVisibleCell;
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
});
|
|
784
796
|
|
|
797
|
+
// Body
|
|
785
798
|
if (!this.__isValidFocusable(this._itemsFocusable) && this.$.items.firstElementChild) {
|
|
786
|
-
const
|
|
787
|
-
|
|
788
|
-
this._itemsFocusable = Array.from(firstVisibleIndexRow.children).filter((el) => !el.hidden)[0];
|
|
789
|
-
}
|
|
790
|
-
}
|
|
799
|
+
const firstVisibleRow = this.__getFirstVisibleItem();
|
|
800
|
+
const firstVisibleCell = firstVisibleRow ? [...firstVisibleRow.children].find((cell) => !cell.hidden) : null;
|
|
791
801
|
|
|
792
|
-
|
|
793
|
-
|
|
802
|
+
if (firstVisibleCell && firstVisibleRow) {
|
|
803
|
+
// Reset memoized column
|
|
804
|
+
delete this._focusedColumnOrder;
|
|
805
|
+
this._itemsFocusable = this.__rowFocusMode ? firstVisibleRow : firstVisibleCell;
|
|
806
|
+
}
|
|
794
807
|
}
|
|
795
808
|
}
|
|
796
809
|
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Copyright (c) 2021 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
+
import { Constructor } from '@open-wc/dedupe-mixin';
|
|
6
7
|
import { Grid, GridItemModel } from './vaadin-grid.js';
|
|
7
8
|
|
|
8
9
|
export type GridRowDetailsRenderer<TItem> = (
|
|
@@ -11,15 +12,11 @@ export type GridRowDetailsRenderer<TItem> = (
|
|
|
11
12
|
model?: GridItemModel<TItem>
|
|
12
13
|
) => void;
|
|
13
14
|
|
|
14
|
-
declare function RowDetailsMixin<TItem, T extends
|
|
15
|
+
export declare function RowDetailsMixin<TItem, T extends Constructor<HTMLElement>>(
|
|
15
16
|
base: T
|
|
16
|
-
): T &
|
|
17
|
+
): T & Constructor<RowDetailsMixinClass<TItem>>;
|
|
17
18
|
|
|
18
|
-
|
|
19
|
-
new (...args: any[]): RowDetailsMixin<TItem>;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
interface RowDetailsMixin<TItem> {
|
|
19
|
+
export declare class RowDetailsMixinClass<TItem> {
|
|
23
20
|
/**
|
|
24
21
|
* An array containing references to items with open row details.
|
|
25
22
|
*/
|
|
@@ -51,5 +48,3 @@ interface RowDetailsMixin<TItem> {
|
|
|
51
48
|
*/
|
|
52
49
|
closeItemDetails(item: TItem): void;
|
|
53
50
|
}
|
|
54
|
-
|
|
55
|
-
export { RowDetailsMixin, RowDetailsMixinConstructor };
|