@vaadin/grid 24.2.0-alpha9 → 24.2.0-beta2

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.
@@ -4,6 +4,7 @@
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import '@vaadin/checkbox/src/vaadin-checkbox.js';
7
+ import { defineCustomElement } from '@vaadin/component-base/src/define.js';
7
8
  import { GridColumn } from './vaadin-grid-column.js';
8
9
  import { GridSelectionColumnBaseMixin } from './vaadin-grid-selection-column-base-mixin.js';
9
10
 
@@ -29,6 +30,8 @@ import { GridSelectionColumnBaseMixin } from './vaadin-grid-selection-column-bas
29
30
  *
30
31
  * __The default content can also be overridden__
31
32
  *
33
+ * @customElement
34
+ * @extends GridColumn
32
35
  * @mixes GridSelectionColumnBaseMixin
33
36
  * @fires {CustomEvent} select-all-changed - Fired when the `selectAll` property changes.
34
37
  */
@@ -220,6 +223,6 @@ class GridSelectionColumn extends GridSelectionColumnBaseMixin(GridColumn) {
220
223
  }
221
224
  }
222
225
 
223
- customElements.define(GridSelectionColumn.is, GridSelectionColumn);
226
+ defineCustomElement(GridSelectionColumn);
224
227
 
225
228
  export { GridSelectionColumn };
@@ -4,6 +4,7 @@
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import './vaadin-grid-sorter.js';
7
+ import { defineCustomElement } from '@vaadin/component-base/src/define.js';
7
8
  import { GridColumn } from './vaadin-grid-column.js';
8
9
 
9
10
  /**
@@ -20,6 +21,9 @@ import { GridColumn } from './vaadin-grid-column.js';
20
21
  * ```
21
22
  *
22
23
  * @fires {CustomEvent} direction-changed - Fired when the `direction` property changes.
24
+ *
25
+ * @customElement
26
+ * @extends GridColumn
23
27
  */
