@vaadin/grid 22.0.14 → 22.0.17
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 +9 -9
- package/src/vaadin-grid-a11y-mixin.js +5 -5
- package/src/vaadin-grid-active-item-mixin.d.ts +1 -1
- package/src/vaadin-grid-active-item-mixin.js +7 -7
- package/src/vaadin-grid-array-data-provider-mixin.d.ts +1 -1
- package/src/vaadin-grid-array-data-provider-mixin.js +4 -4
- package/src/vaadin-grid-column-group.js +7 -7
- package/src/vaadin-grid-column-reordering-mixin.d.ts +1 -1
- package/src/vaadin-grid-column-reordering-mixin.js +10 -10
- package/src/vaadin-grid-column-resizing-mixin.js +4 -4
- package/src/vaadin-grid-column.d.ts +2 -2
- package/src/vaadin-grid-column.js +19 -19
- package/src/vaadin-grid-data-provider-mixin.d.ts +2 -2
- package/src/vaadin-grid-data-provider-mixin.js +14 -14
- package/src/vaadin-grid-drag-and-drop-mixin.d.ts +1 -1
- package/src/vaadin-grid-drag-and-drop-mixin.js +9 -9
- package/src/vaadin-grid-dynamic-columns-mixin.js +3 -3
- 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.js +1 -1
- package/src/vaadin-grid-filter-mixin.js +3 -3
- package/src/vaadin-grid-filter.d.ts +2 -2
- package/src/vaadin-grid-filter.js +2 -2
- package/src/vaadin-grid-keyboard-navigation-mixin.js +16 -16
- package/src/vaadin-grid-row-details-mixin.d.ts +2 -2
- package/src/vaadin-grid-row-details-mixin.js +4 -4
- package/src/vaadin-grid-scroll-mixin.js +3 -3
- package/src/vaadin-grid-selection-column.d.ts +2 -2
- package/src/vaadin-grid-selection-column.js +7 -7
- package/src/vaadin-grid-selection-mixin.d.ts +1 -1
- package/src/vaadin-grid-selection-mixin.js +21 -7
- package/src/vaadin-grid-sort-column.d.ts +2 -2
- package/src/vaadin-grid-sort-column.js +2 -2
- package/src/vaadin-grid-sort-mixin.js +5 -5
- package/src/vaadin-grid-sorter.d.ts +2 -2
- package/src/vaadin-grid-sorter.js +4 -4
- 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.js +2 -2
- package/src/vaadin-grid-tree-toggle.d.ts +2 -2
- package/src/vaadin-grid-tree-toggle.js +4 -4
- package/src/vaadin-grid.d.ts +5 -5
- package/src/vaadin-grid.js +33 -33
- package/theme/lumo/vaadin-grid-sorter-styles.js +1 -1
- package/theme/lumo/vaadin-grid-styles.js +2 -2
- 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 +1 -1
- package/theme/material/vaadin-grid-tree-toggle-styles.js +1 -1
|
@@ -7,14 +7,14 @@ const DropMode = {
|
|
|
7
7
|
BETWEEN: 'between',
|
|
8
8
|
ON_TOP: 'on-top',
|
|
9
9
|
ON_TOP_OR_BETWEEN: 'on-top-or-between',
|
|
10
|
-
ON_GRID: 'on-grid'
|
|
10
|
+
ON_GRID: 'on-grid',
|
|
11
11
|
};
|
|
12
12
|
|
|
13
13
|
const DropLocation = {
|
|
14
14
|
ON_TOP: 'on-top',
|
|
15
15
|
ABOVE: 'above',
|
|
16
16
|
BELOW: 'below',
|
|
17
|
-
EMPTY: 'empty'
|
|
17
|
+
EMPTY: 'empty',
|
|
18
18
|
};
|
|
19
19
|
|
|
20
20
|
/**
|
|
@@ -79,8 +79,8 @@ export const DragAndDropMixin = (superClass) =>
|
|
|
79
79
|
|
|
80
80
|
/** @private */
|
|
81
81
|
__dndAutoScrollThreshold: {
|
|
82
|
-
value: 50
|
|
83
|
-
}
|
|
82
|
+
value: 50,
|
|
83
|
+
},
|
|
84
84
|
};
|
|
85
85
|
}
|
|
86
86
|
|
|
@@ -162,8 +162,8 @@ export const DragAndDropMixin = (superClass) =>
|
|
|
162
162
|
detail: {
|
|
163
163
|
draggedItems: rows.map((row) => row._item),
|
|
164
164
|
setDragData: (type, data) => e.dataTransfer.setData(type, data),
|
|
165
|
-
setDraggedItemsCount: (count) => row.setAttribute('dragstart', count)
|
|
166
|
-
}
|
|
165
|
+
setDraggedItemsCount: (count) => row.setAttribute('dragstart', count),
|
|
166
|
+
},
|
|
167
167
|
});
|
|
168
168
|
event.originalEvent = e;
|
|
169
169
|
this.dispatchEvent(event);
|
|
@@ -313,7 +313,7 @@ export const DragAndDropMixin = (superClass) =>
|
|
|
313
313
|
Array.from(e.dataTransfer.types).map((type) => {
|
|
314
314
|
return {
|
|
315
315
|
type,
|
|
316
|
-
data: e.dataTransfer.getData(type)
|
|
316
|
+
data: e.dataTransfer.getData(type),
|
|
317
317
|
};
|
|
318
318
|
});
|
|
319
319
|
|
|
@@ -325,8 +325,8 @@ export const DragAndDropMixin = (superClass) =>
|
|
|
325
325
|
detail: {
|
|
326
326
|
dropTargetItem: this._dragOverItem,
|
|
327
327
|
dropLocation: this._dropLocation,
|
|
328
|
-
dragData
|
|
329
|
-
}
|
|
328
|
+
dragData,
|
|
329
|
+
},
|
|
330
330
|
});
|
|
331
331
|
event.originalEvent = e;
|
|
332
332
|
this.dispatchEvent(event);
|
|
@@ -18,7 +18,7 @@ export const DynamicColumnsMixin = (superClass) =>
|
|
|
18
18
|
/**
|
|
19
19
|
* @protected
|
|
20
20
|
*/
|
|
21
|
-
_columnTree: Object
|
|
21
|
+
_columnTree: Object,
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
24
|
|
|
@@ -104,7 +104,7 @@ export const DynamicColumnsMixin = (superClass) =>
|
|
|
104
104
|
this._debouncerCheckImports = Debouncer.debounce(
|
|
105
105
|
this._debouncerCheckImports,
|
|
106
106
|
timeOut.after(2000),
|
|
107
|
-
this._checkImports.bind(this)
|
|
107
|
+
this._checkImports.bind(this),
|
|
108
108
|
);
|
|
109
109
|
|
|
110
110
|
this._ensureFirstPageLoaded();
|
|
@@ -140,7 +140,7 @@ export const DynamicColumnsMixin = (superClass) =>
|
|
|
140
140
|
'vaadin-grid-tree-toggle',
|
|
141
141
|
'vaadin-grid-selection-column',
|
|
142
142
|
'vaadin-grid-sort-column',
|
|
143
|
-
'vaadin-grid-sorter'
|
|
143
|
+
'vaadin-grid-sorter',
|
|
144
144
|
].forEach((elementName) => {
|
|
145
145
|
const element = this.querySelector(elementName);
|
|
146
146
|
if (element && !(element instanceof PolymerElement)) {
|
|
@@ -18,7 +18,7 @@ export interface GridEventContext<TItem> {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
export declare function EventContextMixin<TItem, T extends Constructor<HTMLElement>>(
|
|
21
|
-
base: T
|
|
21
|
+
base: T,
|
|
22
22
|
): T & Constructor<EventContextMixinClass<TItem>>;
|
|
23
23
|
|
|
24
24
|
export declare class EventContextMixinClass<TItem> {
|
|
@@ -41,7 +41,7 @@ export const EventContextMixin = (superClass) =>
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
context.section = ['body', 'header', 'footer', 'details'].filter(
|
|
44
|
-
(section) => cell.getAttribute('part').indexOf(section) > -1
|
|
44
|
+
(section) => cell.getAttribute('part').indexOf(section) > -1,
|
|
45
45
|
)[0];
|
|
46
46
|
|
|
47
47
|
if (cell._column) {
|
|
@@ -16,8 +16,8 @@ export const FilterMixin = (superClass) =>
|
|
|
16
16
|
type: Array,
|
|
17
17
|
value: function () {
|
|
18
18
|
return [];
|
|
19
|
-
}
|
|
20
|
-
}
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
23
|
|
|
@@ -69,7 +69,7 @@ export const FilterMixin = (superClass) =>
|
|
|
69
69
|
return this._filters.map((filter) => {
|
|
70
70
|
return {
|
|
71
71
|
path: filter.path,
|
|
72
|
-
value: filter.value
|
|
72
|
+
value: filter.value,
|
|
73
73
|
};
|
|
74
74
|
});
|
|
75
75
|
}
|
|
@@ -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?: boolean | AddEventListenerOptions
|
|
57
|
+
options?: boolean | AddEventListenerOptions,
|
|
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?: boolean | EventListenerOptions
|
|
63
|
+
options?: boolean | EventListenerOptions,
|
|
64
64
|
): void;
|
|
65
65
|
}
|
|
66
66
|
|
|
@@ -14,7 +14,7 @@ export const KeyboardNavigationMixin = (superClass) =>
|
|
|
14
14
|
/** @private */
|
|
15
15
|
_headerFocusable: {
|
|
16
16
|
type: Object,
|
|
17
|
-
observer: '_focusableChanged'
|
|
17
|
+
observer: '_focusableChanged',
|
|
18
18
|
},
|
|
19
19
|
|
|
20
20
|
/**
|
|
@@ -23,13 +23,13 @@ export const KeyboardNavigationMixin = (superClass) =>
|
|
|
23
23
|
*/
|
|
24
24
|
_itemsFocusable: {
|
|
25
25
|
type: Object,
|
|
26
|
-
observer: '_focusableChanged'
|
|
26
|
+
observer: '_focusableChanged',
|
|
27
27
|
},
|
|
28
28
|
|
|
29
29
|
/** @private */
|
|
30
30
|
_footerFocusable: {
|
|
31
31
|
type: Object,
|
|
32
|
-
observer: '_focusableChanged'
|
|
32
|
+
observer: '_focusableChanged',
|
|
33
33
|
},
|
|
34
34
|
|
|
35
35
|
/** @private */
|
|
@@ -41,7 +41,7 @@ export const KeyboardNavigationMixin = (superClass) =>
|
|
|
41
41
|
*/
|
|
42
42
|
_focusedItemIndex: {
|
|
43
43
|
type: Number,
|
|
44
|
-
value: 0
|
|
44
|
+
value: 0,
|
|
45
45
|
},
|
|
46
46
|
|
|
47
47
|
/** @private */
|
|
@@ -64,8 +64,8 @@ export const KeyboardNavigationMixin = (superClass) =>
|
|
|
64
64
|
value: false,
|
|
65
65
|
reflectToAttribute: true,
|
|
66
66
|
readOnly: true,
|
|
67
|
-
observer: '_interactingChanged'
|
|
68
|
-
}
|
|
67
|
+
observer: '_interactingChanged',
|
|
68
|
+
},
|
|
69
69
|
};
|
|
70
70
|
}
|
|
71
71
|
|
|
@@ -222,7 +222,7 @@ export const KeyboardNavigationMixin = (superClass) =>
|
|
|
222
222
|
__isRowExpandable(row) {
|
|
223
223
|
const treeToggle = [...row.children].reduce(
|
|
224
224
|
(value, cell) => value || cell._content.querySelector('vaadin-grid-tree-toggle'),
|
|
225
|
-
null
|
|
225
|
+
null,
|
|
226
226
|
);
|
|
227
227
|
return treeToggle && !treeToggle.expanded && !treeToggle.leaf;
|
|
228
228
|
}
|
|
@@ -468,7 +468,7 @@ export const KeyboardNavigationMixin = (superClass) =>
|
|
|
468
468
|
|
|
469
469
|
return {
|
|
470
470
|
dstRow: [...activeRowGroup.children].find((el) => !el.hidden && el.index === dstRowIndex),
|
|
471
|
-
dstIsRowDetails
|
|
471
|
+
dstIsRowDetails,
|
|
472
472
|
};
|
|
473
473
|
}
|
|
474
474
|
}
|
|
@@ -519,7 +519,7 @@ export const KeyboardNavigationMixin = (superClass) =>
|
|
|
519
519
|
const orderedColumnIndex = dstSortedColumnOrders.indexOf(
|
|
520
520
|
dstSortedColumnOrders
|
|
521
521
|
.slice(0)
|
|
522
|
-
.sort((b, a) => Math.abs(b - this._focusedColumnOrder) - Math.abs(a - this._focusedColumnOrder))[0]
|
|
522
|
+
.sort((b, a) => Math.abs(b - this._focusedColumnOrder) - Math.abs(a - this._focusedColumnOrder))[0],
|
|
523
523
|
);
|
|
524
524
|
|
|
525
525
|
// Index of the destination column order
|
|
@@ -594,7 +594,7 @@ export const KeyboardNavigationMixin = (superClass) =>
|
|
|
594
594
|
this._headerFocusable,
|
|
595
595
|
this._itemsFocusable,
|
|
596
596
|
this._footerFocusable,
|
|
597
|
-
this.$.focusexit
|
|
597
|
+
this.$.focusexit,
|
|
598
598
|
];
|
|
599
599
|
|
|
600
600
|
let index = tabOrder.indexOf(srcElement);
|
|
@@ -644,7 +644,7 @@ export const KeyboardNavigationMixin = (superClass) =>
|
|
|
644
644
|
// scrolling. Focus the row for the stored focused item index instead.
|
|
645
645
|
const columnIndex = Array.from(targetRow.children).indexOf(this._itemsFocusable);
|
|
646
646
|
const focusedItemRow = Array.from(this.$.items.children).find(
|
|
647
|
-
(row) => !row.hidden && row.index === this._focusedItemIndex
|
|
647
|
+
(row) => !row.hidden && row.index === this._focusedItemIndex,
|
|
648
648
|
);
|
|
649
649
|
if (focusedItemRow) {
|
|
650
650
|
itemsFocusTarget = focusedItemRow.children[columnIndex];
|
|
@@ -670,9 +670,9 @@ export const KeyboardNavigationMixin = (superClass) =>
|
|
|
670
670
|
this.dispatchEvent(
|
|
671
671
|
new CustomEvent(isRow ? 'row-activate' : 'cell-activate', {
|
|
672
672
|
detail: {
|
|
673
|
-
model: this.__getRowModel(isRow ? element : element.parentElement)
|
|
674
|
-
}
|
|
675
|
-
})
|
|
673
|
+
model: this.__getRowModel(isRow ? element : element.parentElement),
|
|
674
|
+
},
|
|
675
|
+
}),
|
|
676
676
|
);
|
|
677
677
|
}
|
|
678
678
|
}
|
|
@@ -743,7 +743,7 @@ export const KeyboardNavigationMixin = (superClass) =>
|
|
|
743
743
|
// Fire a public event for cell.
|
|
744
744
|
const context = this.getEventContext(e);
|
|
745
745
|
cell.dispatchEvent(
|
|
746
|
-
new CustomEvent('cell-focus', { bubbles: true, composed: true, detail: { context: context } })
|
|
746
|
+
new CustomEvent('cell-focus', { bubbles: true, composed: true, detail: { context: context } }),
|
|
747
747
|
);
|
|
748
748
|
}
|
|
749
749
|
}
|
|
@@ -925,7 +925,7 @@ export const KeyboardNavigationMixin = (superClass) =>
|
|
|
925
925
|
return {
|
|
926
926
|
section,
|
|
927
927
|
row,
|
|
928
|
-
cell
|
|
928
|
+
cell,
|
|
929
929
|
};
|
|
930
930
|
}
|
|
931
931
|
|
|
@@ -9,11 +9,11 @@ import { Grid, GridItemModel } from './vaadin-grid.js';
|
|
|
9
9
|
export type GridRowDetailsRenderer<TItem> = (
|
|
10
10
|
root: HTMLElement,
|
|
11
11
|
grid?: Grid<TItem>,
|
|
12
|
-
model?: GridItemModel<TItem
|
|
12
|
+
model?: GridItemModel<TItem>,
|
|
13
13
|
) => void;
|
|
14
14
|
|
|
15
15
|
export declare function RowDetailsMixin<TItem, T extends Constructor<HTMLElement>>(
|
|
16
|
-
base: T
|
|
16
|
+
base: T,
|
|
17
17
|
): T & Constructor<RowDetailsMixinClass<TItem>>;
|
|
18
18
|
|
|
19
19
|
export declare class RowDetailsMixinClass<TItem> {
|
|
@@ -19,7 +19,7 @@ export const RowDetailsMixin = (superClass) =>
|
|
|
19
19
|
type: Array,
|
|
20
20
|
value: function () {
|
|
21
21
|
return [];
|
|
22
|
-
}
|
|
22
|
+
},
|
|
23
23
|
},
|
|
24
24
|
|
|
25
25
|
/**
|
|
@@ -45,15 +45,15 @@ export const RowDetailsMixin = (superClass) =>
|
|
|
45
45
|
* @protected
|
|
46
46
|
*/
|
|
47
47
|
_detailsCells: {
|
|
48
|
-
type: Array
|
|
49
|
-
}
|
|
48
|
+
type: Array,
|
|
49
|
+
},
|
|
50
50
|
};
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
static get observers() {
|
|
54
54
|
return [
|
|
55
55
|
'_detailsOpenedItemsChanged(detailsOpenedItems.*, rowDetailsRenderer)',
|
|
56
|
-
'_rowDetailsRendererChanged(rowDetailsRenderer)'
|
|
56
|
+
'_rowDetailsRendererChanged(rowDetailsRenderer)',
|
|
57
57
|
];
|
|
58
58
|
}
|
|
59
59
|
|
|
@@ -7,7 +7,7 @@ import { animationFrame, microTask, timeOut } from '@vaadin/component-base/src/a
|
|
|
7
7
|
import { Debouncer } from '@vaadin/component-base/src/debounce.js';
|
|
8
8
|
|
|
9
9
|
const timeouts = {
|
|
10
|
-
SCROLLING: 500
|
|
10
|
+
SCROLLING: 500,
|
|
11
11
|
};
|
|
12
12
|
|
|
13
13
|
/**
|
|
@@ -23,11 +23,11 @@ export const ScrollMixin = (superClass) =>
|
|
|
23
23
|
*/
|
|
24
24
|
_frozenCells: {
|
|
25
25
|
type: Array,
|
|
26
|
-
value: () => []
|
|
26
|
+
value: () => [],
|
|
27
27
|
},
|
|
28
28
|
|
|
29
29
|
/** @private */
|
|
30
|
-
_rowWithFocusedElement: Element
|
|
30
|
+
_rowWithFocusedElement: Element,
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
33
|
|
|
@@ -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?: boolean | AddEventListenerOptions
|
|
60
|
+
options?: boolean | AddEventListenerOptions,
|
|
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?: boolean | EventListenerOptions
|
|
66
|
+
options?: boolean | EventListenerOptions,
|
|
67
67
|
): void;
|
|
68
68
|
}
|
|
69
69
|
|
|
@@ -42,7 +42,7 @@ class GridSelectionColumn extends GridColumn {
|
|
|
42
42
|
*/
|
|
43
43
|
width: {
|
|
44
44
|
type: String,
|
|
45
|
-
value: '58px'
|
|
45
|
+
value: '58px',
|
|
46
46
|
},
|
|
47
47
|
|
|
48
48
|
/**
|
|
@@ -52,7 +52,7 @@ class GridSelectionColumn extends GridColumn {
|
|
|
52
52
|
*/
|
|
53
53
|
flexGrow: {
|
|
54
54
|
type: Number,
|
|
55
|
-
value: 0
|
|
55
|
+
value: 0,
|
|
56
56
|
},
|
|
57
57
|
|
|
58
58
|
/**
|
|
@@ -63,7 +63,7 @@ class GridSelectionColumn extends GridColumn {
|
|
|
63
63
|
selectAll: {
|
|
64
64
|
type: Boolean,
|
|
65
65
|
value: false,
|
|
66
|
-
notify: true
|
|
66
|
+
notify: true,
|
|
67
67
|
},
|
|
68
68
|
|
|
69
69
|
/**
|
|
@@ -73,7 +73,7 @@ class GridSelectionColumn extends GridColumn {
|
|
|
73
73
|
*/
|
|
74
74
|
autoSelect: {
|
|
75
75
|
type: Boolean,
|
|
76
|
-
value: false
|
|
76
|
+
value: false,
|
|
77
77
|
},
|
|
78
78
|
|
|
79
79
|
/** @private */
|
|
@@ -87,14 +87,14 @@ class GridSelectionColumn extends GridColumn {
|
|
|
87
87
|
__previousActiveItem: Object,
|
|
88
88
|
|
|
89
89
|
/** @private */
|
|
90
|
-
__selectAllHidden: Boolean
|
|
90
|
+
__selectAllHidden: Boolean,
|
|
91
91
|
};
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
static get observers() {
|
|
95
95
|
return [
|
|
96
96
|
'__onSelectAllChanged(selectAll)',
|
|
97
|
-
'_onHeaderRendererOrBindingChanged(_headerRenderer, _headerCell, path, header, selectAll, __indeterminate, __selectAllHidden)'
|
|
97
|
+
'_onHeaderRendererOrBindingChanged(_headerRenderer, _headerCell, path, header, selectAll, __indeterminate, __selectAllHidden)',
|
|
98
98
|
];
|
|
99
99
|
}
|
|
100
100
|
|
|
@@ -290,7 +290,7 @@ class GridSelectionColumn extends GridColumn {
|
|
|
290
290
|
page: 0,
|
|
291
291
|
pageSize: Infinity,
|
|
292
292
|
sortOrders: [],
|
|
293
|
-
filters: this._grid._mapFilters()
|
|
293
|
+
filters: this._grid._mapFilters(),
|
|
294
294
|
};
|
|
295
295
|
this._grid.dataProvider(params, (items) => callback(items));
|
|
296
296
|
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import { Constructor } from '@open-wc/dedupe-mixin';
|
|
7
7
|
|
|
8
8
|
export declare function SelectionMixin<TItem, T extends Constructor<HTMLElement>>(
|
|
9
|
-
base: T
|
|
9
|
+
base: T,
|
|
10
10
|
): T & Constructor<SelectionMixinClass<TItem>>;
|
|
11
11
|
|
|
12
12
|
export declare class SelectionMixinClass<TItem> {
|
|
@@ -18,13 +18,22 @@ export const SelectionMixin = (superClass) =>
|
|
|
18
18
|
selectedItems: {
|
|
19
19
|
type: Object,
|
|
20
20
|
notify: true,
|
|
21
|
-
value: () => []
|
|
22
|
-
}
|
|
21
|
+
value: () => [],
|
|
22
|
+
},
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Set of selected item ids
|
|
26
|
+
* @private
|
|
27
|
+
*/
|
|
28
|
+
__selectedKeys: {
|
|
29
|
+
type: Object,
|
|
30
|
+
value: () => new Set(),
|
|
31
|
+
},
|
|
23
32
|
};
|
|
24
33
|
}
|
|
25
34
|
|
|
26
35
|
static get observers() {
|
|
27
|
-
return ['
|
|
36
|
+
return ['_updateSelectedKeys(itemIdPath, selectedItems.*)'];
|
|
28
37
|
}
|
|
29
38
|
|
|
30
39
|
/**
|
|
@@ -33,7 +42,7 @@ export const SelectionMixin = (superClass) =>
|
|
|
33
42
|
* @protected
|
|
34
43
|
*/
|
|
35
44
|
_isSelected(item) {
|
|
36
|
-
return this.
|
|
45
|
+
return this.__selectedKeys.has(this.getItemId(item));
|
|
37
46
|
}
|
|
38
47
|
|
|
39
48
|
/**
|
|
@@ -68,8 +77,7 @@ export const SelectionMixin = (superClass) =>
|
|
|
68
77
|
* @protected
|
|
69
78
|
*/
|
|
70
79
|
_toggleItem(item) {
|
|
71
|
-
|
|
72
|
-
if (index === -1) {
|
|
80
|
+
if (!this._isSelected(item)) {
|
|
73
81
|
this.selectItem(item);
|
|
74
82
|
} else {
|
|
75
83
|
this.deselectItem(item);
|
|
@@ -77,7 +85,13 @@ export const SelectionMixin = (superClass) =>
|
|
|
77
85
|
}
|
|
78
86
|
|
|
79
87
|
/** @private */
|
|
80
|
-
|
|
88
|
+
_updateSelectedKeys() {
|
|
89
|
+
const selectedItems = this.selectedItems || [];
|
|
90
|
+
this.__selectedKeys = new Set();
|
|
91
|
+
selectedItems.forEach((item) => {
|
|
92
|
+
this.__selectedKeys.add(this.getItemId(item));
|
|
93
|
+
});
|
|
94
|
+
|
|
81
95
|
this.requestContentUpdate();
|
|
82
96
|
}
|
|
83
97
|
|
|
@@ -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?: boolean | AddEventListenerOptions
|
|
52
|
+
options?: boolean | AddEventListenerOptions,
|
|
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?: boolean | EventListenerOptions
|
|
58
|
+
options?: boolean | EventListenerOptions,
|
|
59
59
|
): void;
|
|
60
60
|
}
|
|
61
61
|
|
|
@@ -18,7 +18,7 @@ export const SortMixin = (superClass) =>
|
|
|
18
18
|
*/
|
|
19
19
|
multiSort: {
|
|
20
20
|
type: Boolean,
|
|
21
|
-
value: false
|
|
21
|
+
value: false,
|
|
22
22
|
},
|
|
23
23
|
|
|
24
24
|
/**
|
|
@@ -29,7 +29,7 @@ export const SortMixin = (superClass) =>
|
|
|
29
29
|
type: Array,
|
|
30
30
|
value: function () {
|
|
31
31
|
return [];
|
|
32
|
-
}
|
|
32
|
+
},
|
|
33
33
|
},
|
|
34
34
|
|
|
35
35
|
/** @private */
|
|
@@ -37,8 +37,8 @@ export const SortMixin = (superClass) =>
|
|
|
37
37
|
type: Array,
|
|
38
38
|
value: function () {
|
|
39
39
|
return [];
|
|
40
|
-
}
|
|
41
|
-
}
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
44
|
|
|
@@ -124,7 +124,7 @@ export const SortMixin = (superClass) =>
|
|
|
124
124
|
return this._sorters.map((sorter) => {
|
|
125
125
|
return {
|
|
126
126
|
path: sorter.path,
|
|
127
|
-
direction: sorter.direction
|
|
127
|
+
direction: sorter.direction,
|
|
128
128
|
};
|
|
129
129
|
});
|
|
130
130
|
}
|
|
@@ -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?: boolean | AddEventListenerOptions
|
|
79
|
+
options?: boolean | AddEventListenerOptions,
|
|
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?: boolean | EventListenerOptions
|
|
85
|
+
options?: boolean | EventListenerOptions,
|
|
86
86
|
): void;
|
|
87
87
|
}
|
|
88
88
|
|
|
@@ -136,7 +136,7 @@ class GridSorter extends ThemableMixin(DirMixin(PolymerElement)) {
|
|
|
136
136
|
type: String,
|
|
137
137
|
reflectToAttribute: true,
|
|
138
138
|
notify: true,
|
|
139
|
-
value: null
|
|
139
|
+
value: null,
|
|
140
140
|
},
|
|
141
141
|
|
|
142
142
|
/**
|
|
@@ -145,14 +145,14 @@ class GridSorter extends ThemableMixin(DirMixin(PolymerElement)) {
|
|
|
145
145
|
*/
|
|
146
146
|
_order: {
|
|
147
147
|
type: Number,
|
|
148
|
-
value: null
|
|
148
|
+
value: null,
|
|
149
149
|
},
|
|
150
150
|
|
|
151
151
|
/** @private */
|
|
152
152
|
_isConnected: {
|
|
153
153
|
type: Boolean,
|
|
154
|
-
observer: '__isConnectedChanged'
|
|
155
|
-
}
|
|
154
|
+
observer: '__isConnectedChanged',
|
|
155
|
+
},
|
|
156
156
|
};
|
|
157
157
|
}
|
|
158
158
|
|
|
@@ -10,7 +10,7 @@ import { GridColumn } from './vaadin-grid-column.js';
|
|
|
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
|
-
base: T
|
|
13
|
+
base: T,
|
|
14
14
|
): T & Constructor<StylingMixinClass<TItem>>;
|
|
15
15
|
|
|
16
16
|
export declare class StylingMixinClass<TItem> {
|
|
@@ -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?: boolean | AddEventListenerOptions
|
|
88
|
+
options?: boolean | AddEventListenerOptions,
|
|
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?: boolean | EventListenerOptions
|
|
94
|
+
options?: boolean | EventListenerOptions,
|
|
95
95
|
): void;
|
|
96
96
|
}
|
|
97
97
|
|