@vaadin/grid 23.0.0-alpha1 → 23.0.0-alpha5
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 +10 -9
- package/src/all-imports.js +1 -1
- package/src/array-data-provider.js +2 -3
- package/src/vaadin-grid-a11y-mixin.js +1 -1
- package/src/vaadin-grid-active-item-mixin.d.ts +1 -1
- package/src/vaadin-grid-active-item-mixin.js +1 -1
- package/src/vaadin-grid-array-data-provider-mixin.d.ts +1 -1
- package/src/vaadin-grid-array-data-provider-mixin.js +1 -1
- package/src/vaadin-grid-column-group.d.ts +1 -1
- package/src/vaadin-grid-column-group.js +2 -2
- package/src/vaadin-grid-column-reordering-mixin.d.ts +1 -1
- package/src/vaadin-grid-column-reordering-mixin.js +5 -8
- package/src/vaadin-grid-column-resizing-mixin.js +3 -4
- package/src/vaadin-grid-column.d.ts +1 -1
- package/src/vaadin-grid-column.js +25 -14
- package/src/vaadin-grid-data-provider-mixin.d.ts +1 -1
- package/src/vaadin-grid-data-provider-mixin.js +4 -6
- package/src/vaadin-grid-drag-and-drop-mixin.d.ts +1 -1
- package/src/vaadin-grid-drag-and-drop-mixin.js +1 -1
- package/src/vaadin-grid-dynamic-columns-mixin.js +6 -9
- package/src/vaadin-grid-event-context-mixin.d.ts +1 -1
- package/src/vaadin-grid-event-context-mixin.js +1 -1
- package/src/vaadin-grid-filter-column.d.ts +1 -1
- package/src/vaadin-grid-filter-column.js +1 -1
- package/src/vaadin-grid-filter-mixin.js +1 -1
- package/src/vaadin-grid-filter.d.ts +1 -1
- package/src/vaadin-grid-filter.js +1 -1
- package/src/vaadin-grid-helpers.js +3 -3
- package/src/vaadin-grid-keyboard-navigation-mixin.js +77 -70
- package/src/vaadin-grid-row-details-mixin.d.ts +1 -1
- package/src/vaadin-grid-row-details-mixin.js +1 -2
- package/src/vaadin-grid-scroll-mixin.d.ts +1 -1
- package/src/vaadin-grid-scroll-mixin.js +6 -6
- package/src/vaadin-grid-selection-column.d.ts +1 -1
- package/src/vaadin-grid-selection-column.js +2 -2
- package/src/vaadin-grid-selection-mixin.d.ts +1 -1
- package/src/vaadin-grid-selection-mixin.js +1 -1
- 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 +1 -1
- package/src/vaadin-grid-sort-mixin.js +8 -10
- package/src/vaadin-grid-sorter.d.ts +1 -1
- package/src/vaadin-grid-sorter.js +1 -1
- package/src/vaadin-grid-styles.js +1 -1
- package/src/vaadin-grid-styling-mixin.d.ts +1 -1
- package/src/vaadin-grid-styling-mixin.js +1 -1
- 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.d.ts +1 -1
- package/src/vaadin-grid-tree-toggle.js +1 -1
- package/src/vaadin-grid.d.ts +19 -27
- package/src/vaadin-grid.js +34 -35
- package/theme/lumo/vaadin-grid-styles.js +4 -0
- package/theme/material/vaadin-grid-styles.js +4 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/grid",
|
|
3
|
-
"version": "23.0.0-
|
|
3
|
+
"version": "23.0.0-alpha5",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
},
|
|
19
19
|
"main": "vaadin-grid.js",
|
|
20
20
|
"module": "vaadin-grid.js",
|
|
21
|
+
"type": "module",
|
|
21
22
|
"files": [
|
|
22
23
|
"all-imports.js",
|
|
23
24
|
"src",
|
|
@@ -40,19 +41,19 @@
|
|
|
40
41
|
"dependencies": {
|
|
41
42
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
42
43
|
"@polymer/polymer": "^3.0.0",
|
|
43
|
-
"@vaadin/checkbox": "23.0.0-
|
|
44
|
-
"@vaadin/component-base": "23.0.0-
|
|
45
|
-
"@vaadin/text-field": "23.0.0-
|
|
46
|
-
"@vaadin/vaadin-lumo-styles": "23.0.0-
|
|
47
|
-
"@vaadin/vaadin-material-styles": "23.0.0-
|
|
48
|
-
"@vaadin/vaadin-themable-mixin": "23.0.0-
|
|
44
|
+
"@vaadin/checkbox": "23.0.0-alpha5",
|
|
45
|
+
"@vaadin/component-base": "23.0.0-alpha5",
|
|
46
|
+
"@vaadin/text-field": "23.0.0-alpha5",
|
|
47
|
+
"@vaadin/vaadin-lumo-styles": "23.0.0-alpha5",
|
|
48
|
+
"@vaadin/vaadin-material-styles": "23.0.0-alpha5",
|
|
49
|
+
"@vaadin/vaadin-themable-mixin": "23.0.0-alpha5"
|
|
49
50
|
},
|
|
50
51
|
"devDependencies": {
|
|
51
52
|
"@esm-bundle/chai": "^4.3.4",
|
|
52
|
-
"@vaadin/polymer-legacy-adapter": "23.0.0-
|
|
53
|
+
"@vaadin/polymer-legacy-adapter": "23.0.0-alpha5",
|
|
53
54
|
"@vaadin/testing-helpers": "^0.3.2",
|
|
54
55
|
"lit": "^2.0.0",
|
|
55
56
|
"sinon": "^9.2.0"
|
|
56
57
|
},
|
|
57
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "74f9294964eb8552d96578c14af6ad214f5257bc"
|
|
58
59
|
}
|
package/src/all-imports.js
CHANGED
|
@@ -22,7 +22,7 @@ function checkPaths(arrayToCheck, action, items) {
|
|
|
22
22
|
|
|
23
23
|
let result = true;
|
|
24
24
|
|
|
25
|
-
for (
|
|
25
|
+
for (const i in arrayToCheck) {
|
|
26
26
|
const path = arrayToCheck[i].path;
|
|
27
27
|
|
|
28
28
|
// skip simple paths
|
|
@@ -73,9 +73,8 @@ function normalizeEmptyValue(value) {
|
|
|
73
73
|
return '';
|
|
74
74
|
} else if (isNaN(value)) {
|
|
75
75
|
return value.toString();
|
|
76
|
-
} else {
|
|
77
|
-
return value;
|
|
78
76
|
}
|
|
77
|
+
return value;
|
|
79
78
|
}
|
|
80
79
|
|
|
81
80
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c)
|
|
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
6
|
import { createArrayDataProvider } from './array-data-provider.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c)
|
|
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
6
|
import { FlattenedNodesObserver } from '@polymer/polymer/lib/utils/flattened-nodes-observer.js';
|
|
@@ -162,7 +162,7 @@ class GridColumnGroup extends ColumnBaseMixin(PolymerElement) {
|
|
|
162
162
|
const childCountDigits = ~~(Math.log(rootColumns.length) / Math.LN10) + 1;
|
|
163
163
|
|
|
164
164
|
// Final scope for the child columns needs to mind both factors.
|
|
165
|
-
const scope =
|
|
165
|
+
const scope = 10 ** (trailingZeros - childCountDigits);
|
|
166
166
|
|
|
167
167
|
if (_rootColumns[0] && _rootColumns[0]._order) {
|
|
168
168
|
_rootColumns.sort((a, b) => a._order - b._order);
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c)
|
|
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 {
|
|
7
|
-
import { addListener } from '@polymer/polymer/lib/utils/gestures.js';
|
|
6
|
+
import { addListener } from '@vaadin/component-base/src/gestures.js';
|
|
8
7
|
import { updateColumnOrders } from './vaadin-grid-helpers.js';
|
|
9
8
|
|
|
10
9
|
/**
|
|
11
10
|
* @polymerMixin
|
|
12
11
|
*/
|
|
13
12
|
export const ColumnReorderingMixin = (superClass) =>
|
|
14
|
-
class ColumnReorderingMixin extends
|
|
13
|
+
class ColumnReorderingMixin extends superClass {
|
|
15
14
|
static get properties() {
|
|
16
15
|
return {
|
|
17
16
|
/**
|
|
@@ -339,9 +338,8 @@ export const ColumnReorderingMixin = (superClass) =>
|
|
|
339
338
|
const targetRect = targetCell.getBoundingClientRect();
|
|
340
339
|
if (targetRect.left > sourceCellRect.left) {
|
|
341
340
|
return clientX > targetRect.right - sourceCellRect.width;
|
|
342
|
-
} else {
|
|
343
|
-
return clientX < targetRect.left + sourceCellRect.width;
|
|
344
341
|
}
|
|
342
|
+
return clientX < targetRect.left + sourceCellRect.width;
|
|
345
343
|
}
|
|
346
344
|
|
|
347
345
|
/**
|
|
@@ -371,9 +369,8 @@ export const ColumnReorderingMixin = (superClass) =>
|
|
|
371
369
|
}
|
|
372
370
|
if (candidate.parentElement === draggedColumn.parentElement) {
|
|
373
371
|
return candidate;
|
|
374
|
-
} else {
|
|
375
|
-
return targetCell._column;
|
|
376
372
|
}
|
|
373
|
+
return targetCell._column;
|
|
377
374
|
}
|
|
378
375
|
}
|
|
379
376
|
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c)
|
|
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 {
|
|
7
|
-
import { addListener } from '@polymer/polymer/lib/utils/gestures.js';
|
|
6
|
+
import { addListener } from '@vaadin/component-base/src/gestures.js';
|
|
8
7
|
|
|
9
8
|
/**
|
|
10
9
|
* @polymerMixin
|
|
11
10
|
*/
|
|
12
11
|
export const ColumnResizingMixin = (superClass) =>
|
|
13
|
-
class ColumnResizingMixin extends
|
|
12
|
+
class ColumnResizingMixin extends superClass {
|
|
14
13
|
ready() {
|
|
15
14
|
super.ready();
|
|
16
15
|
const scroller = this.$.scroller;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c)
|
|
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
6
|
import { PolymerElement } from '@polymer/polymer/polymer-element.js';
|
|
@@ -30,9 +30,8 @@ export const ColumnBaseMixin = (superClass) =>
|
|
|
30
30
|
const parent = this.parentNode;
|
|
31
31
|
if (parent && parent.localName === 'vaadin-grid-column-group') {
|
|
32
32
|
return parent.resizable || false;
|
|
33
|
-
} else {
|
|
34
|
-
return false;
|
|
35
33
|
}
|
|
34
|
+
return false;
|
|
36
35
|
}
|
|
37
36
|
},
|
|
38
37
|
|
|
@@ -197,7 +196,9 @@ export const ColumnBaseMixin = (superClass) =>
|
|
|
197
196
|
// Adds the column cells to the grid after the column is attached
|
|
198
197
|
requestAnimationFrame(() => {
|
|
199
198
|
// Skip if the column has been detached
|
|
200
|
-
if (!this._grid)
|
|
199
|
+
if (!this._grid) {
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
201
202
|
|
|
202
203
|
this._allCells.forEach((cell) => {
|
|
203
204
|
if (!cell._content.parentNode) {
|
|
@@ -214,7 +215,9 @@ export const ColumnBaseMixin = (superClass) =>
|
|
|
214
215
|
// Removes the column cells from the grid after the column is detached
|
|
215
216
|
requestAnimationFrame(() => {
|
|
216
217
|
// Skip if the column has been attached again
|
|
217
|
-
if (this._grid)
|
|
218
|
+
if (this._grid) {
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
218
221
|
|
|
219
222
|
this._allCells.forEach((cell) => {
|
|
220
223
|
if (cell._content.parentNode) {
|
|
@@ -380,12 +383,10 @@ export const ColumnBaseMixin = (superClass) =>
|
|
|
380
383
|
} else if (textAlign === 'end') {
|
|
381
384
|
textAlignFallback = 'right';
|
|
382
385
|
}
|
|
383
|
-
} else {
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
textAlignFallback = 'left';
|
|
388
|
-
}
|
|
386
|
+
} else if (textAlign === 'start') {
|
|
387
|
+
textAlignFallback = 'right';
|
|
388
|
+
} else if (textAlign === 'end') {
|
|
389
|
+
textAlignFallback = 'left';
|
|
389
390
|
}
|
|
390
391
|
|
|
391
392
|
this._allCells.forEach((cell) => {
|
|
@@ -448,9 +449,15 @@ export const ColumnBaseMixin = (superClass) =>
|
|
|
448
449
|
}
|
|
449
450
|
|
|
450
451
|
cells.forEach((cell) => {
|
|
452
|
+
if (!cell.parentElement) {
|
|
453
|
+
return;
|
|
454
|
+
}
|
|
455
|
+
|
|
451
456
|
const model = this._grid.__getRowModel(cell.parentElement);
|
|
452
457
|
|
|
453
|
-
if (!renderer)
|
|
458
|
+
if (!renderer) {
|
|
459
|
+
return;
|
|
460
|
+
}
|
|
454
461
|
|
|
455
462
|
if (cell._renderer !== renderer) {
|
|
456
463
|
this._clearCellContent(cell);
|
|
@@ -558,7 +565,9 @@ export const ColumnBaseMixin = (superClass) =>
|
|
|
558
565
|
* @protected
|
|
559
566
|
*/
|
|
560
567
|
_defaultHeaderRenderer() {
|
|
561
|
-
if (!this.path)
|
|
568
|
+
if (!this.path) {
|
|
569
|
+
return;
|
|
570
|
+
}
|
|
562
571
|
|
|
563
572
|
this.__setTextContent(this._headerCell._content, this._generateHeader(this.path));
|
|
564
573
|
}
|
|
@@ -570,7 +579,9 @@ export const ColumnBaseMixin = (superClass) =>
|
|
|
570
579
|
* @protected
|
|
571
580
|
*/
|
|
572
581
|
_defaultRenderer(root, _owner, { item }) {
|
|
573
|
-
if (!this.path)
|
|
582
|
+
if (!this.path) {
|
|
583
|
+
return;
|
|
584
|
+
}
|
|
574
585
|
|
|
575
586
|
this.__setTextContent(root, this.get(this.path, item));
|
|
576
587
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c)
|
|
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
6
|
import { timeOut } from '@vaadin/component-base/src/async.js';
|
|
@@ -324,7 +324,7 @@ export const DataProviderMixin = (superClass) =>
|
|
|
324
324
|
let level = 0;
|
|
325
325
|
while (cache.parentCache) {
|
|
326
326
|
cache = cache.parentCache;
|
|
327
|
-
level
|
|
327
|
+
level += 1;
|
|
328
328
|
}
|
|
329
329
|
return level;
|
|
330
330
|
}
|
|
@@ -350,10 +350,8 @@ export const DataProviderMixin = (superClass) =>
|
|
|
350
350
|
this.dataProvider(params, (items, size) => {
|
|
351
351
|
if (size !== undefined) {
|
|
352
352
|
cache.size = size;
|
|
353
|
-
} else {
|
|
354
|
-
|
|
355
|
-
cache.size = items.length;
|
|
356
|
-
}
|
|
353
|
+
} else if (params.parentItem) {
|
|
354
|
+
cache.size = items.length;
|
|
357
355
|
}
|
|
358
356
|
|
|
359
357
|
const currentItems = Array.from(this.$.items.children).map((row) => row._item);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c)
|
|
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
6
|
import { FlattenedNodesObserver } from '@polymer/polymer/lib/utils/flattened-nodes-observer.js';
|
|
@@ -54,9 +54,8 @@ export const DynamicColumnsMixin = (superClass) =>
|
|
|
54
54
|
.map((col) => {
|
|
55
55
|
if (col.localName === 'vaadin-grid-column-group') {
|
|
56
56
|
return this._getChildColumns(col);
|
|
57
|
-
} else {
|
|
58
|
-
return [col];
|
|
59
57
|
}
|
|
58
|
+
return [col];
|
|
60
59
|
})
|
|
61
60
|
.reduce((prev, curr) => {
|
|
62
61
|
return prev.concat(curr);
|
|
@@ -66,14 +65,12 @@ export const DynamicColumnsMixin = (superClass) =>
|
|
|
66
65
|
/** @private */
|
|
67
66
|
_getColumnTree() {
|
|
68
67
|
const rootColumns = FlattenedNodesObserver.getFlattenedNodes(this).filter(this._isColumnElement);
|
|
69
|
-
const columnTree = [];
|
|
68
|
+
const columnTree = [rootColumns];
|
|
70
69
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
if (!this._hasColumnGroups(c)) {
|
|
74
|
-
break;
|
|
75
|
-
}
|
|
70
|
+
let c = rootColumns;
|
|
71
|
+
while (this._hasColumnGroups(c)) {
|
|
76
72
|
c = this._flattenColumnGroups(c);
|
|
73
|
+
columnTree.push(c);
|
|
77
74
|
}
|
|
78
75
|
|
|
79
76
|
return columnTree;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c)
|
|
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
6
|
|
|
@@ -15,9 +15,9 @@ export function updateColumnOrders(columns, scope, baseOrder) {
|
|
|
15
15
|
// avoid multiples of 10 because they introduce and extra zero and
|
|
16
16
|
// causes the underlying calculations for child order goes wrong
|
|
17
17
|
if (c % 10 === 0) {
|
|
18
|
-
c
|
|
18
|
+
c += 1;
|
|
19
19
|
}
|
|
20
20
|
column._order = baseOrder + c * scope;
|
|
21
|
-
c
|
|
21
|
+
c += 1;
|
|
22
22
|
});
|
|
23
23
|
}
|