@vaadin/grid 25.0.0-alpha1 → 25.0.0-alpha10
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 +14 -12
- package/src/array-data-provider.js +6 -0
- package/src/lit/column-renderer-directives.d.ts +0 -1
- package/src/styles/vaadin-grid-base-styles.d.ts +8 -0
- package/src/styles/vaadin-grid-base-styles.js +510 -0
- package/src/styles/vaadin-grid-core-styles.d.ts +8 -0
- package/src/{vaadin-grid-styles.js → styles/vaadin-grid-core-styles.js} +2 -3
- package/src/styles/vaadin-grid-filter-base-styles.d.ts +8 -0
- package/src/styles/vaadin-grid-filter-base-styles.js +18 -0
- package/src/styles/vaadin-grid-filter-core-styles.d.ts +8 -0
- package/src/styles/vaadin-grid-filter-core-styles.js +18 -0
- package/src/styles/vaadin-grid-sorter-base-styles.d.ts +8 -0
- package/src/styles/vaadin-grid-sorter-base-styles.js +63 -0
- package/src/styles/vaadin-grid-sorter-core-styles.d.ts +8 -0
- package/src/styles/vaadin-grid-sorter-core-styles.js +61 -0
- package/src/styles/vaadin-grid-tree-toggle-base-styles.d.ts +8 -0
- package/src/styles/vaadin-grid-tree-toggle-base-styles.js +76 -0
- package/src/styles/vaadin-grid-tree-toggle-core-styles.d.ts +8 -0
- package/src/styles/vaadin-grid-tree-toggle-core-styles.js +78 -0
- package/src/vaadin-grid-column-auto-width-mixin.js +8 -2
- package/src/vaadin-grid-data-provider-mixin.js +19 -76
- package/src/vaadin-grid-drag-and-drop-mixin.js +3 -0
- package/src/vaadin-grid-filter-element-mixin.js +0 -17
- package/src/vaadin-grid-filter.js +7 -1
- package/src/vaadin-grid-keyboard-navigation-mixin.js +1 -1
- package/src/vaadin-grid-mixin.js +50 -28
- package/src/vaadin-grid-row-details-mixin.js +4 -4
- package/src/vaadin-grid-scroll-mixin.js +52 -21
- package/src/vaadin-grid-sorter-mixin.js +0 -60
- package/src/vaadin-grid-sorter.js +7 -1
- package/src/vaadin-grid-tree-toggle-mixin.js +0 -77
- package/src/vaadin-grid-tree-toggle.js +9 -1
- package/src/vaadin-grid.d.ts +1 -1
- package/src/vaadin-grid.js +4 -3
- package/theme/lumo/vaadin-grid-styles.js +1 -1
- package/web-types.json +4 -4
- package/web-types.lit.json +4 -4
package/src/vaadin-grid-mixin.js
CHANGED
|
@@ -5,15 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { TabindexMixin } from '@vaadin/a11y-base/src/tabindex-mixin.js';
|
|
7
7
|
import { animationFrame, microTask } from '@vaadin/component-base/src/async.js';
|
|
8
|
-
import {
|
|
9
|
-
isAndroid,
|
|
10
|
-
isChrome,
|
|
11
|
-
isFirefox,
|
|
12
|
-
isIOS,
|
|
13
|
-
isSafari,
|
|
14
|
-
isTouch,
|
|
15
|
-
supportsAdoptingStyleSheets,
|
|
16
|
-
} from '@vaadin/component-base/src/browser-utils.js';
|
|
8
|
+
import { isAndroid, isChrome, isFirefox, isIOS, isSafari, isTouch } from '@vaadin/component-base/src/browser-utils.js';
|
|
17
9
|
import { Debouncer } from '@vaadin/component-base/src/debounce.js';
|
|
18
10
|
import { getClosestElement } from '@vaadin/component-base/src/dom-utils.js';
|
|
19
11
|
import { SlotObserver } from '@vaadin/component-base/src/slot-observer.js';
|
|
@@ -36,6 +28,7 @@ import {
|
|
|
36
28
|
iterateRowCells,
|
|
37
29
|
updateBooleanRowStates,
|
|
38
30
|
updateCellsPart,
|
|
31
|
+
updateState,
|
|
39
32
|
} from './vaadin-grid-helpers.js';
|
|
40
33
|
import { KeyboardNavigationMixin } from './vaadin-grid-keyboard-navigation-mixin.js';
|
|
41
34
|
import { RowDetailsMixin } from './vaadin-grid-row-details-mixin.js';
|
|
@@ -353,7 +346,7 @@ export const GridMixin = (superClass) =>
|
|
|
353
346
|
row.setAttribute('role', 'row');
|
|
354
347
|
row.setAttribute('tabindex', '-1');
|
|
355
348
|
if (this._columnTree) {
|
|
356
|
-
this.
|
|
349
|
+
this.__initRow(row, this._columnTree[this._columnTree.length - 1], 'body', false, true);
|
|
357
350
|
}
|
|
358
351
|
rows.push(row);
|
|
359
352
|
}
|
|
@@ -465,9 +458,9 @@ export const GridMixin = (superClass) =>
|
|
|
465
458
|
* @param {?string} section
|
|
466
459
|
* @param {boolean} isColumnRow
|
|
467
460
|
* @param {boolean} noNotify
|
|
468
|
-
* @
|
|
461
|
+
* @private
|
|
469
462
|
*/
|
|
470
|
-
|
|
463
|
+
__initRow(row, columns, section = 'body', isColumnRow = false, noNotify = false) {
|
|
471
464
|
const contentsFragment = document.createDocumentFragment();
|
|
472
465
|
|
|
473
466
|
iterateRowCells(row, (cell) => {
|
|
@@ -647,10 +640,15 @@ export const GridMixin = (superClass) =>
|
|
|
647
640
|
return;
|
|
648
641
|
}
|
|
649
642
|
|
|
643
|
+
row.index = index;
|
|
644
|
+
|
|
650
645
|
this._updateRowOrderParts(row, index);
|
|
651
646
|
|
|
652
647
|
this._a11yUpdateRowRowindex(row, index);
|
|
653
|
-
|
|
648
|
+
|
|
649
|
+
this.__ensureRowItem(row);
|
|
650
|
+
this.__ensureRowHierarchy(row);
|
|
651
|
+
this.__updateRow(row);
|
|
654
652
|
}
|
|
655
653
|
|
|
656
654
|
/** @private */
|
|
@@ -691,7 +689,7 @@ export const GridMixin = (superClass) =>
|
|
|
691
689
|
*/
|
|
692
690
|
_renderColumnTree(columnTree) {
|
|
693
691
|
iterateChildren(this.$.items, (row) => {
|
|
694
|
-
this.
|
|
692
|
+
this.__initRow(row, columnTree[columnTree.length - 1], 'body', false, true);
|
|
695
693
|
|
|
696
694
|
const model = this.__getRowModel(row);
|
|
697
695
|
this._updateRowOrderParts(row);
|
|
@@ -718,7 +716,7 @@ export const GridMixin = (superClass) =>
|
|
|
718
716
|
}
|
|
719
717
|
|
|
720
718
|
iterateChildren(this.$.header, (headerRow, index, rows) => {
|
|
721
|
-
this.
|
|
719
|
+
this.__initRow(headerRow, columnTree[index], 'header', index === columnTree.length - 1);
|
|
722
720
|
|
|
723
721
|
const cells = getBodyRowCells(headerRow);
|
|
724
722
|
updateCellsPart(cells, 'first-header-row-cell', index === 0);
|
|
@@ -726,7 +724,7 @@ export const GridMixin = (superClass) =>
|
|
|
726
724
|
});
|
|
727
725
|
|
|
728
726
|
iterateChildren(this.$.footer, (footerRow, index, rows) => {
|
|
729
|
-
this.
|
|
727
|
+
this.__initRow(footerRow, columnTree[columnTree.length - 1 - index], 'footer', index === 0);
|
|
730
728
|
|
|
731
729
|
const cells = getBodyRowCells(footerRow);
|
|
732
730
|
updateCellsPart(cells, 'first-footer-row-cell', index === 0);
|
|
@@ -734,7 +732,7 @@ export const GridMixin = (superClass) =>
|
|
|
734
732
|
});
|
|
735
733
|
|
|
736
734
|
// Sizer rows
|
|
737
|
-
this.
|
|
735
|
+
this.__initRow(this.$.sizer, columnTree[columnTree.length - 1]);
|
|
738
736
|
|
|
739
737
|
this._resizeHandler();
|
|
740
738
|
this._frozenCellsChanged();
|
|
@@ -749,10 +747,38 @@ export const GridMixin = (superClass) =>
|
|
|
749
747
|
|
|
750
748
|
/**
|
|
751
749
|
* @param {!HTMLElement} row
|
|
752
|
-
* @param {
|
|
753
|
-
* @
|
|
750
|
+
* @param {boolean} loading
|
|
751
|
+
* @private
|
|
754
752
|
*/
|
|
755
|
-
|
|
753
|
+
__updateRowLoading(row, loading) {
|
|
754
|
+
const cells = getBodyRowCells(row);
|
|
755
|
+
|
|
756
|
+
// Row state attribute
|
|
757
|
+
updateState(row, 'loading', loading);
|
|
758
|
+
|
|
759
|
+
// Cells part attribute
|
|
760
|
+
updateCellsPart(cells, 'loading-row-cell', loading);
|
|
761
|
+
|
|
762
|
+
if (loading) {
|
|
763
|
+
// Run style generators for the loading row to have custom names cleared
|
|
764
|
+
this._generateCellClassNames(row);
|
|
765
|
+
this._generateCellPartNames(row);
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
/**
|
|
770
|
+
* @param {!HTMLElement} row
|
|
771
|
+
* @private
|
|
772
|
+
*/
|
|
773
|
+
__updateRow(row) {
|
|
774
|
+
const item = this.__getRowItem(row);
|
|
775
|
+
if (item) {
|
|
776
|
+
this.__updateRowLoading(row, false);
|
|
777
|
+
} else {
|
|
778
|
+
this.__updateRowLoading(row, true);
|
|
779
|
+
return;
|
|
780
|
+
}
|
|
781
|
+
|
|
756
782
|
row._item = item;
|
|
757
783
|
const model = this.__getRowModel(row);
|
|
758
784
|
|
|
@@ -929,15 +955,11 @@ export const GridMixin = (superClass) =>
|
|
|
929
955
|
|
|
930
956
|
// The style is set to host instead of the scroller so that the value can be overridden by the user with "grid { min-height: 0 }"
|
|
931
957
|
// Prefer setting style in adopted style sheet to avoid the need to add a confusing inline style on the host element
|
|
932
|
-
|
|
933
|
-
if (!this.__minHeightStyleSheet && supportsAdoptingStyleSheets) {
|
|
958
|
+
if (!this.__minHeightStyleSheet) {
|
|
934
959
|
this.__minHeightStyleSheet = new CSSStyleSheet();
|
|
935
|
-
this.shadowRoot.adoptedStyleSheets
|
|
936
|
-
}
|
|
937
|
-
if (this.__minHeightStyleSheet) {
|
|
938
|
-
this.__minHeightStyleSheet.replaceSync(`:host { --_grid-min-height: ${minHeight}px; }`);
|
|
939
|
-
} else {
|
|
940
|
-
this.style.setProperty('--_grid-min-height', `${minHeight}px`);
|
|
960
|
+
this.shadowRoot.adoptedStyleSheets.push(this.__minHeightStyleSheet);
|
|
941
961
|
}
|
|
962
|
+
|
|
963
|
+
this.__minHeightStyleSheet.replaceSync(`:host { --_grid-min-height: ${minHeight}px; }`);
|
|
942
964
|
}
|
|
943
965
|
};
|
|
@@ -85,7 +85,7 @@ export const RowDetailsMixin = (superClass) =>
|
|
|
85
85
|
// Only update the rows if the column tree has already been initialized
|
|
86
86
|
iterateChildren(this.$.items, (row) => {
|
|
87
87
|
if (!row.querySelector('[part~=details-cell]')) {
|
|
88
|
-
this.
|
|
88
|
+
this.__initRow(row, this._columnTree[this._columnTree.length - 1]);
|
|
89
89
|
const isDetailsOpened = this._isDetailsOpened(row._item);
|
|
90
90
|
this._toggleDetailsCell(row, isDetailsOpened);
|
|
91
91
|
}
|
|
@@ -98,13 +98,13 @@ export const RowDetailsMixin = (superClass) =>
|
|
|
98
98
|
iterateChildren(this.$.items, (row) => {
|
|
99
99
|
// Re-renders the row to possibly close the previously opened details.
|
|
100
100
|
if (row.hasAttribute('details-opened')) {
|
|
101
|
-
this.
|
|
101
|
+
this.__updateRow(row);
|
|
102
102
|
return;
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
// Re-renders the row to open the details when a row details renderer is provided.
|
|
106
106
|
if (rowDetailsRenderer && this._isDetailsOpened(row._item)) {
|
|
107
|
-
this.
|
|
107
|
+
this.__updateRow(row);
|
|
108
108
|
}
|
|
109
109
|
});
|
|
110
110
|
}
|
|
@@ -140,7 +140,7 @@ export const RowDetailsMixin = (superClass) =>
|
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
// Assigns a renderer when the details cell is opened.
|
|
143
|
-
// The details cell content is rendered later in the `
|
|
143
|
+
// The details cell content is rendered later in the `__updateRow` method.
|
|
144
144
|
if (this.rowDetailsRenderer) {
|
|
145
145
|
cell._renderer = this.rowDetailsRenderer;
|
|
146
146
|
}
|
|
@@ -122,10 +122,23 @@ export const ScrollMixin = (superClass) =>
|
|
|
122
122
|
const row = composedPath[composedPath.indexOf(this.$.items) - 1];
|
|
123
123
|
|
|
124
124
|
if (row) {
|
|
125
|
-
//
|
|
126
|
-
// Don't change scroll position if the user is interacting with the mouse
|
|
125
|
+
// Don't change scroll position if the user is interacting with the mouse.
|
|
127
126
|
if (!this._isMousedown) {
|
|
128
|
-
|
|
127
|
+
// Make sure the focused element (row, cell, or focusable element inside a cell)
|
|
128
|
+
// is inside the viewport. If the whole row fits into the viewport, then scroll
|
|
129
|
+
// the row into view. This ensures that labels, helper texts and other related
|
|
130
|
+
// elements of focusable elements within cells also become visible. When the row
|
|
131
|
+
// is larger than the viewport, scroll the focus event target into the viewport.
|
|
132
|
+
// This works better when focusing elements within cells, which could otherwise
|
|
133
|
+
// still be outside the viewport when scrolling to the top or bottom of the row.
|
|
134
|
+
const tableHeight = this.$.table.clientHeight;
|
|
135
|
+
const headerHeight = this.$.header.clientHeight;
|
|
136
|
+
const footerHeight = this.$.footer.clientHeight;
|
|
137
|
+
const viewportHeight = tableHeight - headerHeight - footerHeight;
|
|
138
|
+
const isRowLargerThanViewport = row.clientHeight > viewportHeight;
|
|
139
|
+
const scrollTarget = isRowLargerThanViewport ? e.target : row;
|
|
140
|
+
|
|
141
|
+
this.__scrollIntoViewport(scrollTarget);
|
|
129
142
|
}
|
|
130
143
|
|
|
131
144
|
if (!this.$.table.contains(e.relatedTarget)) {
|
|
@@ -171,25 +184,27 @@ export const ScrollMixin = (superClass) =>
|
|
|
171
184
|
_scrollToFlatIndex(index) {
|
|
172
185
|
index = Math.min(this._flatSize - 1, Math.max(0, index));
|
|
173
186
|
this.__virtualizer.scrollToIndex(index);
|
|
174
|
-
this.
|
|
187
|
+
const rowElement = [...this.$.items.children].find((child) => child.index === index);
|
|
188
|
+
this.__scrollIntoViewport(rowElement);
|
|
175
189
|
}
|
|
176
190
|
|
|
177
191
|
/**
|
|
178
|
-
* Makes sure the
|
|
179
|
-
*
|
|
192
|
+
* Makes sure the given element is fully inside the visible viewport,
|
|
193
|
+
* taking header/footer into account.
|
|
180
194
|
* @private
|
|
181
195
|
*/
|
|
182
|
-
__scrollIntoViewport(
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
196
|
+
__scrollIntoViewport(element) {
|
|
197
|
+
if (!element) {
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
const dstRect = element.getBoundingClientRect();
|
|
202
|
+
const footerTop = this.$.footer.getBoundingClientRect().top;
|
|
203
|
+
const headerBottom = this.$.header.getBoundingClientRect().bottom;
|
|
204
|
+
if (dstRect.bottom > footerTop) {
|
|
205
|
+
this.$.table.scrollTop += dstRect.bottom - footerTop;
|
|
206
|
+
} else if (dstRect.top < headerBottom) {
|
|
207
|
+
this.$.table.scrollTop -= headerBottom - dstRect.top;
|
|
193
208
|
}
|
|
194
209
|
}
|
|
195
210
|
|
|
@@ -476,6 +491,7 @@ export const ScrollMixin = (superClass) =>
|
|
|
476
491
|
|
|
477
492
|
// Position frozen cells
|
|
478
493
|
const x = this.__isRTL ? normalizedScrollLeft + clientWidth - scrollWidth : scrollLeft;
|
|
494
|
+
this.__horizontalScrollPosition = x;
|
|
479
495
|
const transformFrozen = `translate(${x}px, 0)`;
|
|
480
496
|
this._frozenCells.forEach((cell) => {
|
|
481
497
|
cell.style.transform = transformFrozen;
|
|
@@ -511,10 +527,25 @@ export const ScrollMixin = (superClass) =>
|
|
|
511
527
|
}
|
|
512
528
|
});
|
|
513
529
|
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
this
|
|
530
|
+
const focusedRow = this.shadowRoot.querySelector("[part~='row']:focus");
|
|
531
|
+
if (focusedRow) {
|
|
532
|
+
// Update the horizontal scroll position property of the focused row
|
|
533
|
+
this.__updateRowScrollPositionProperty(focusedRow);
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
/**
|
|
538
|
+
* Synchronizes the internal `--_grid-horizontal-scroll-position` CSS property
|
|
539
|
+
* of the given row with the current horizontal scroll position of the grid.
|
|
540
|
+
* @private
|
|
541
|
+
*/
|
|
542
|
+
__updateRowScrollPositionProperty(row) {
|
|
543
|
+
if (row instanceof HTMLTableRowElement === false) {
|
|
544
|
+
return;
|
|
545
|
+
}
|
|
546
|
+
const newValue = `${this.__horizontalScrollPosition}px`;
|
|
547
|
+
if (row.style.getPropertyValue('--_grid-horizontal-scroll-position') !== newValue) {
|
|
548
|
+
row.style.setProperty('--_grid-horizontal-scroll-position', newValue);
|
|
518
549
|
}
|
|
519
550
|
}
|
|
520
551
|
|
|
@@ -3,66 +3,6 @@
|
|
|
3
3
|
* Copyright (c) 2016 - 2025 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
7
|
-
|
|
8
|
-
const template = document.createElement('template');
|
|
9
|
-
|
|
10
|
-
template.innerHTML = `
|
|
11
|
-
<style>
|
|
12
|
-
@font-face {
|
|
13
|
-
font-family: 'vaadin-grid-sorter-icons';
|
|
14
|
-
src: url(data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAAAQwAA0AAAAABuwAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABGRlRNAAAEFAAAABkAAAAcfep+mUdERUYAAAP4AAAAHAAAAB4AJwAOT1MvMgAAAZgAAAA/AAAAYA8TBPpjbWFwAAAB7AAAAFUAAAFeF1fZ4mdhc3AAAAPwAAAACAAAAAgAAAAQZ2x5ZgAAAlgAAABcAAAAnMvguMloZWFkAAABMAAAAC8AAAA2C5Ap72hoZWEAAAFgAAAAHQAAACQGbQPHaG10eAAAAdgAAAAUAAAAHAoAAABsb2NhAAACRAAAABIAAAASAIwAYG1heHAAAAGAAAAAFgAAACAACwAKbmFtZQAAArQAAAECAAACZxWCgKhwb3N0AAADuAAAADUAAABZCrApUXicY2BkYGAA4rDECVrx/DZfGbhZGEDgyqNPOxH0/wNMq5kPALkcDEwgUQBWRA0dAHicY2BkYGA+8P8AAwMLAwgwrWZgZEAFbABY4QM8AAAAeJxjYGRgYOAAQiYGEICQSAAAAi8AFgAAeJxjYGY6yziBgZWBgWkm0xkGBoZ+CM34msGYkZMBFTAKoAkwODAwvmRiPvD/AIMDMxCD1CDJKjAwAgBktQsXAHicY2GAAMZQCM0EwqshbAALxAEKeJxjYGBgZoBgGQZGBhCIAPIYwXwWBhsgzcXAwcAEhIwMCi+Z/v/9/x+sSuElA4T9/4k4K1gHFwMMMILMY2QDYmaoABOQYGJABUA7WBiGNwAAJd4NIQAAAAAAAAAACAAIABAAGAAmAEAATgAAeJyNjLENgDAMBP9tIURJwQCMQccSZgk2i5fIYBDAidJjycXr7x5EPwE2wY8si7jmyBNXGo/bNBerxJNrpxhbO3/fEFpx8ZICpV+ghxJ74fAMe+h7Ox14AbrsHB14nK2QQWrDMBRER4mTkhQK3ZRQKOgCNk7oGQqhhEIX2WSlWEI1BAlkJ5CDdNsj5Ey9Rncdi38ES+jzNJo/HwTgATcoDEthhY3wBHc4CE+pfwsX5F/hGe7Vo/AcK/UhvMSz+mGXKhZU6pww8ISz3oWn1BvhgnwTnuEJf8Jz1OpFeIlX9YULDLdFi4ASHolkSR0iuYdjLak1vAequBhj21D61Nqyi6l3qWybGPjySbPHGScGJl6dP58MYcQRI0bts7mjebBqrFENH7t3qWtj0OuqHnXcW7b0HOTZFnKryRGW2hFX1m0O2vEM3opNMfTau+CS6Z3Vx6veNnEXY6jwDxhsc2gAAHicY2BiwA84GBgYmRiYGJkZmBlZGFkZ2djScyoLMgzZS/MyDQwMwLSrpYEBlIbxjQDrzgsuAAAAAAEAAf//AA94nGNgZGBg4AFiMSBmYmAEQnYgZgHzGAAD6wA2eJxjYGBgZACCKyoz1cD0o087YTQATOcIewAAAA==) format('woff');
|
|
15
|
-
font-weight: normal;
|
|
16
|
-
font-style: normal;
|
|
17
|
-
}
|
|
18
|
-
</style>
|
|
19
|
-
`;
|
|
20
|
-
|
|
21
|
-
document.head.appendChild(template.content);
|
|
22
|
-
|
|
23
|
-
registerStyles(
|
|
24
|
-
'vaadin-grid-sorter',
|
|
25
|
-
css`
|
|
26
|
-
:host {
|
|
27
|
-
display: inline-flex;
|
|
28
|
-
cursor: pointer;
|
|
29
|
-
max-width: 100%;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
[part='content'] {
|
|
33
|
-
flex: 1 1 auto;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
[part='indicators'] {
|
|
37
|
-
position: relative;
|
|
38
|
-
align-self: center;
|
|
39
|
-
flex: none;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
[part='order'] {
|
|
43
|
-
display: inline;
|
|
44
|
-
vertical-align: super;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
[part='indicators']::before {
|
|
48
|
-
font-family: 'vaadin-grid-sorter-icons';
|
|
49
|
-
display: inline-block;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
:host(:not([direction])) [part='indicators']::before {
|
|
53
|
-
content: '\\e901';
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
:host([direction='asc']) [part='indicators']::before {
|
|
57
|
-
content: '\\e900';
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
:host([direction='desc']) [part='indicators']::before {
|
|
61
|
-
content: '\\e902';
|
|
62
|
-
}
|
|
63
|
-
`,
|
|
64
|
-
{ moduleId: 'vaadin-grid-sorter-styles' },
|
|
65
|
-
);
|
|
66
6
|
|
|
67
7
|
/**
|
|
68
8
|
* A mixin providing common sorter functionality.
|
|
@@ -8,6 +8,8 @@ import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
|
8
8
|
import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
|
|
9
9
|
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
10
10
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin';
|
|
11
|
+
import { LumoInjectionMixin } from '@vaadin/vaadin-themable-mixin/lumo-injection-mixin.js';
|
|
12
|
+
import { gridSorterStyles } from './styles/vaadin-grid-sorter-core-styles.js';
|
|
11
13
|
import { GridSorterMixin } from './vaadin-grid-sorter-mixin.js';
|
|
12
14
|
|
|
13
15
|
/**
|
|
@@ -55,11 +57,15 @@ import { GridSorterMixin } from './vaadin-grid-sorter-mixin.js';
|
|
|
55
57
|
* @mixes ThemableMixin
|
|
56
58
|
* @mixes DirMixin
|
|
57
59
|
*/
|
|
58
|
-
class GridSorter extends GridSorterMixin(ThemableMixin(DirMixin(PolylitMixin(LitElement)))) {
|
|
60
|
+
class GridSorter extends GridSorterMixin(ThemableMixin(DirMixin(PolylitMixin(LumoInjectionMixin(LitElement))))) {
|
|
59
61
|
static get is() {
|
|
60
62
|
return 'vaadin-grid-sorter';
|
|
61
63
|
}
|
|
62
64
|
|
|
65
|
+
static get styles() {
|
|
66
|
+
return gridSorterStyles;
|
|
67
|
+
}
|
|
68
|
+
|
|
63
69
|
/** @protected */
|
|
64
70
|
render() {
|
|
65
71
|
return html`
|
|
@@ -3,85 +3,8 @@
|
|
|
3
3
|
* Copyright (c) 2016 - 2025 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
7
6
|
import { isFocusable } from './vaadin-grid-active-item-mixin.js';
|
|
8
7
|
|
|
9
|
-
const template = document.createElement('template');
|
|
10
|
-
|
|
11
|
-
template.innerHTML = `
|
|
12
|
-
<style>
|
|
13
|
-
@font-face {
|
|
14
|
-
font-family: "vaadin-grid-tree-icons";
|
|
15
|
-
src: url(data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAAAQkAA0AAAAABrwAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABGRlRNAAAECAAAABoAAAAcgHwa6EdERUYAAAPsAAAAHAAAAB4AJwAOT1MvMgAAAZQAAAA/AAAAYA8TBIJjbWFwAAAB8AAAAFUAAAFeGJvXWmdhc3AAAAPkAAAACAAAAAgAAAAQZ2x5ZgAAAlwAAABLAAAAhIrPOhFoZWFkAAABMAAAACsAAAA2DsJI02hoZWEAAAFcAAAAHQAAACQHAgPHaG10eAAAAdQAAAAZAAAAHAxVAgBsb2NhAAACSAAAABIAAAASAIAAVG1heHAAAAF8AAAAGAAAACAACgAFbmFtZQAAAqgAAAECAAACTwflzbdwb3N0AAADrAAAADYAAABZQ7Ajh3icY2BkYGAA4twv3Vfi+W2+MnCzMIDANSOmbGSa2YEZRHEwMIEoAAoiB6sAeJxjYGRgYD7w/wADAwsDCDA7MDAyoAI2AFEEAtIAAAB4nGNgZGBg4GBgZgDRDAxMDGgAAAGbABB4nGNgZp7JOIGBlYGBaSbTGQYGhn4IzfiawZiRkwEVMAqgCTA4MDA+38d84P8BBgdmIAapQZJVYGAEAGc/C54AeJxjYYAAxlAIzQTELAwMBxgZGB0ACy0BYwAAAHicY2BgYGaAYBkGRgYQiADyGMF8FgYbIM3FwMHABISMDArP9/3/+/8/WJXC8z0Q9v8nEp5gHVwMMMAIMo+RDYiZoQJMQIKJARUA7WBhGN4AACFKDtoAAAAAAAAAAAgACAAQABgAJgA0AEIAAHichYvBEYBADAKBVHBjBT4swl9KS2k05o0XHd/yW1hAfBFwCv9sIlJu3nZaNS3PXAaXXHI8Lge7DlzF7C1RgXc7xkK6+gvcD2URmQB4nK2RQWoCMRiFX3RUqtCli65yADModOMBLLgQSqHddRFnQghIAnEUvEA3vUUP0LP0Fj1G+yb8R5iEhO9/ef/7FwFwj28o9EthiVp4hBlehcfUP4Ur8o/wBAv8CU+xVFvhOR7UB7tUdUdlVRJ6HnHWTnhM/V24In8JT5j/KzzFSi2E53hUz7jCcrcIiDDwyKSW1JEct2HdIPH1DFytbUM0PofWdNk5E5oUqb/Q6HHBiVGZpfOXkyUMEj5IyBuNmYZQjBobfsuassvnkKLe1OuBBj0VQ8cRni2xjLWsHaM0jrjx3peYA0/vrdmUYqe9iy7bzrX6eNP7Jh1SijX+AaUVbB8AAHicY2BiwA84GBgYmRiYGJkZmBlZGFkZ2djScyoLMgzZS/MyDQwMwLSruZMzlHaB0q4A76kLlwAAAAEAAf//AA94nGNgZGBg4AFiMSBmYmAEQnYgZgHzGAAD6wA2eJxjYGBgZACCKxJigiD6mhFTNowGACmcA/8AAA==) format('woff');
|
|
16
|
-
font-weight: normal;
|
|
17
|
-
font-style: normal;
|
|
18
|
-
}
|
|
19
|
-
</style>
|
|
20
|
-
`;
|
|
21
|
-
|
|
22
|
-
document.head.appendChild(template.content);
|
|
23
|
-
|
|
24
|
-
registerStyles(
|
|
25
|
-
'vaadin-grid-tree-toggle',
|
|
26
|
-
css`
|
|
27
|
-
:host {
|
|
28
|
-
display: inline-flex;
|
|
29
|
-
align-items: baseline;
|
|
30
|
-
max-width: 100%;
|
|
31
|
-
|
|
32
|
-
/* CSS API for :host */
|
|
33
|
-
--vaadin-grid-tree-toggle-level-offset: 1em;
|
|
34
|
-
--_collapsed-icon: '\\e7be\\00a0';
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
:host([dir='rtl']) {
|
|
38
|
-
--_collapsed-icon: '\\e7bd\\00a0';
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
:host([hidden]) {
|
|
42
|
-
display: none !important;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
:host(:not([leaf])) {
|
|
46
|
-
cursor: pointer;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
#level-spacer,
|
|
50
|
-
[part='toggle'] {
|
|
51
|
-
flex: none;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
#level-spacer {
|
|
55
|
-
display: inline-block;
|
|
56
|
-
width: calc(var(--_level, '0') * var(--vaadin-grid-tree-toggle-level-offset));
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
[part='toggle']::before {
|
|
60
|
-
font-family: 'vaadin-grid-tree-icons';
|
|
61
|
-
line-height: 1em; /* make icon font metrics not affect baseline */
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
:host(:not([expanded])) [part='toggle']::before {
|
|
65
|
-
content: var(--_collapsed-icon);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
:host([expanded]) [part='toggle']::before {
|
|
69
|
-
content: '\\e7bc\\00a0'; /* icon glyph + single non-breaking space */
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
:host([leaf]) [part='toggle'] {
|
|
73
|
-
visibility: hidden;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
slot {
|
|
77
|
-
display: block;
|
|
78
|
-
overflow: hidden;
|
|
79
|
-
text-overflow: ellipsis;
|
|
80
|
-
}
|
|
81
|
-
`,
|
|
82
|
-
{ moduleId: 'vaadin-grid-tree-toggle-styles' },
|
|
83
|
-
);
|
|
84
|
-
|
|
85
8
|
/**
|
|
86
9
|
* @polymerMixin
|
|
87
10
|
*/
|
|
@@ -8,6 +8,8 @@ import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
|
8
8
|
import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
|
|
9
9
|
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
10
10
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin';
|
|
11
|
+
import { LumoInjectionMixin } from '@vaadin/vaadin-themable-mixin/lumo-injection-mixin.js';
|
|
12
|
+
import { gridTreeToggleStyles } from './styles/vaadin-grid-tree-toggle-core-styles.js';
|
|
11
13
|
import { GridTreeToggleMixin } from './vaadin-grid-tree-toggle-mixin.js';
|
|
12
14
|
|
|
13
15
|
/**
|
|
@@ -64,11 +66,17 @@ import { GridTreeToggleMixin } from './vaadin-grid-tree-toggle-mixin.js';
|
|
|
64
66
|
* @mixes DirMixin
|
|
65
67
|
* @mixes GridTreeToggleMixin
|
|
66
68
|
*/
|
|
67
|
-
class GridTreeToggle extends GridTreeToggleMixin(
|
|
69
|
+
class GridTreeToggle extends GridTreeToggleMixin(
|
|
70
|
+
ThemableMixin(DirMixin(PolylitMixin(LumoInjectionMixin(LitElement)))),
|
|
71
|
+
) {
|
|
68
72
|
static get is() {
|
|
69
73
|
return 'vaadin-grid-tree-toggle';
|
|
70
74
|
}
|
|
71
75
|
|
|
76
|
+
static get styles() {
|
|
77
|
+
return gridTreeToggleStyles;
|
|
78
|
+
}
|
|
79
|
+
|
|
72
80
|
/** @protected */
|
|
73
81
|
render() {
|
|
74
82
|
return html`
|
package/src/vaadin-grid.d.ts
CHANGED
|
@@ -102,7 +102,7 @@ export type GridDefaultItem = any;
|
|
|
102
102
|
* - [`<vaadin-grid-tree-toggle>`](#/elements/vaadin-grid-tree-toggle)
|
|
103
103
|
*
|
|
104
104
|
* __Note that the helper elements must be explicitly imported.__
|
|
105
|
-
* If you want to import everything at once you can use the `all-imports.
|
|
105
|
+
* If you want to import everything at once you can use the `all-imports.js` entrypoint.
|
|
106
106
|
*
|
|
107
107
|
* ### Lazy Loading with Function Data Provider
|
|
108
108
|
*
|
package/src/vaadin-grid.js
CHANGED
|
@@ -9,9 +9,10 @@ import { ifDefined } from 'lit/directives/if-defined.js';
|
|
|
9
9
|
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
10
10
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
11
11
|
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
12
|
+
import { LumoInjectionMixin } from '@vaadin/vaadin-themable-mixin/lumo-injection-mixin.js';
|
|
12
13
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
14
|
+
import { gridStyles } from './styles/vaadin-grid-core-styles.js';
|
|
13
15
|
import { GridMixin } from './vaadin-grid-mixin.js';
|
|
14
|
-
import { gridStyles } from './vaadin-grid-styles.js';
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
18
|
* `<vaadin-grid>` is a free, high quality data grid / data table Web Component. The content of the
|
|
@@ -102,7 +103,7 @@ import { gridStyles } from './vaadin-grid-styles.js';
|
|
|
102
103
|
* - [`<vaadin-grid-tree-toggle>`](#/elements/vaadin-grid-tree-toggle)
|
|
103
104
|
*
|
|
104
105
|
* __Note that the helper elements must be explicitly imported.__
|
|
105
|
-
* If you want to import everything at once you can use the `all-imports.
|
|
106
|
+
* If you want to import everything at once you can use the `all-imports.js` entrypoint.
|
|
106
107
|
*
|
|
107
108
|
* ### Lazy Loading with Function Data Provider
|
|
108
109
|
*
|
|
@@ -261,7 +262,7 @@ import { gridStyles } from './vaadin-grid-styles.js';
|
|
|
261
262
|
* @mixes GridMixin
|
|
262
263
|
* @mixes ThemableMixin
|
|
263
264
|
*/
|
|
264
|
-
class Grid extends GridMixin(ElementMixin(ThemableMixin(PolylitMixin(LitElement)))) {
|
|
265
|
+
class Grid extends GridMixin(ElementMixin(ThemableMixin(PolylitMixin(LumoInjectionMixin(LitElement))))) {
|
|
265
266
|
static get is() {
|
|
266
267
|
return 'vaadin-grid';
|
|
267
268
|
}
|