@vaadin/grid 23.2.0-dev.8a7678b70 → 23.2.1
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 +4 -4
- package/package.json +17 -11
- package/src/array-data-provider.js +3 -5
- package/src/lit/column-renderer-directives.d.ts +7 -6
- package/src/lit/renderer-directives.d.ts +3 -3
- package/src/vaadin-grid-active-item-mixin.d.ts +2 -2
- package/src/vaadin-grid-array-data-provider-mixin.d.ts +2 -2
- package/src/vaadin-grid-column-group.d.ts +2 -2
- package/src/vaadin-grid-column-group.js +22 -7
- package/src/vaadin-grid-column-reordering-mixin.d.ts +2 -2
- package/src/vaadin-grid-column-reordering-mixin.js +31 -10
- package/src/vaadin-grid-column.d.ts +4 -4
- package/src/vaadin-grid-column.js +9 -3
- package/src/vaadin-grid-data-provider-mixin.d.ts +2 -2
- package/src/vaadin-grid-drag-and-drop-mixin.d.ts +5 -5
- package/src/vaadin-grid-drag-and-drop-mixin.js +3 -1
- package/src/vaadin-grid-event-context-mixin.d.ts +4 -4
- package/src/vaadin-grid-filter-column.d.ts +1 -1
- package/src/vaadin-grid-filter.d.ts +2 -2
- package/src/vaadin-grid-keyboard-navigation-mixin.js +10 -6
- package/src/vaadin-grid-row-details-mixin.d.ts +3 -3
- package/src/vaadin-grid-scroll-mixin.d.ts +2 -2
- package/src/vaadin-grid-scroll-mixin.js +3 -1
- package/src/vaadin-grid-selection-column.d.ts +3 -3
- package/src/vaadin-grid-selection-column.js +10 -3
- package/src/vaadin-grid-selection-mixin.d.ts +2 -2
- package/src/vaadin-grid-sort-column.d.ts +4 -4
- package/src/vaadin-grid-sort-mixin.d.ts +25 -2
- package/src/vaadin-grid-sort-mixin.js +60 -5
- package/src/vaadin-grid-sorter.d.ts +2 -2
- package/src/vaadin-grid-sorter.js +7 -3
- package/src/vaadin-grid-styling-mixin.d.ts +4 -4
- package/src/vaadin-grid-tree-column.d.ts +1 -1
- package/src/vaadin-grid-tree-toggle.d.ts +2 -2
- package/src/vaadin-grid-tree-toggle.js +3 -3
- package/src/vaadin-grid.d.ts +26 -24
- package/src/vaadin-grid.js +13 -4
- package/theme/lumo/vaadin-grid-styles.js +0 -10
- package/web-types.json +2176 -0
- package/web-types.lit.json +972 -0
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
A web component for showing tabular data.
|
|
4
4
|
|
|
5
|
-
[Documentation + Live Demo ↗](https://vaadin.com/docs/latest/
|
|
5
|
+
[Documentation + Live Demo ↗](https://vaadin.com/docs/latest/components/grid)
|
|
6
6
|
|
|
7
7
|
[](https://www.npmjs.com/package/@vaadin/grid)
|
|
8
8
|
[](https://discord.gg/PHmkCKC)
|
|
@@ -29,7 +29,7 @@ A web component for showing tabular data.
|
|
|
29
29
|
</script>
|
|
30
30
|
```
|
|
31
31
|
|
|
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/
|
|
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/components/grid)
|
|
33
33
|
|
|
34
34
|
## Installation
|
|
35
35
|
|
|
@@ -52,7 +52,7 @@ import '@vaadin/grid/vaadin-grid-tree-column.js';
|
|
|
52
52
|
|
|
53
53
|
## Themes
|
|
54
54
|
|
|
55
|
-
Vaadin components come with two built-in [themes](https://vaadin.com/docs/latest/
|
|
55
|
+
Vaadin components come with two built-in [themes](https://vaadin.com/docs/latest/styling), Lumo and Material.
|
|
56
56
|
The [main entrypoint](https://github.com/vaadin/web-components/blob/master/packages/grid/vaadin-grid.js) of the package uses the Lumo theme.
|
|
57
57
|
|
|
58
58
|
To use the Material theme, import the components from the `theme/material` folder:
|
|
@@ -88,7 +88,7 @@ import '@vaadin/grid/src/vaadin-grid-tree-column.js';
|
|
|
88
88
|
|
|
89
89
|
## Contributing
|
|
90
90
|
|
|
91
|
-
Read the [contributing guide](https://vaadin.com/docs/latest/
|
|
91
|
+
Read the [contributing guide](https://vaadin.com/docs/latest/contributing/overview) to learn about our development process, how to propose bugfixes and improvements, and how to test your changes to Vaadin components.
|
|
92
92
|
|
|
93
93
|
## License
|
|
94
94
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/grid",
|
|
3
|
-
"version": "23.2.
|
|
3
|
+
"version": "23.2.1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -26,7 +26,9 @@
|
|
|
26
26
|
"src",
|
|
27
27
|
"theme",
|
|
28
28
|
"vaadin-*.d.ts",
|
|
29
|
-
"vaadin-*.js"
|
|
29
|
+
"vaadin-*.js",
|
|
30
|
+
"web-types.json",
|
|
31
|
+
"web-types.lit.json"
|
|
30
32
|
],
|
|
31
33
|
"keywords": [
|
|
32
34
|
"vaadin",
|
|
@@ -43,20 +45,24 @@
|
|
|
43
45
|
"dependencies": {
|
|
44
46
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
45
47
|
"@polymer/polymer": "^3.0.0",
|
|
46
|
-
"@vaadin/checkbox": "23.2.
|
|
47
|
-
"@vaadin/component-base": "23.2.
|
|
48
|
-
"@vaadin/lit-renderer": "23.2.
|
|
49
|
-
"@vaadin/text-field": "23.2.
|
|
50
|
-
"@vaadin/vaadin-lumo-styles": "23.2.
|
|
51
|
-
"@vaadin/vaadin-material-styles": "23.2.
|
|
52
|
-
"@vaadin/vaadin-themable-mixin": "23.2.
|
|
48
|
+
"@vaadin/checkbox": "~23.2.1",
|
|
49
|
+
"@vaadin/component-base": "~23.2.1",
|
|
50
|
+
"@vaadin/lit-renderer": "~23.2.1",
|
|
51
|
+
"@vaadin/text-field": "~23.2.1",
|
|
52
|
+
"@vaadin/vaadin-lumo-styles": "~23.2.1",
|
|
53
|
+
"@vaadin/vaadin-material-styles": "~23.2.1",
|
|
54
|
+
"@vaadin/vaadin-themable-mixin": "~23.2.1"
|
|
53
55
|
},
|
|
54
56
|
"devDependencies": {
|
|
55
57
|
"@esm-bundle/chai": "^4.3.4",
|
|
56
|
-
"@vaadin/polymer-legacy-adapter": "23.2.
|
|
58
|
+
"@vaadin/polymer-legacy-adapter": "~23.2.1",
|
|
57
59
|
"@vaadin/testing-helpers": "^0.3.2",
|
|
58
60
|
"lit": "^2.0.0",
|
|
59
61
|
"sinon": "^13.0.2"
|
|
60
62
|
},
|
|
61
|
-
"
|
|
63
|
+
"web-types": [
|
|
64
|
+
"web-types.json",
|
|
65
|
+
"web-types.lit.json"
|
|
66
|
+
],
|
|
67
|
+
"gitHead": "a6c314f6927bfd3309fc735eae6c6dc72ab8367a"
|
|
62
68
|
}
|
|
@@ -22,12 +22,10 @@ function checkPaths(arrayToCheck, action, items) {
|
|
|
22
22
|
|
|
23
23
|
let result = true;
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
const path = arrayToCheck[i].path;
|
|
27
|
-
|
|
25
|
+
arrayToCheck.forEach(({ path }) => {
|
|
28
26
|
// Skip simple paths
|
|
29
27
|
if (!path || path.indexOf('.') === -1) {
|
|
30
|
-
|
|
28
|
+
return;
|
|
31
29
|
}
|
|
32
30
|
|
|
33
31
|
const parentProperty = path.replace(/\.[^.]*$/, ''); // A.b.c -> a.b
|
|
@@ -35,7 +33,7 @@ function checkPaths(arrayToCheck, action, items) {
|
|
|
35
33
|
console.warn(`Path "${path}" used for ${action} does not exist in all of the items, ${action} is disabled.`);
|
|
36
34
|
result = false;
|
|
37
35
|
}
|
|
38
|
-
}
|
|
36
|
+
});
|
|
39
37
|
|
|
40
38
|
return result;
|
|
41
39
|
}
|
|
@@ -4,11 +4,12 @@
|
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
/* eslint-disable max-classes-per-file */
|
|
7
|
-
import { TemplateResult } from 'lit';
|
|
8
|
-
import { DirectiveResult } from 'lit/directive';
|
|
9
|
-
import { LitRenderer
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
7
|
+
import type { TemplateResult } from 'lit';
|
|
8
|
+
import type { DirectiveResult } from 'lit/directive';
|
|
9
|
+
import type { LitRenderer } from '@vaadin/lit-renderer';
|
|
10
|
+
import { LitRendererDirective } from '@vaadin/lit-renderer';
|
|
11
|
+
import type { GridItemModel } from '../vaadin-grid.js';
|
|
12
|
+
import type { GridColumn } from '../vaadin-grid-column.js';
|
|
12
13
|
|
|
13
14
|
export type GridColumnBodyLitRenderer<TItem> = (
|
|
14
15
|
item: TItem,
|
|
@@ -26,7 +27,7 @@ declare abstract class AbstractGridColumnRendererDirective<R extends LitRenderer
|
|
|
26
27
|
/**
|
|
27
28
|
* A property to that the renderer callback will be assigned.
|
|
28
29
|
*/
|
|
29
|
-
abstract rendererProperty: '
|
|
30
|
+
abstract rendererProperty: 'footerRenderer' | 'headerRenderer' | 'renderer';
|
|
30
31
|
|
|
31
32
|
/**
|
|
32
33
|
* Adds the renderer callback to the grid column.
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
* Copyright (c) 2017 - 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 { TemplateResult } from 'lit';
|
|
7
|
-
import { DirectiveResult } from 'lit/directive';
|
|
6
|
+
import type { TemplateResult } from 'lit';
|
|
7
|
+
import type { DirectiveResult } from 'lit/directive';
|
|
8
8
|
import { LitRendererDirective } from '@vaadin/lit-renderer';
|
|
9
|
-
import { Grid, GridItemModel } from '../vaadin-grid.js';
|
|
9
|
+
import type { Grid, GridItemModel } from '../vaadin-grid.js';
|
|
10
10
|
|
|
11
11
|
export type GridRowDetailsLitRenderer<TItem> = (item: TItem, model: GridItemModel<TItem>, grid: Grid) => TemplateResult;
|
|
12
12
|
|
|
@@ -3,11 +3,11 @@
|
|
|
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 { Constructor } from '@open-wc/dedupe-mixin';
|
|
6
|
+
import type { Constructor } from '@open-wc/dedupe-mixin';
|
|
7
7
|
|
|
8
8
|
export declare function ActiveItemMixin<TItem, T extends Constructor<HTMLElement>>(
|
|
9
9
|
base: T,
|
|
10
|
-
):
|
|
10
|
+
): Constructor<ActiveItemMixinClass<TItem>> & T;
|
|
11
11
|
|
|
12
12
|
export declare class ActiveItemMixinClass<TItem> {
|
|
13
13
|
/**
|
|
@@ -3,11 +3,11 @@
|
|
|
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 { Constructor } from '@open-wc/dedupe-mixin';
|
|
6
|
+
import type { Constructor } from '@open-wc/dedupe-mixin';
|
|
7
7
|
|
|
8
8
|
export declare function ArrayDataProviderMixin<TItem, T extends Constructor<HTMLElement>>(
|
|
9
9
|
base: T,
|
|
10
|
-
):
|
|
10
|
+
): Constructor<ArrayDataProviderMixinClass<TItem>> & T;
|
|
11
11
|
|
|
12
12
|
export declare class ArrayDataProviderMixinClass<TItem> {
|
|
13
13
|
/**
|
|
@@ -3,8 +3,8 @@
|
|
|
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 { GridDefaultItem } from './vaadin-grid.js';
|
|
7
|
-
import { ColumnBaseMixinClass } from './vaadin-grid-column.js';
|
|
6
|
+
import type { GridDefaultItem } from './vaadin-grid.js';
|
|
7
|
+
import type { 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
|
|
@@ -156,7 +156,9 @@ class GridColumnGroup extends ColumnBaseMixin(PolymerElement) {
|
|
|
156
156
|
const _rootColumns = rootColumns.slice(0);
|
|
157
157
|
|
|
158
158
|
if (!order) {
|
|
159
|
-
_rootColumns.forEach((column) =>
|
|
159
|
+
_rootColumns.forEach((column) => {
|
|
160
|
+
column._order = 0;
|
|
161
|
+
});
|
|
160
162
|
return;
|
|
161
163
|
}
|
|
162
164
|
// The parent column order number cascades downwards to it's children
|
|
@@ -190,7 +192,9 @@ class GridColumnGroup extends ColumnBaseMixin(PolymerElement) {
|
|
|
190
192
|
return;
|
|
191
193
|
}
|
|
192
194
|
|
|
193
|
-
rootColumns.forEach((column) =>
|
|
195
|
+
rootColumns.forEach((column) => {
|
|
196
|
+
column._reorderStatus = reorderStatus;
|
|
197
|
+
});
|
|
194
198
|
}
|
|
195
199
|
|
|
196
200
|
/** @private */
|
|
@@ -199,7 +203,9 @@ class GridColumnGroup extends ColumnBaseMixin(PolymerElement) {
|
|
|
199
203
|
return;
|
|
200
204
|
}
|
|
201
205
|
|
|
202
|
-
rootColumns.forEach((column) =>
|
|
206
|
+
rootColumns.forEach((column) => {
|
|
207
|
+
column.resizable = resizable;
|
|
208
|
+
});
|
|
203
209
|
}
|
|
204
210
|
|
|
205
211
|
/** @private */
|
|
@@ -217,7 +223,10 @@ class GridColumnGroup extends ColumnBaseMixin(PolymerElement) {
|
|
|
217
223
|
|
|
218
224
|
if (this._visibleChildColumns.length > 0) {
|
|
219
225
|
const width = this._visibleChildColumns
|
|
220
|
-
.reduce((prev, curr) =>
|
|
226
|
+
.reduce((prev, curr) => {
|
|
227
|
+
prev += ` + ${(curr.width || '0px').replace('calc', '')}`;
|
|
228
|
+
return prev;
|
|
229
|
+
}, '')
|
|
221
230
|
.substring(3);
|
|
222
231
|
this._setWidth(`calc(${width})`);
|
|
223
232
|
} else {
|
|
@@ -235,7 +244,9 @@ class GridColumnGroup extends ColumnBaseMixin(PolymerElement) {
|
|
|
235
244
|
|
|
236
245
|
// Don’t propagate the default `false` value.
|
|
237
246
|
if (frozen !== false) {
|
|
238
|
-
Array.from(rootColumns).forEach((col) =>
|
|
247
|
+
Array.from(rootColumns).forEach((col) => {
|
|
248
|
+
col.frozen = frozen;
|
|
249
|
+
});
|
|
239
250
|
}
|
|
240
251
|
}
|
|
241
252
|
|
|
@@ -247,7 +258,9 @@ class GridColumnGroup extends ColumnBaseMixin(PolymerElement) {
|
|
|
247
258
|
|
|
248
259
|
// Don’t propagate the default `false` value.
|
|
249
260
|
if (frozenToEnd !== false) {
|
|
250
|
-
Array.from(rootColumns).forEach((col) =>
|
|
261
|
+
Array.from(rootColumns).forEach((col) => {
|
|
262
|
+
col.frozenToEnd = frozenToEnd;
|
|
263
|
+
});
|
|
251
264
|
}
|
|
252
265
|
}
|
|
253
266
|
|
|
@@ -276,7 +289,9 @@ class GridColumnGroup extends ColumnBaseMixin(PolymerElement) {
|
|
|
276
289
|
/** @private */
|
|
277
290
|
_synchronizeHidden() {
|
|
278
291
|
if (this._childColumns && !this._preventHiddenSynchronization) {
|
|
279
|
-
this._childColumns.forEach((column) =>
|
|
292
|
+
this._childColumns.forEach((column) => {
|
|
293
|
+
column.hidden = this.hidden;
|
|
294
|
+
});
|
|
280
295
|
}
|
|
281
296
|
}
|
|
282
297
|
|
|
@@ -3,11 +3,11 @@
|
|
|
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 { Constructor } from '@open-wc/dedupe-mixin';
|
|
6
|
+
import type { Constructor } from '@open-wc/dedupe-mixin';
|
|
7
7
|
|
|
8
8
|
export declare function ColumnReorderingMixin<T extends Constructor<HTMLElement>>(
|
|
9
9
|
base: T,
|
|
10
|
-
):
|
|
10
|
+
): Constructor<ColumnReorderingMixinClass> & T;
|
|
11
11
|
|
|
12
12
|
export declare class ColumnReorderingMixinClass {
|
|
13
13
|
/**
|
|
@@ -161,7 +161,23 @@ export const ColumnReorderingMixin = (superClass) =>
|
|
|
161
161
|
this._isSwapAllowed(this._draggedColumn, targetColumn) &&
|
|
162
162
|
this._isSwappableByPosition(targetColumn, e.detail.x)
|
|
163
163
|
) {
|
|
164
|
-
|
|
164
|
+
// Get the column header level of the target column (and the dragged column)
|
|
165
|
+
const columnTreeLevel = this._columnTree.findIndex((level) => level.includes(targetColumn));
|
|
166
|
+
// Get the columns on that level in visual order
|
|
167
|
+
const levelColumnsInOrder = this._getColumnsInOrder(columnTreeLevel);
|
|
168
|
+
|
|
169
|
+
// Index of the column being dragged
|
|
170
|
+
const startIndex = levelColumnsInOrder.indexOf(this._draggedColumn);
|
|
171
|
+
// Index of the column being dragged over
|
|
172
|
+
const endIndex = levelColumnsInOrder.indexOf(targetColumn);
|
|
173
|
+
|
|
174
|
+
// Direction of iteration
|
|
175
|
+
const direction = startIndex < endIndex ? 1 : -1;
|
|
176
|
+
|
|
177
|
+
// Iteratively swap all the columns from the dragged column to the target column
|
|
178
|
+
for (let i = startIndex; i !== endIndex; i += direction) {
|
|
179
|
+
this._swapColumnOrders(this._draggedColumn, levelColumnsInOrder[i + direction]);
|
|
180
|
+
}
|
|
165
181
|
}
|
|
166
182
|
|
|
167
183
|
this._updateGhostPosition(e.detail.x, this._touchDevice ? e.detail.y - 50 : e.detail.y);
|
|
@@ -192,15 +208,14 @@ export const ColumnReorderingMixin = (superClass) =>
|
|
|
192
208
|
}
|
|
193
209
|
|
|
194
210
|
/**
|
|
211
|
+
* Returns the columns (or column groups) on the specified header level in visual order.
|
|
212
|
+
* By default, the bottom level is used.
|
|
213
|
+
*
|
|
195
214
|
* @return {!Array<!GridColumn>}
|
|
196
215
|
* @protected
|
|
197
216
|
*/
|
|
198
|
-
_getColumnsInOrder() {
|
|
199
|
-
return this._columnTree
|
|
200
|
-
.slice(0)
|
|
201
|
-
.pop()
|
|
202
|
-
.filter((c) => !c.hidden)
|
|
203
|
-
.sort((b, a) => b._order - a._order);
|
|
217
|
+
_getColumnsInOrder(headerLevel = this._columnTree.length - 1) {
|
|
218
|
+
return this._columnTree[headerLevel].filter((c) => !c.hidden).sort((b, a) => b._order - a._order);
|
|
204
219
|
}
|
|
205
220
|
|
|
206
221
|
/**
|
|
@@ -263,7 +278,9 @@ export const ColumnReorderingMixin = (superClass) =>
|
|
|
263
278
|
'border',
|
|
264
279
|
'flex-direction',
|
|
265
280
|
'overflow',
|
|
266
|
-
].forEach((propertyName) =>
|
|
281
|
+
].forEach((propertyName) => {
|
|
282
|
+
ghost.style[propertyName] = style[propertyName];
|
|
283
|
+
});
|
|
267
284
|
return ghost;
|
|
268
285
|
}
|
|
269
286
|
|
|
@@ -274,7 +291,9 @@ export const ColumnReorderingMixin = (superClass) =>
|
|
|
274
291
|
}
|
|
275
292
|
|
|
276
293
|
// Reset all column orders
|
|
277
|
-
columnTree[0].forEach((column) =>
|
|
294
|
+
columnTree[0].forEach((column) => {
|
|
295
|
+
column._order = 0;
|
|
296
|
+
});
|
|
278
297
|
// Set order numbers to top-level columns
|
|
279
298
|
updateColumnOrders(columnTree[0], this._orderBaseScope, 0);
|
|
280
299
|
}
|
|
@@ -287,7 +306,9 @@ export const ColumnReorderingMixin = (superClass) =>
|
|
|
287
306
|
_setSiblingsReorderStatus(column, status) {
|
|
288
307
|
Array.from(column.parentNode.children)
|
|
289
308
|
.filter((child) => /column/.test(child.localName) && this._isSwapAllowed(child, column))
|
|
290
|
-
.forEach((sibling) =>
|
|
309
|
+
.forEach((sibling) => {
|
|
310
|
+
sibling._reorderStatus = status;
|
|
311
|
+
});
|
|
291
312
|
}
|
|
292
313
|
|
|
293
314
|
/** @protected */
|
|
@@ -3,8 +3,8 @@
|
|
|
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 { Constructor } from '@open-wc/dedupe-mixin';
|
|
7
|
-
import { GridDefaultItem, GridItemModel } from './vaadin-grid.js';
|
|
6
|
+
import type { Constructor } from '@open-wc/dedupe-mixin';
|
|
7
|
+
import type { GridDefaultItem, GridItemModel } from './vaadin-grid.js';
|
|
8
8
|
|
|
9
9
|
export type GridBodyRenderer<TItem> = (
|
|
10
10
|
root: HTMLElement,
|
|
@@ -12,13 +12,13 @@ export type GridBodyRenderer<TItem> = (
|
|
|
12
12
|
model: GridItemModel<TItem>,
|
|
13
13
|
) => void;
|
|
14
14
|
|
|
15
|
-
export type GridColumnTextAlign = '
|
|
15
|
+
export type GridColumnTextAlign = 'center' | 'end' | 'start' | null;
|
|
16
16
|
|
|
17
17
|
export type GridHeaderFooterRenderer<TItem> = (root: HTMLElement, column: GridColumn<TItem>) => void;
|
|
18
18
|
|
|
19
19
|
export declare function ColumnBaseMixin<TItem, T extends Constructor<HTMLElement>>(
|
|
20
20
|
base: T,
|
|
21
|
-
):
|
|
21
|
+
): Constructor<ColumnBaseMixinClass<TItem>> & T;
|
|
22
22
|
|
|
23
23
|
export declare class ColumnBaseMixinClass<TItem> {
|
|
24
24
|
/**
|
|
@@ -312,12 +312,16 @@ export const ColumnBaseMixin = (superClass) =>
|
|
|
312
312
|
this.parentElement._columnPropChanged('flexGrow');
|
|
313
313
|
}
|
|
314
314
|
|
|
315
|
-
this._allCells.forEach((cell) =>
|
|
315
|
+
this._allCells.forEach((cell) => {
|
|
316
|
+
cell.style.flexGrow = flexGrow;
|
|
317
|
+
});
|
|
316
318
|
}
|
|
317
319
|
|
|
318
320
|
/** @private */
|
|
319
321
|
_orderChanged(order) {
|
|
320
|
-
this._allCells.forEach((cell) =>
|
|
322
|
+
this._allCells.forEach((cell) => {
|
|
323
|
+
cell.style.order = order;
|
|
324
|
+
});
|
|
321
325
|
}
|
|
322
326
|
|
|
323
327
|
/** @private */
|
|
@@ -326,7 +330,9 @@ export const ColumnBaseMixin = (superClass) =>
|
|
|
326
330
|
this.parentElement._columnPropChanged('width');
|
|
327
331
|
}
|
|
328
332
|
|
|
329
|
-
this._allCells.forEach((cell) =>
|
|
333
|
+
this._allCells.forEach((cell) => {
|
|
334
|
+
cell.style.width = width;
|
|
335
|
+
});
|
|
330
336
|
}
|
|
331
337
|
|
|
332
338
|
/** @private */
|
|
@@ -3,7 +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 { Constructor } from '@open-wc/dedupe-mixin';
|
|
6
|
+
import type { Constructor } from '@open-wc/dedupe-mixin';
|
|
7
7
|
import { GridSorterDirection } from './vaadin-grid-sorter.js';
|
|
8
8
|
|
|
9
9
|
export { GridSorterDirection };
|
|
@@ -58,7 +58,7 @@ export declare class ItemCache<TItem> {
|
|
|
58
58
|
|
|
59
59
|
export declare function DataProviderMixin<TItem, T extends Constructor<HTMLElement>>(
|
|
60
60
|
base: T,
|
|
61
|
-
):
|
|
61
|
+
): Constructor<DataProviderMixinClass<TItem>> & T;
|
|
62
62
|
|
|
63
63
|
export declare class DataProviderMixinClass<TItem> {
|
|
64
64
|
/**
|
|
@@ -3,18 +3,18 @@
|
|
|
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 { Constructor } from '@open-wc/dedupe-mixin';
|
|
7
|
-
import { GridItemModel } from './vaadin-grid.js';
|
|
6
|
+
import type { Constructor } from '@open-wc/dedupe-mixin';
|
|
7
|
+
import type { GridItemModel } from './vaadin-grid.js';
|
|
8
8
|
|
|
9
9
|
export type GridDragAndDropFilter<TItem> = (model: GridItemModel<TItem>) => boolean;
|
|
10
10
|
|
|
11
|
-
export type GridDropLocation = 'above' | '
|
|
11
|
+
export type GridDropLocation = 'above' | 'below' | 'empty' | 'on-top';
|
|
12
12
|
|
|
13
|
-
export type GridDropMode = 'between' | 'on-
|
|
13
|
+
export type GridDropMode = 'between' | 'on-grid' | 'on-top-or-between' | 'on-top';
|
|
14
14
|
|
|
15
15
|
export declare function DragAndDropMixin<TItem, T extends Constructor<HTMLElement>>(
|
|
16
16
|
base: T,
|
|
17
|
-
):
|
|
17
|
+
): Constructor<DragAndDropMixinClass<TItem>> & T;
|
|
18
18
|
|
|
19
19
|
export declare class DragAndDropMixinClass<TItem> {
|
|
20
20
|
/**
|
|
@@ -280,7 +280,9 @@ export const DragAndDropMixin = (superClass) =>
|
|
|
280
280
|
if (scrollTopChanged) {
|
|
281
281
|
this.__dndAutoScrolling = true;
|
|
282
282
|
// Disallow more auto-scrolls within 20ms
|
|
283
|
-
setTimeout(() =>
|
|
283
|
+
setTimeout(() => {
|
|
284
|
+
this.__dndAutoScrolling = false;
|
|
285
|
+
}, 20);
|
|
284
286
|
return true;
|
|
285
287
|
}
|
|
286
288
|
}
|
|
@@ -3,11 +3,11 @@
|
|
|
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 { Constructor } from '@open-wc/dedupe-mixin';
|
|
7
|
-
import { GridColumn } from './vaadin-grid-column.js';
|
|
6
|
+
import type { Constructor } from '@open-wc/dedupe-mixin';
|
|
7
|
+
import type { GridColumn } from './vaadin-grid-column.js';
|
|
8
8
|
|
|
9
9
|
export interface GridEventContext<TItem> {
|
|
10
|
-
section?: 'body' | '
|
|
10
|
+
section?: 'body' | 'details' | 'footer' | 'header';
|
|
11
11
|
item?: TItem;
|
|
12
12
|
column?: GridColumn<TItem>;
|
|
13
13
|
index?: number;
|
|
@@ -19,7 +19,7 @@ export interface GridEventContext<TItem> {
|
|
|
19
19
|
|
|
20
20
|
export declare function EventContextMixin<TItem, T extends Constructor<HTMLElement>>(
|
|
21
21
|
base: T,
|
|
22
|
-
):
|
|
22
|
+
): Constructor<EventContextMixinClass<TItem>> & T;
|
|
23
23
|
|
|
24
24
|
export declare class EventContextMixinClass<TItem> {
|
|
25
25
|
/**
|
|
@@ -3,7 +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 { GridDefaultItem } from './vaadin-grid.js';
|
|
6
|
+
import type { GridDefaultItem } from './vaadin-grid.js';
|
|
7
7
|
import { GridColumn } from './vaadin-grid-column.js';
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -54,13 +54,13 @@ declare class GridFilter extends HTMLElement {
|
|
|
54
54
|
addEventListener<K extends keyof GridFilterEventMap>(
|
|
55
55
|
type: K,
|
|
56
56
|
listener: (this: GridFilter, ev: GridFilterEventMap[K]) => void,
|
|
57
|
-
options?:
|
|
57
|
+
options?: AddEventListenerOptions | boolean,
|
|
58
58
|
): void;
|
|
59
59
|
|
|
60
60
|
removeEventListener<K extends keyof GridFilterEventMap>(
|
|
61
61
|
type: K,
|
|
62
62
|
listener: (this: GridFilter, ev: GridFilterEventMap[K]) => void,
|
|
63
|
-
options?:
|
|
63
|
+
options?: EventListenerOptions | boolean,
|
|
64
64
|
): void;
|
|
65
65
|
}
|
|
66
66
|
|
|
@@ -95,7 +95,9 @@ export const KeyboardNavigationMixin = (superClass) =>
|
|
|
95
95
|
// Reset stored order when moving focus with mouse.
|
|
96
96
|
this._focusedColumnOrder = undefined;
|
|
97
97
|
});
|
|
98
|
-
this.addEventListener('mouseup', () =>
|
|
98
|
+
this.addEventListener('mouseup', () => {
|
|
99
|
+
this._isMousedown = false;
|
|
100
|
+
});
|
|
99
101
|
}
|
|
100
102
|
|
|
101
103
|
/** @private */
|
|
@@ -370,7 +372,7 @@ export const KeyboardNavigationMixin = (superClass) =>
|
|
|
370
372
|
* Focuses the target row after navigating by the given dy offset.
|
|
371
373
|
* If the row is not in the viewport, it is first scrolled to.
|
|
372
374
|
* @private
|
|
373
|
-
|
|
375
|
+
*/
|
|
374
376
|
_onRowNavigation(activeRow, dy) {
|
|
375
377
|
const { dstRow } = this.__navigateRows(dy, activeRow);
|
|
376
378
|
|
|
@@ -394,7 +396,7 @@ export const KeyboardNavigationMixin = (superClass) =>
|
|
|
394
396
|
* Also returns information whether the details cell should be the target on the target row.
|
|
395
397
|
* If the row is not in the viewport, it is first scrolled to.
|
|
396
398
|
* @private
|
|
397
|
-
|
|
399
|
+
*/
|
|
398
400
|
__navigateRows(dy, activeRow, activeCell) {
|
|
399
401
|
const currentRowIndex = this.__getIndexInGroup(activeRow, this._focusedItemIndex);
|
|
400
402
|
const activeRowGroup = activeRow.parentNode;
|
|
@@ -469,7 +471,7 @@ export const KeyboardNavigationMixin = (superClass) =>
|
|
|
469
471
|
* Focuses the target cell after navigating by the given dx and dy offset.
|
|
470
472
|
* If the cell is not in the viewport, it is first scrolled to.
|
|
471
473
|
* @private
|
|
472
|
-
|
|
474
|
+
*/
|
|
473
475
|
_onCellNavigation(activeCell, dx, dy) {
|
|
474
476
|
const activeRow = activeCell.parentNode;
|
|
475
477
|
const { dstRow, dstIsRowDetails } = this.__navigateRows(dy, activeRow, activeCell);
|
|
@@ -746,10 +748,11 @@ export const KeyboardNavigationMixin = (superClass) =>
|
|
|
746
748
|
this._detectFocusedItemIndex(e);
|
|
747
749
|
}
|
|
748
750
|
|
|
749
|
-
/**
|
|
751
|
+
/**
|
|
750
752
|
* Enables interaction mode if a cells descendant receives focus or keyboard
|
|
751
753
|
* input. Disables it if the event is not related to cell content.
|
|
752
754
|
* @param {!KeyboardEvent|!FocusEvent} e
|
|
755
|
+
* @private
|
|
753
756
|
*/
|
|
754
757
|
_detectInteracting(e) {
|
|
755
758
|
const isInteracting = e.composedPath().some((el) => el.localName === 'vaadin-grid-cell-content');
|
|
@@ -765,11 +768,12 @@ export const KeyboardNavigationMixin = (superClass) =>
|
|
|
765
768
|
}
|
|
766
769
|
}
|
|
767
770
|
|
|
768
|
-
/**
|
|
771
|
+
/**
|
|
769
772
|
* Enables or disables the focus target of the containing section of the
|
|
770
773
|
* grid from receiving focus, based on whether the user is interacting with
|
|
771
774
|
* that section of the grid.
|
|
772
775
|
* @param {HTMLElement} focusTarget
|
|
776
|
+
* @private
|
|
773
777
|
*/
|
|
774
778
|
_updateGridSectionFocusTarget(focusTarget) {
|
|
775
779
|
if (!focusTarget) {
|
|
@@ -3,8 +3,8 @@
|
|
|
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 { Constructor } from '@open-wc/dedupe-mixin';
|
|
7
|
-
import { Grid, GridItemModel } from './vaadin-grid.js';
|
|
6
|
+
import type { Constructor } from '@open-wc/dedupe-mixin';
|
|
7
|
+
import type { Grid, GridItemModel } from './vaadin-grid.js';
|
|
8
8
|
|
|
9
9
|
export type GridRowDetailsRenderer<TItem> = (
|
|
10
10
|
root: HTMLElement,
|
|
@@ -14,7 +14,7 @@ export type GridRowDetailsRenderer<TItem> = (
|
|
|
14
14
|
|
|
15
15
|
export declare function RowDetailsMixin<TItem, T extends Constructor<HTMLElement>>(
|
|
16
16
|
base: T,
|
|
17
|
-
):
|
|
17
|
+
): Constructor<RowDetailsMixinClass<TItem>> & T;
|
|
18
18
|
|
|
19
19
|
export declare class RowDetailsMixinClass<TItem> {
|
|
20
20
|
/**
|
|
@@ -3,9 +3,9 @@
|
|
|
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 { Constructor } from '@open-wc/dedupe-mixin';
|
|
6
|
+
import type { Constructor } from '@open-wc/dedupe-mixin';
|
|
7
7
|
|
|
8
|
-
export declare function ScrollMixin<T extends Constructor<HTMLElement>>(base: T):
|
|
8
|
+
export declare function ScrollMixin<T extends Constructor<HTMLElement>>(base: T): Constructor<ScrollMixinClass> & T;
|
|
9
9
|
|
|
10
10
|
export declare class ScrollMixinClass {
|
|
11
11
|
/**
|
|
@@ -69,7 +69,9 @@ export const ScrollMixin = (superClass) =>
|
|
|
69
69
|
const itemsIndex = e.composedPath().indexOf(this.$.items);
|
|
70
70
|
this._rowWithFocusedElement = e.composedPath()[itemsIndex - 1];
|
|
71
71
|
});
|
|
72
|
-
this.$.items.addEventListener('focusout', () =>
|
|
72
|
+
this.$.items.addEventListener('focusout', () => {
|
|
73
|
+
this._rowWithFocusedElement = undefined;
|
|
74
|
+
});
|
|
73
75
|
|
|
74
76
|
this.$.table.addEventListener('scroll', () => this._afterScroll());
|
|
75
77
|
}
|