24
28
  class GridSortColumn extends GridColumn {
25
29
  static get is() {
@@ -113,6 +117,6 @@ class GridSortColumn extends GridColumn {
113
117
  }
114
118
  }
115
119
 
116
- customElements.define(GridSortColumn.is, GridSortColumn);
120
+ defineCustomElement(GridSortColumn);
117
121
 
118
122
  export { GridSortColumn };
@@ -4,6 +4,7 @@
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
7
+ import { defineCustomElement } from '@vaadin/component-base/src/define.js';
7
8
  import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
8
9
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
9
10
 
@@ -61,6 +62,7 @@ document.head.appendChild(template.content);
61
62
  * @fires {CustomEvent} direction-changed - Fired when the `direction` property changes.
62
63
  * @fires {CustomEvent} sorter-changed - Fired when the `path` or `direction` property changes.
63
64
  *
65
+ * @customElement
64
66
  * @extends HTMLElement
65
67
  */
66
68
  class GridSorter extends ThemableMixin(DirMixin(PolymerElement)) {
@@ -245,6 +247,6 @@ class GridSorter extends ThemableMixin(DirMixin(PolymerElement)) {
245
247
  }
246
248
  }
247
249
 
248
- customElements.define(GridSorter.is, GridSorter);
250
+ defineCustomElement(GridSorter);
249
251
 
250
252
  export { GridSorter };
@@ -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
  import './vaadin-grid-tree-toggle.js';
7
+ import { defineCustomElement } from '@vaadin/component-base/src/define.js';
8
+ import { get } from '@vaadin/component-base/src/path-utils.js';
7
9
  import { GridColumn } from './vaadin-grid-column.js';
8
10
 
9
11
  /**
@@ -18,6 +20,8 @@ import { GridColumn } from './vaadin-grid-column.js';
18
20
  * <vaadin-grid-column>
19
21
  * ...
20
22
  * ```
23
+ * @customElement
24
+ * @extends GridColumn
21
25
  */
22
26
  class GridTreeColumn extends GridColumn {
23
27
  static get is() {
@@ -101,10 +105,10 @@ class GridTreeColumn extends GridColumn {
101
105
 
102
106
  /** @private */
103
107
  __getToggleContent(path, item) {
104
- return path && this.get(path, item);
108
+ return path && get(path, item);
105
109
  }
106
110
  }
107
111
 
108
- customElements.define(GridTreeColumn.is, GridTreeColumn);
112
+ defineCustomElement(GridTreeColumn);
109
113
 
110
114
  export { GridTreeColumn };
@@ -4,6 +4,7 @@
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
7
+ import { defineCustomElement } from '@vaadin/component-base/src/define.js';
7
8
  import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
8
9
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
9
10
  import { isFocusable } from './vaadin-grid-active-item-mixin.js';
@@ -71,6 +72,7 @@ document.head.appendChild(template.content);
71
72
  *
72
73
  * @fires {CustomEvent} expanded-changed - Fired when the `expanded` property changes.
73
74
  *
75
+ * @customElement
74
76
  * @extends HTMLElement
75
77
  * @mixes ThemableMixin
76
78
  */
@@ -207,6 +209,6 @@ class GridTreeToggle extends ThemableMixin(DirMixin(PolymerElement)) {
207
209
  }
208
210
  }
209
211
 
210
- customElements.define(GridTreeToggle.is, GridTreeToggle);
212
+ defineCustomElement(GridTreeToggle);
211
213
 
212
214
  export { GridTreeToggle };
@@ -4,165 +4,16 @@
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import type { DisabledMixinClass } from '@vaadin/a11y-base/src/disabled-mixin.js';
7
+ import type { ControllerMixinClass } from '@vaadin/component-base/src/controller-mixin.js';
7
8
  import type { ElementMixinClass } from '@vaadin/component-base/src/element-mixin.js';
8
9
  import type { ThemableMixinClass } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
9
10
  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';
16
- import {
17
- GridDataProvider,
18
- GridDataProviderCallback,
19
- GridDataProviderParams,
20
- GridFilterDefinition,
21
- GridSorterDefinition,
22
- GridSorterDirection,
23
- } from './vaadin-grid-data-provider-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 {
34
- GridCellClassNameGenerator,
35
- GridCellPartNameGenerator,
36
- StylingMixinClass,
37
- } from './vaadin-grid-styling-mixin.js';
11
+ import type { GridEventMap, GridMixinClass } from './vaadin-grid-mixin.js';
38
12
 
39
- export {
40
- GridBodyRenderer,
41
- GridCellClassNameGenerator,
42
- GridCellPartNameGenerator,
43
- GridDataProvider,
44
- GridDataProviderCallback,
45
- GridDataProviderParams,
46
- GridDragAndDropFilter,
47
- GridDropLocation,
48
- GridDropMode,
49
- GridEventContext,
50
- GridFilterDefinition,
51
- GridHeaderFooterRenderer,
52
- GridRowDetailsRenderer,
53
- GridSorterDefinition,
54
- GridSorterDirection,
55
- };
13
+ export * from './vaadin-grid-mixin.js';
56
14
 
57
15
  export type GridDefaultItem = any;
58
16
 
59
- export interface GridItemModel<TItem> {
60
- index: number;
61
- item: TItem;
62
- selected?: boolean;
63
- expanded?: boolean;
64
- level?: number;
65
- detailsOpened?: boolean;
66
- }
67
-
68
- /**
69
- * Fired when the `activeItem` property changes.
70
- */
71
- export type GridActiveItemChangedEvent<TItem> = CustomEvent<{ value: TItem | null | undefined }>;
72
-
73
- /**
74
- * Fired when the cell is activated with click or keyboard.
75
- */
76
- export type GridCellActivateEvent<TItem> = CustomEvent<{ model: GridItemModel<TItem> }>;
77
-
78
- /**
79
- * Fired when a cell is focused with click or keyboard navigation.
80
- */
81
- export type GridCellFocusEvent<TItem> = CustomEvent<{ context: GridEventContext<TItem> }>;
82
-
83
- /**
84
- * Fired when the columns in the grid are reordered.
85
- */
86
- export type GridColumnReorderEvent<TItem> = CustomEvent<{ columns: Array<GridColumn<TItem>> }>;
87
-
88
- /**
89
- * Fired when the grid column resize is finished.
90
- */
91
- export type GridColumnResizeEvent<TItem> = CustomEvent<{ resizedColumn: GridColumn<TItem> }>;
92
-
93
- /**
94
- * Fired when the `dataProvider` property changes.
95
- */
96
- export type GridDataProviderChangedEvent<TItem> = CustomEvent<{ value: GridDataProvider<TItem> }>;
97
-
98
- /**
99
- * Fired when the `expandedItems` property changes.
100
- */
101
- export type GridExpandedItemsChangedEvent<TItem> = CustomEvent<{ value: TItem[] }>;
102
-
103
- /**
104
- * Fired when starting to drag grid rows.
105
- */
106
- export type GridDragStartEvent<TItem> = CustomEvent<{
107
- draggedItems: TItem[];
108
- setDraggedItemsCount(count: number): void;
109
- setDragData(type: string, data: string): void;
110
- }>;
111
-
112
- /**
113
- * Fired when a drop occurs on top of the grid.
114
- */
115
- export type GridDropEvent<TItem> = CustomEvent<{
116
- dropTargetItem: TItem;
117
- dropLocation: GridDropLocation;
118
- dragData: Array<{ type: string; data: string }>;
119
- }>;
120
-
121
- /**
122
- * Fired when the `loading` property changes.
123
- */
124
- export type GridLoadingChangedEvent = CustomEvent<{ value: boolean }>;
125
-
126
- /**
127
- * Fired when the `selectedItems` property changes.
128
- */
129
- export type GridSelectedItemsChangedEvent<TItem> = CustomEvent<{ value: TItem[] }>;
130
-
131
- /**
132
- * Fired when the `size` property changes.
133
- */
134
- export type GridSizeChangedEvent = CustomEvent<{ value: number }>;
135
-
136
- export interface GridCustomEventMap<TItem> {
137
- 'active-item-changed': GridActiveItemChangedEvent<TItem>;
138
-
139
- 'cell-activate': GridCellActivateEvent<TItem>;
140
-
141
- 'cell-focus': GridCellFocusEvent<TItem>;
142
-
143
- 'column-reorder': GridColumnReorderEvent<TItem>;
144
-
145
- 'column-resize': GridColumnResizeEvent<TItem>;
146
-
147
- 'data-provider-changed': GridDataProviderChangedEvent<TItem>;
148
-
149
- 'expanded-items-changed': GridExpandedItemsChangedEvent<TItem>;
150
-
151
- 'grid-dragstart': GridDragStartEvent<TItem>;
152
-
153
- 'grid-dragend': Event;
154
-
155
- 'grid-drop': GridDropEvent<TItem>;
156
-
157
- 'loading-changed': GridLoadingChangedEvent;
158
-
159
- 'selected-items-changed': GridSelectedItemsChangedEvent<TItem>;
160
-
161
- 'size-changed': GridSizeChangedEvent;
162
- }
163
-
164
- export interface GridEventMap<TItem> extends HTMLElementEventMap, GridCustomEventMap<TItem> {}
165
-
166
17
  /**
167
18
  * `<vaadin-grid>` is a free, high quality data grid / data table Web Component. The content of the
168
19
  * the grid can be populated by using renderer callback function.
@@ -400,33 +251,6 @@ export interface GridEventMap<TItem> extends HTMLElementEventMap, GridCustomEven
400
251
  * @fires {CustomEvent} size-changed - Fired when the `size` property changes.
401
252
  */
402
253
  declare class Grid<TItem = GridDefaultItem> extends HTMLElement {
403
- /**
404
- * If true, the grid's height is defined by its rows.
405
- *
406
- * Effectively, this disables the grid's virtual scrolling so that all the rows are rendered in the DOM at once.
407
- * If the grid has a large number of items, using the feature is discouraged to avoid performance issues.
408
- * @attr {boolean} all-rows-visible
409
- */
410
- allRowsVisible: boolean;
411
-
412
- /**
413
- * Updates the `width` of all columns which have `autoWidth` set to `true`.
414
- */
415
- recalculateColumnWidths(): void;
416
-
417
- /**
418
- * Requests an update for the content of cells.
419
- *
420
- * While performing the update, the following renderers are invoked:
421
- * - `Grid.rowDetailsRenderer`
422
- * - `GridColumn.renderer`
423
- * - `GridColumn.headerRenderer`
424
- * - `GridColumn.footerRenderer`
425
- *
426
- * It is not guaranteed that the update happens immediately (synchronously) after it is requested.
427
- */
428
- requestContentUpdate(): void;
429
-
430
254
  addEventListener<K extends keyof GridEventMap<TItem>>(
431
255
  type: K,
432
256
  listener: (this: Grid<TItem>, ev: GridEventMap<TItem>[K]) => void,
@@ -445,17 +269,8 @@ interface Grid<TItem = GridDefaultItem>
445
269
  ElementMixinClass,
446
270
  ThemableMixinClass,
447
271
  ThemePropertyMixinClass,
448
- ActiveItemMixinClass<TItem>,
449
- ArrayDataProviderMixinClass<TItem>,
450
- DataProviderMixinClass<TItem>,
451
- RowDetailsMixinClass<TItem>,
452
- ScrollMixinClass,
453
- SelectionMixinClass<TItem>,
454
- SortMixinClass,
455
- ColumnReorderingMixinClass,
456
- EventContextMixinClass<TItem>,
457
- StylingMixinClass<TItem>,
458
- DragAndDropMixinClass<TItem> {}
272
+ ControllerMixinClass,
273
+ GridMixinClass<TItem> {}
459
274
 
460
275
  declare global {
461
276
  interface HTMLElementTagNameMap {