@vaadin/grid 23.2.0-dev.8a7678b70 → 23.3.0-alpha1
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 +39 -20
- package/src/vaadin-grid-column-resizing-mixin.js +1 -1
- 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 +4 -2
- package/src/vaadin-grid-event-context-mixin.d.ts +4 -4
- package/src/vaadin-grid-event-context-mixin.js +2 -2
- 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 +20 -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 +55 -8
- package/theme/lumo/vaadin-grid-styles.js +0 -10
- package/web-types.json +2176 -0
- package/web-types.lit.json +972 -0
|
@@ -3,6 +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 { isKeyboardActive } from '@vaadin/component-base/src/focus-utils.js';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* @polymerMixin
|
|
@@ -95,7 +96,9 @@ export const KeyboardNavigationMixin = (superClass) =>
|
|
|
95
96
|
// Reset stored order when moving focus with mouse.
|
|
96
97
|
this._focusedColumnOrder = undefined;
|
|
97
98
|
});
|
|
98
|
-
this.addEventListener('mouseup', () =>
|
|
99
|
+
this.addEventListener('mouseup', () => {
|
|
100
|
+
this._isMousedown = false;
|
|
101
|
+
});
|
|
99
102
|
}
|
|
100
103
|
|
|
101
104
|
/** @private */
|
|
@@ -370,7 +373,7 @@ export const KeyboardNavigationMixin = (superClass) =>
|
|
|
370
373
|
* Focuses the target row after navigating by the given dy offset.
|
|
371
374
|
* If the row is not in the viewport, it is first scrolled to.
|
|
372
375
|
* @private
|
|
373
|
-
|
|
376
|
+
*/
|
|
374
377
|
_onRowNavigation(activeRow, dy) {
|
|
375
378
|
const { dstRow } = this.__navigateRows(dy, activeRow);
|
|
376
379
|
|
|
@@ -394,7 +397,7 @@ export const KeyboardNavigationMixin = (superClass) =>
|
|
|
394
397
|
* Also returns information whether the details cell should be the target on the target row.
|
|
395
398
|
* If the row is not in the viewport, it is first scrolled to.
|
|
396
399
|
* @private
|
|
397
|
-
|
|
400
|
+
*/
|
|
398
401
|
__navigateRows(dy, activeRow, activeCell) {
|
|
399
402
|
const currentRowIndex = this.__getIndexInGroup(activeRow, this._focusedItemIndex);
|
|
400
403
|
const activeRowGroup = activeRow.parentNode;
|
|
@@ -469,7 +472,7 @@ export const KeyboardNavigationMixin = (superClass) =>
|
|
|
469
472
|
* Focuses the target cell after navigating by the given dx and dy offset.
|
|
470
473
|
* If the cell is not in the viewport, it is first scrolled to.
|
|
471
474
|
* @private
|
|
472
|
-
|
|
475
|
+
*/
|
|
473
476
|
_onCellNavigation(activeCell, dx, dy) {
|
|
474
477
|
const activeRow = activeCell.parentNode;
|
|
475
478
|
const { dstRow, dstIsRowDetails } = this.__navigateRows(dy, activeRow, activeCell);
|
|
@@ -582,6 +585,10 @@ export const KeyboardNavigationMixin = (superClass) =>
|
|
|
582
585
|
this.toggleAttribute('navigating', true);
|
|
583
586
|
}
|
|
584
587
|
}
|
|
588
|
+
|
|
589
|
+
if (key === 'Escape') {
|
|
590
|
+
this._hideTooltip();
|
|
591
|
+
}
|
|
585
592
|
}
|
|
586
593
|
|
|
587
594
|
/** @private */
|
|
@@ -719,6 +726,7 @@ export const KeyboardNavigationMixin = (superClass) =>
|
|
|
719
726
|
_onFocusOut(e) {
|
|
720
727
|
this.toggleAttribute('navigating', false);
|
|
721
728
|
this._detectInteracting(e);
|
|
729
|
+
this._hideTooltip();
|
|
722
730
|
}
|
|
723
731
|
|
|
724
732
|
/** @private */
|
|
@@ -740,16 +748,21 @@ export const KeyboardNavigationMixin = (superClass) =>
|
|
|
740
748
|
// Fire a public event for cell.
|
|
741
749
|
const context = this.getEventContext(e);
|
|
742
750
|
cell.dispatchEvent(new CustomEvent('cell-focus', { bubbles: true, composed: true, detail: { context } }));
|
|
751
|
+
|
|
752
|
+
if (isKeyboardActive() && e.target === cell) {
|
|
753
|
+
this._showTooltip(e);
|
|
754
|
+
}
|
|
743
755
|
}
|
|
744
756
|
}
|
|
745
757
|
|
|
746
758
|
this._detectFocusedItemIndex(e);
|
|
747
759
|
}
|
|
748
760
|
|
|
749
|
-
/**
|
|
761
|
+
/**
|
|
750
762
|
* Enables interaction mode if a cells descendant receives focus or keyboard
|
|
751
763
|
* input. Disables it if the event is not related to cell content.
|
|
752
764
|
* @param {!KeyboardEvent|!FocusEvent} e
|
|
765
|
+
* @private
|
|
753
766
|
*/
|
|
754
767
|
_detectInteracting(e) {
|
|
755
768
|
const isInteracting = e.composedPath().some((el) => el.localName === 'vaadin-grid-cell-content');
|
|
@@ -765,11 +778,12 @@ export const KeyboardNavigationMixin = (superClass) =>
|
|
|
765
778
|
}
|
|
766
779
|
}
|
|
767
780
|
|
|
768
|
-
/**
|
|
781
|
+
/**
|
|
769
782
|
* Enables or disables the focus target of the containing section of the
|
|
770
783
|
* grid from receiving focus, based on whether the user is interacting with
|
|
771
784
|
* that section of the grid.
|
|
772
785
|
* @param {HTMLElement} focusTarget
|
|
786
|
+
* @private
|
|
773
787
|
*/
|
|
774
788
|
_updateGridSectionFocusTarget(focusTarget) {
|
|
775
789
|
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
|
}
|
|
@@ -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
|
/**
|
|
@@ -57,13 +57,13 @@ declare class GridSelectionColumn<TItem = GridDefaultItem> extends GridColumn<TI
|
|
|
57
57
|
addEventListener<K extends keyof GridSelectionColumnEventMap>(
|
|
58
58
|
type: K,
|
|
59
59
|
listener: (this: GridSelectionColumn<TItem>, ev: GridSelectionColumnEventMap[K]) => void,
|
|
60
|
-
options?:
|
|
60
|
+
options?: AddEventListenerOptions | boolean,
|
|
61
61
|
): void;
|
|
62
62
|
|
|
63
63
|
removeEventListener<K extends keyof GridSelectionColumnEventMap>(
|
|
64
64
|
type: K,
|
|
65
65
|
listener: (this: GridSelectionColumn<TItem>, ev: GridSelectionColumnEventMap[K]) => void,
|
|
66
|
-
options?:
|
|
66
|
+
options?: EventListenerOptions | boolean,
|
|
67
67
|
): void;
|
|
68
68
|
}
|
|
69
69
|
|
|
@@ -184,8 +184,10 @@ class GridSelectionColumn extends GridColumn {
|
|
|
184
184
|
return;
|
|
185
185
|
}
|
|
186
186
|
|
|
187
|
-
if (selectAll &&
|
|
188
|
-
this.__withFilteredItemsArray((items) =>
|
|
187
|
+
if (selectAll && this.__hasArrayDataProvider()) {
|
|
188
|
+
this.__withFilteredItemsArray((items) => {
|
|
189
|
+
this._grid.selectedItems = items;
|
|
190
|
+
});
|
|
189
191
|
} else {
|
|
190
192
|
this._grid.selectedItems = [];
|
|
191
193
|
}
|
|
@@ -254,10 +256,15 @@ class GridSelectionColumn extends GridColumn {
|
|
|
254
256
|
this.__previousActiveItem = activeItem;
|
|
255
257
|
}
|
|
256
258
|
|
|
259
|
+
/** @private */
|
|
260
|
+
__hasArrayDataProvider() {
|
|
261
|
+
return Array.isArray(this._grid.items) && !!this._grid.dataProvider;
|
|
262
|
+
}
|
|
263
|
+
|
|
257
264
|
/** @private */
|
|
258
265
|
__onSelectedItemsChanged() {
|
|
259
266
|
this._selectAllChangeLock = true;
|
|
260
|
-
if (
|
|
267
|
+
if (this.__hasArrayDataProvider()) {
|
|
261
268
|
this.__withFilteredItemsArray((items) => {
|
|
262
269
|
if (!this._grid.selectedItems.length) {
|
|
263
270
|
this.selectAll = false;
|
|
@@ -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 SelectionMixin<TItem, T extends Constructor<HTMLElement>>(
|
|
9
9
|
base: T,
|
|
10
|
-
):
|
|
10
|
+
): Constructor<SelectionMixinClass<TItem>> & T;
|
|
11
11
|
|
|
12
12
|
export declare class SelectionMixinClass<TItem> {
|
|
13
13
|
/**
|
|
@@ -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 { GridDefaultItem } from './vaadin-grid.js';
|
|
6
|
+
import type { GridDefaultItem } from './vaadin-grid.js';
|
|
7
7
|
import { GridColumn } from './vaadin-grid-column.js';
|
|
8
|
-
import { GridSorterDirection } from './vaadin-grid-sorter.js';
|
|
8
|
+
import type { GridSorterDirection } from './vaadin-grid-sorter.js';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Fired when the `direction` property changes.
|
|
@@ -49,13 +49,13 @@ declare class GridSortColumn<TItem = GridDefaultItem> extends GridColumn<TItem>
|
|
|
49
49
|
addEventListener<K extends keyof GridSortColumnEventMap>(
|
|
50
50
|
type: K,
|
|
51
51
|
listener: (this: GridSortColumn<TItem>, ev: GridSortColumnEventMap[K]) => void,
|
|
52
|
-
options?:
|
|
52
|
+
options?: AddEventListenerOptions | boolean,
|
|
53
53
|
): void;
|
|
54
54
|
|
|
55
55
|
removeEventListener<K extends keyof GridSortColumnEventMap>(
|
|
56
56
|
type: K,
|
|
57
57
|
listener: (this: GridSortColumn<TItem>, ev: GridSortColumnEventMap[K]) => void,
|
|
58
|
-
options?:
|
|
58
|
+
options?: EventListenerOptions | boolean,
|
|
59
59
|
): void;
|
|
60
60
|
}
|
|
61
61
|
|
|
@@ -3,14 +3,37 @@
|
|
|
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 SortMixin<T extends Constructor<HTMLElement>>(base: T):
|
|
8
|
+
export declare function SortMixin<T extends Constructor<HTMLElement>>(base: T): Constructor<SortMixinClass> & T;
|
|
9
9
|
|
|
10
10
|
export declare class SortMixinClass {
|
|
11
|
+
/**
|
|
12
|
+
* Sets the default multi-sort priority to use for all grid instances.
|
|
13
|
+
* This method should be called before creating any grid instances.
|
|
14
|
+
* Changing this setting does not affect the default for existing grids.
|
|
15
|
+
*/
|
|
16
|
+
static setDefaultMultiSortPriority(priority: 'append' | 'prepend'): void;
|
|
17
|
+
|
|
11
18
|
/**
|
|
12
19
|
* When `true`, all `<vaadin-grid-sorter>` are applied for sorting.
|
|
13
20
|
* @attr {boolean} multi-sort
|
|
14
21
|
*/
|
|
15
22
|
multiSort: boolean;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Controls how columns are added to the sort order when using multi-sort.
|
|
26
|
+
* The sort order is visually indicated by numbers in grid sorters placed in column headers.
|
|
27
|
+
*
|
|
28
|
+
* By default, whenever an unsorted column is sorted, or the sort-direction of a column is
|
|
29
|
+
* changed, that column gets sort priority 1, thus affecting the priority for all the other
|
|
30
|
+
* sorted columns. This is identical to using `multi-sort-priority="prepend"`.
|
|
31
|
+
*
|
|
32
|
+
* Using this property allows to change this behavior so that sorting an unsorted column
|
|
33
|
+
* would add it to the "end" of the sort, and changing column's sort direction would retain
|
|
34
|
+
* it's previous priority. To set this, use `multi-sort-priority="append"`.
|
|
35
|
+
*
|
|
36
|
+
* @attr {string} multi-sort-priority
|
|
37
|
+
*/
|
|
38
|
+
multiSortPriority: 'append' | 'prepend';
|
|
16
39
|
}
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
let defaultMultiSortPriority = 'prepend';
|
|
8
|
+
|
|
7
9
|
/**
|
|
8
10
|
* @polymerMixin
|
|
9
11
|
*/
|
|
@@ -21,6 +23,25 @@ export const SortMixin = (superClass) =>
|
|
|
21
23
|
value: false,
|
|
22
24
|
},
|
|
23
25
|
|
|
26
|
+
/**
|
|
27
|
+
* Controls how columns are added to the sort order when using multi-sort.
|
|
28
|
+
* The sort order is visually indicated by numbers in grid sorters placed in column headers.
|
|
29
|
+
*
|
|
30
|
+
* By default, whenever an unsorted column is sorted, or the sort-direction of a column is
|
|
31
|
+
* changed, that column gets sort priority 1, thus affecting the priority for all the other
|
|
32
|
+
* sorted columns. This is identical to using `multi-sort-priority="prepend"`.
|
|
33
|
+
*
|
|
34
|
+
* Using this property allows to change this behavior so that sorting an unsorted column
|
|
35
|
+
* would add it to the "end" of the sort, and changing column's sort direction would retain
|
|
36
|
+
* it's previous priority. To set this, use `multi-sort-priority="append"`.
|
|
37
|
+
*
|
|
38
|
+
* @attr {string} multi-sort-priority
|
|
39
|
+
*/
|
|
40
|
+
multiSortPriority: {
|
|
41
|
+
type: String,
|
|
42
|
+
value: () => defaultMultiSortPriority,
|
|
43
|
+
},
|
|
44
|
+
|
|
24
45
|
/**
|
|
25
46
|
* @type {!Array<!GridSorterDefinition>}
|
|
26
47
|
* @protected
|
|
@@ -38,6 +59,17 @@ export const SortMixin = (superClass) =>
|
|
|
38
59
|
};
|
|
39
60
|
}
|
|
40
61
|
|
|
62
|
+
/**
|
|
63
|
+
* Sets the default multi-sort priority to use for all grid instances.
|
|
64
|
+
* This method should be called before creating any grid instances.
|
|
65
|
+
* Changing this setting does not affect the default for existing grids.
|
|
66
|
+
*
|
|
67
|
+
* @param {string} priority
|
|
68
|
+
*/
|
|
69
|
+
static setDefaultMultiSortPriority(priority) {
|
|
70
|
+
defaultMultiSortPriority = ['append', 'prepend'].includes(priority) ? priority : 'prepend';
|
|
71
|
+
}
|
|
72
|
+
|
|
41
73
|
/** @protected */
|
|
42
74
|
ready() {
|
|
43
75
|
super.ready();
|
|
@@ -48,6 +80,7 @@ export const SortMixin = (superClass) =>
|
|
|
48
80
|
_onSorterChanged(e) {
|
|
49
81
|
const sorter = e.target;
|
|
50
82
|
e.stopPropagation();
|
|
83
|
+
sorter._grid = this;
|
|
51
84
|
this.__updateSorter(sorter);
|
|
52
85
|
this.__applySorters();
|
|
53
86
|
}
|
|
@@ -67,7 +100,29 @@ export const SortMixin = (superClass) =>
|
|
|
67
100
|
|
|
68
101
|
/** @private */
|
|
69
102
|
__updateSortOrders() {
|
|
70
|
-
this._sorters.forEach((sorter, index) =>
|
|
103
|
+
this._sorters.forEach((sorter, index) => {
|
|
104
|
+
sorter._order = this._sorters.length > 1 ? index : null;
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/** @private */
|
|
109
|
+
__appendSorter(sorter) {
|
|
110
|
+
if (!sorter.direction) {
|
|
111
|
+
this._removeArrayItem(this._sorters, sorter);
|
|
112
|
+
} else if (!this._sorters.includes(sorter)) {
|
|
113
|
+
this._sorters.push(sorter);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
this.__updateSortOrders();
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/** @private */
|
|
120
|
+
__prependSorter(sorter) {
|
|
121
|
+
this._removeArrayItem(this._sorters, sorter);
|
|
122
|
+
if (sorter.direction) {
|
|
123
|
+
this._sorters.unshift(sorter);
|
|
124
|
+
}
|
|
125
|
+
this.__updateSortOrders();
|
|
71
126
|
}
|
|
72
127
|
|
|
73
128
|
/** @private */
|
|
@@ -79,11 +134,11 @@ export const SortMixin = (superClass) =>
|
|
|
79
134
|
sorter._order = null;
|
|
80
135
|
|
|
81
136
|
if (this.multiSort) {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
137
|
+
if (this.multiSortPriority === 'append') {
|
|
138
|
+
this.__appendSorter(sorter);
|
|
139
|
+
} else {
|
|
140
|
+
this.__prependSorter(sorter);
|
|
85
141
|
}
|
|
86
|
-
this.__updateSortOrders();
|
|
87
142
|
} else if (sorter.direction) {
|
|
88
143
|
const otherSorters = this._sorters.filter((s) => s !== sorter);
|
|
89
144
|
this._sorters = [sorter];
|
|
@@ -76,13 +76,13 @@ declare class GridSorter extends ThemableMixin(DirMixin(HTMLElement)) {
|
|
|
76
76
|
addEventListener<K extends keyof GridSorterEventMap>(
|
|
77
77
|
type: K,
|
|
78
78
|
listener: (this: GridSorter, ev: GridSorterEventMap[K]) => void,
|
|
79
|
-
options?:
|
|
79
|
+
options?: AddEventListenerOptions | boolean,
|
|
80
80
|
): void;
|
|
81
81
|
|
|
82
82
|
removeEventListener<K extends keyof GridSorterEventMap>(
|
|
83
83
|
type: K,
|
|
84
84
|
listener: (this: GridSorter, ev: GridSorterEventMap[K]) => void,
|
|
85
|
-
options?:
|
|
85
|
+
options?: EventListenerOptions | boolean,
|
|
86
86
|
): void;
|
|
87
87
|
}
|
|
88
88
|
|
|
@@ -7,9 +7,9 @@ import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
|
|
|
7
7
|
import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
|
|
8
8
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
9
9
|
|
|
10
|
-
const
|
|
10
|
+
const template = document.createElement('template');
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
template.innerHTML = `
|
|
13
13
|
<style>
|
|
14
14
|
@font-face {
|
|
15
15
|
font-family: 'vaadin-grid-sorter-icons';
|
|
@@ -20,7 +20,7 @@ $_documentContainer.innerHTML = `
|
|
|
20
20
|
</style>
|
|
21
21
|
`;
|
|
22
22
|
|
|
23
|
-
document.head.appendChild(
|
|
23
|
+
document.head.appendChild(template.content);
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
26
|
* `<vaadin-grid-sorter>` is a helper element for the `<vaadin-grid>` that provides out-of-the-box UI controls,
|
|
@@ -176,6 +176,10 @@ class GridSorter extends ThemableMixin(DirMixin(PolymerElement)) {
|
|
|
176
176
|
disconnectedCallback() {
|
|
177
177
|
super.disconnectedCallback();
|
|
178
178
|
this._isConnected = false;
|
|
179
|
+
|
|
180
|
+
if (!this.parentNode && this._grid) {
|
|
181
|
+
this._grid.__removeSorters([this]);
|
|
182
|
+
}
|
|
179
183
|
}
|
|
180
184
|
|
|
181
185
|
/** @private */
|
|
@@ -3,15 +3,15 @@
|
|
|
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';
|
|
8
|
-
import { GridColumn } from './vaadin-grid-column.js';
|
|
6
|
+
import type { Constructor } from '@open-wc/dedupe-mixin';
|
|
7
|
+
import type { GridItemModel } from './vaadin-grid.js';
|
|
8
|
+
import type { GridColumn } from './vaadin-grid-column.js';
|
|
9
9
|
|
|
10
10
|
export type GridCellClassNameGenerator<TItem> = (column: GridColumn<TItem>, model: GridItemModel<TItem>) => string;
|
|
11
11
|
|
|
12
12
|
export declare function StylingMixin<TItem, T extends Constructor<HTMLElement>>(
|
|
13
13
|
base: T,
|
|
14
|
-
):
|
|
14
|
+
): Constructor<StylingMixinClass<TItem>> & T;
|
|
15
15
|
|
|
16
16
|
export declare class StylingMixinClass<TItem> {
|
|
17
17
|
/**
|
|
@@ -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
|
/**
|
|
@@ -85,13 +85,13 @@ declare class GridTreeToggle extends ThemableMixin(DirMixin(HTMLElement)) {
|
|
|
85
85
|
addEventListener<K extends keyof GridTreeToggleEventMap>(
|
|
86
86
|
type: K,
|
|
87
87
|
listener: (this: GridTreeToggle, ev: GridTreeToggleEventMap[K]) => void,
|
|
88
|
-
options?:
|
|
88
|
+
options?: AddEventListenerOptions | boolean,
|
|
89
89
|
): void;
|
|
90
90
|
|
|
91
91
|
removeEventListener<K extends keyof GridTreeToggleEventMap>(
|
|
92
92
|
type: K,
|
|
93
93
|
listener: (this: GridTreeToggle, ev: GridTreeToggleEventMap[K]) => void,
|
|
94
|
-
options?:
|
|
94
|
+
options?: EventListenerOptions | boolean,
|
|
95
95
|
): void;
|
|
96
96
|
}
|
|
97
97
|
|
|
@@ -8,9 +8,9 @@ import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
|
|
|
8
8
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
9
9
|
import { isFocusable } from './vaadin-grid-active-item-mixin.js';
|
|
10
10
|
|
|
11
|
-
const
|
|
11
|
+
const template = document.createElement('template');
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
template.innerHTML = `
|
|
14
14
|
<style>
|
|
15
15
|
@font-face {
|
|
16
16
|
font-family: "vaadin-grid-tree-icons";
|
|
@@ -21,7 +21,7 @@ $_documentContainer.innerHTML = `
|
|
|
21
21
|
</style>
|
|
22
22
|
`;
|
|
23
23
|
|
|
24
|
-
document.head.appendChild(
|
|
24
|
+
document.head.appendChild(template.content);
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
27
|
* `<vaadin-grid-tree-toggle>` is a helper element for the `<vaadin-grid>`
|
package/src/vaadin-grid.d.ts
CHANGED
|
@@ -3,15 +3,17 @@
|
|
|
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 { DisabledMixinClass } from '@vaadin/component-base/src/disabled-mixin.js';
|
|
7
|
-
import { ElementMixinClass } from '@vaadin/component-base/src/element-mixin.js';
|
|
8
|
-
import { ThemableMixinClass } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
6
|
+
import type { DisabledMixinClass } from '@vaadin/component-base/src/disabled-mixin.js';
|
|
7
|
+
import type { ElementMixinClass } from '@vaadin/component-base/src/element-mixin.js';
|
|
8
|
+
import type { ThemableMixinClass } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
9
|
+
import type { ThemePropertyMixinClass } from '@vaadin/vaadin-themable-mixin/vaadin-theme-property-mixin.js';
|
|
10
|
+
import type { ActiveItemMixinClass } from './vaadin-grid-active-item-mixin.js';
|
|
11
|
+
import type { ArrayDataProviderMixinClass } from './vaadin-grid-array-data-provider-mixin.js';
|
|
12
|
+
import type { GridColumn } from './vaadin-grid-column.js';
|
|
13
|
+
import { GridBodyRenderer, GridHeaderFooterRenderer } from './vaadin-grid-column.js';
|
|
14
|
+
import type { ColumnReorderingMixinClass } from './vaadin-grid-column-reordering-mixin.js';
|
|
15
|
+
import type { DataProviderMixinClass } from './vaadin-grid-data-provider-mixin.js';
|
|
13
16
|
import {
|
|
14
|
-
DataProviderMixinClass,
|
|
15
17
|
GridDataProvider,
|
|
16
18
|
GridDataProviderCallback,
|
|
17
19
|
GridDataProviderParams,
|
|
@@ -19,18 +21,17 @@ import {
|
|
|
19
21
|
GridSorterDefinition,
|
|
20
22
|
GridSorterDirection,
|
|
21
23
|
} from './vaadin-grid-data-provider-mixin.js';
|
|
22
|
-
import {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
} from './vaadin-grid-
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import { GridCellClassNameGenerator, StylingMixinClass } from './vaadin-grid-styling-mixin.js';
|
|
24
|
+
import type { DragAndDropMixinClass } from './vaadin-grid-drag-and-drop-mixin.js';
|
|
25
|
+
import { GridDragAndDropFilter, GridDropLocation, GridDropMode } from './vaadin-grid-drag-and-drop-mixin.js';
|
|
26
|
+
import type { EventContextMixinClass } from './vaadin-grid-event-context-mixin.js';
|
|
27
|
+
import { GridEventContext } from './vaadin-grid-event-context-mixin.js';
|
|
28
|
+
import type { RowDetailsMixinClass } from './vaadin-grid-row-details-mixin.js';
|
|
29
|
+
import { GridRowDetailsRenderer } from './vaadin-grid-row-details-mixin.js';
|
|
30
|
+
import type { ScrollMixinClass } from './vaadin-grid-scroll-mixin.js';
|
|
31
|
+
import type { SelectionMixinClass } from './vaadin-grid-selection-mixin.js';
|
|
32
|
+
import type { SortMixinClass } from './vaadin-grid-sort-mixin.js';
|
|
33
|
+
import type { StylingMixinClass } from './vaadin-grid-styling-mixin.js';
|
|
34
|
+
import { GridCellClassNameGenerator } from './vaadin-grid-styling-mixin.js';
|
|
34
35
|
|
|
35
36
|
export {
|
|
36
37
|
GridBodyRenderer,
|
|
@@ -305,7 +306,7 @@ export interface GridEventMap<TItem> extends HTMLElementEventMap, GridCustomEven
|
|
|
305
306
|
* `overflow` | Set when rows are overflowing the grid viewport. Possible values: `top`, `bottom`, `start`, `end` | :host
|
|
306
307
|
* `reordering` | Set when the grid's columns are being reordered | :host
|
|
307
308
|
* `dragover` | Set when the grid (not a specific row) is dragged over | :host
|
|
308
|
-
* `dragging-rows`
|
|
309
|
+
* `dragging-rows` | Set when grid rows are dragged | :host
|
|
309
310
|
* `reorder-status` | Reflects the status of a cell while columns are being reordered | cell
|
|
310
311
|
* `frozen` | Frozen cell | cell
|
|
311
312
|
* `last-frozen` | Last frozen cell | cell
|
|
@@ -323,7 +324,7 @@ export interface GridEventMap<TItem> extends HTMLElementEventMap, GridCustomEven
|
|
|
323
324
|
* `drag-disabled` | Set to a row that isn't available for dragging | row
|
|
324
325
|
* `drop-disabled` | Set to a row that can't be dropped on top of | row
|
|
325
326
|
*
|
|
326
|
-
* See [Styling Components](https://vaadin.com/docs/latest/
|
|
327
|
+
* See [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.
|
|
327
328
|
*
|
|
328
329
|
* @fires {CustomEvent} active-item-changed - Fired when the `activeItem` property changes.
|
|
329
330
|
* @fires {CustomEvent} cell-activate - Fired when the cell is activated with click or keyboard.
|
|
@@ -379,13 +380,13 @@ declare class Grid<TItem = GridDefaultItem> extends HTMLElement {
|
|
|
379
380
|
addEventListener<K extends keyof GridEventMap<TItem>>(
|
|
380
381
|
type: K,
|
|
381
382
|
listener: (this: Grid<TItem>, ev: GridEventMap<TItem>[K]) => void,
|
|
382
|
-
options?:
|
|
383
|
+
options?: AddEventListenerOptions | boolean,
|
|
383
384
|
): void;
|
|
384
385
|
|
|
385
386
|
removeEventListener<K extends keyof GridEventMap<TItem>>(
|
|
386
387
|
type: K,
|
|
387
388
|
listener: (this: Grid<TItem>, ev: GridEventMap<TItem>[K]) => void,
|
|
388
|
-
options?:
|
|
389
|
+
options?: EventListenerOptions | boolean,
|
|
389
390
|
): void;
|
|
390
391
|
}
|
|
391
392
|
|
|
@@ -393,6 +394,7 @@ interface Grid<TItem = GridDefaultItem>
|
|
|
393
394
|
extends DisabledMixinClass,
|
|
394
395
|
ElementMixinClass,
|
|
395
396
|
ThemableMixinClass,
|
|
397
|
+
ThemePropertyMixinClass,
|
|
396
398
|
ActiveItemMixinClass<TItem>,
|
|
397
399
|
ArrayDataProviderMixinClass<TItem>,
|
|
398
400
|
DataProviderMixinClass<TItem>,
|