@vaadin/grid 23.2.0-alpha3 → 23.2.0-alpha6

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/grid",
3
- "version": "23.2.0-alpha3",
3
+ "version": "23.2.0-alpha6",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -26,7 +26,9 @@
26
26
  "src",
27
27
  "theme",
28
28
  "vaadin-*.d.ts",
29
- "vaadin-*.js"
29
+ "vaadin-*.js",
30
+ "web-types.json",
31
+ "web-types.lit.json"
30
32
  ],
31
33
  "keywords": [
32
34
  "vaadin",
@@ -43,20 +45,24 @@
43
45
  "dependencies": {
44
46
  "@open-wc/dedupe-mixin": "^1.3.0",
45
47
  "@polymer/polymer": "^3.0.0",
46
- "@vaadin/checkbox": "23.2.0-alpha3",
47
- "@vaadin/component-base": "23.2.0-alpha3",
48
- "@vaadin/lit-renderer": "23.2.0-alpha3",
49
- "@vaadin/text-field": "23.2.0-alpha3",
50
- "@vaadin/vaadin-lumo-styles": "23.2.0-alpha3",
51
- "@vaadin/vaadin-material-styles": "23.2.0-alpha3",
52
- "@vaadin/vaadin-themable-mixin": "23.2.0-alpha3"
48
+ "@vaadin/checkbox": "23.2.0-alpha6",
49
+ "@vaadin/component-base": "23.2.0-alpha6",
50
+ "@vaadin/lit-renderer": "23.2.0-alpha6",
51
+ "@vaadin/text-field": "23.2.0-alpha6",
52
+ "@vaadin/vaadin-lumo-styles": "23.2.0-alpha6",
53
+ "@vaadin/vaadin-material-styles": "23.2.0-alpha6",
54
+ "@vaadin/vaadin-themable-mixin": "23.2.0-alpha6"
53
55
  },
54
56
  "devDependencies": {
55
57
  "@esm-bundle/chai": "^4.3.4",
56
- "@vaadin/polymer-legacy-adapter": "23.2.0-alpha3",
58
+ "@vaadin/polymer-legacy-adapter": "23.2.0-alpha6",
57
59
  "@vaadin/testing-helpers": "^0.3.2",
58
60
  "lit": "^2.0.0",
59
61
  "sinon": "^13.0.2"
60
62
  },
61
- "gitHead": "06e5875be93ca50da2846dafc65a8531010c0576"
63
+ "web-types": [
64
+ "web-types.json",
65
+ "web-types.lit.json"
66
+ ],
67
+ "gitHead": "61f1fb56953434e97d34a8819640064301dd3d8a"
62
68
  }
@@ -22,12 +22,10 @@ function checkPaths(arrayToCheck, action, items) {
22
22
 
23
23
  let result = true;
24
24
 
25
- for (const i in arrayToCheck) {
26
- const path = arrayToCheck[i].path;
27
-
25
+ arrayToCheck.forEach(({ path }) => {
28
26
  // Skip simple paths
29
27
  if (!path || path.indexOf('.') === -1) {
30
- continue;
28
+ return;
31
29
  }
32
30
 
33
31
  const parentProperty = path.replace(/\.[^.]*$/, ''); // A.b.c -> a.b
@@ -35,7 +33,7 @@ function checkPaths(arrayToCheck, action, items) {
35
33
  console.warn(`Path "${path}" used for ${action} does not exist in all of the items, ${action} is disabled.`);
36
34
  result = false;
37
35
  }
38
- }
36
+ });
39
37
 
40
38
  return result;
41
39
  }
@@ -27,7 +27,7 @@ declare abstract class AbstractGridColumnRendererDirective<R extends LitRenderer
27
27
  /**
28
28
  * A property to that the renderer callback will be assigned.
29
29
  */
30
- abstract rendererProperty: 'renderer' | 'headerRenderer' | 'footerRenderer';
30
+ abstract rendererProperty: 'footerRenderer' | 'headerRenderer' | 'renderer';
31
31
 
32
32
  /**
33
33
  * Adds the renderer callback to the grid column.
@@ -7,7 +7,7 @@ import type { Constructor } from '@open-wc/dedupe-mixin';
7
7
 
8
8
  export declare function ActiveItemMixin<TItem, T extends Constructor<HTMLElement>>(
9
9
  base: T,
10
- ): T & Constructor<ActiveItemMixinClass<TItem>>;
10
+ ): Constructor<ActiveItemMixinClass<TItem>> & T;
11
11
 
12
12
  export declare class ActiveItemMixinClass<TItem> {
13
13
  /**
@@ -7,7 +7,7 @@ import type { Constructor } from '@open-wc/dedupe-mixin';
7
7
 
8
8
  export declare function ArrayDataProviderMixin<TItem, T extends Constructor<HTMLElement>>(
9
9
  base: T,
10
- ): T & Constructor<ArrayDataProviderMixinClass<TItem>>;
10
+ ): Constructor<ArrayDataProviderMixinClass<TItem>> & T;
11
11
 
12
12
  export declare class ArrayDataProviderMixinClass<TItem> {
13
13
  /**
@@ -7,7 +7,7 @@ import type { Constructor } from '@open-wc/dedupe-mixin';
7
7
 
8
8
  export declare function ColumnReorderingMixin<T extends Constructor<HTMLElement>>(
9
9
  base: T,
10
- ): T & Constructor<ColumnReorderingMixinClass>;
10
+ ): Constructor<ColumnReorderingMixinClass> & T;
11
11
 
12
12
  export declare class ColumnReorderingMixinClass {
13
13
  /**
@@ -12,13 +12,13 @@ export type GridBodyRenderer<TItem> = (
12
12
  model: GridItemModel<TItem>,
13
13
  ) => void;
14
14
 
15
- export type GridColumnTextAlign = 'start' | 'center' | 'end' | null;
15
+ export type GridColumnTextAlign = 'center' | 'end' | 'start' | null;
16
16
 
17
17
  export type GridHeaderFooterRenderer<TItem> = (root: HTMLElement, column: GridColumn<TItem>) => void;
18
18
 
19
19
  export declare function ColumnBaseMixin<TItem, T extends Constructor<HTMLElement>>(
20
20
  base: T,
21
- ): T & Constructor<ColumnBaseMixinClass<TItem>>;
21
+ ): Constructor<ColumnBaseMixinClass<TItem>> & T;
22
22
 
23
23
  export declare class ColumnBaseMixinClass<TItem> {
24
24
  /**
@@ -58,7 +58,7 @@ export declare class ItemCache<TItem> {
58
58
 
59
59
  export declare function DataProviderMixin<TItem, T extends Constructor<HTMLElement>>(
60
60
  base: T,
61
- ): T & Constructor<DataProviderMixinClass<TItem>>;
61
+ ): Constructor<DataProviderMixinClass<TItem>> & T;
62
62
 
63
63
  export declare class DataProviderMixinClass<TItem> {
64
64
  /**
@@ -8,13 +8,13 @@ import type { GridItemModel } from './vaadin-grid.js';
8
8
 
9
9
  export type GridDragAndDropFilter<TItem> = (model: GridItemModel<TItem>) => boolean;
10
10
 
11
- export type GridDropLocation = 'above' | 'on-top' | 'below' | 'empty';
11
+ export type GridDropLocation = 'above' | 'below' | 'empty' | 'on-top';
12
12
 
13
- export type GridDropMode = 'between' | 'on-top' | 'on-top-or-between' | 'on-grid';
13
+ export type GridDropMode = 'between' | 'on-grid' | 'on-top-or-between' | 'on-top';
14
14
 
15
15
  export declare function DragAndDropMixin<TItem, T extends Constructor<HTMLElement>>(
16
16
  base: T,
17
- ): T & Constructor<DragAndDropMixinClass<TItem>>;
17
+ ): Constructor<DragAndDropMixinClass<TItem>> & T;
18
18
 
19
19
  export declare class DragAndDropMixinClass<TItem> {
20
20
  /**
@@ -7,7 +7,7 @@ import type { Constructor } from '@open-wc/dedupe-mixin';
7
7
  import type { GridColumn } from './vaadin-grid-column.js';
8
8
 
9
9
  export interface GridEventContext<TItem> {
10
- section?: 'body' | 'header' | 'footer' | 'details';
10
+ section?: 'body' | 'details' | 'footer' | 'header';
11
11
  item?: TItem;
12
12
  column?: GridColumn<TItem>;
13
13
  index?: number;
@@ -19,7 +19,7 @@ export interface GridEventContext<TItem> {
19
19
 
20
20
  export declare function EventContextMixin<TItem, T extends Constructor<HTMLElement>>(
21
21
  base: T,
22
- ): T & Constructor<EventContextMixinClass<TItem>>;
22
+ ): Constructor<EventContextMixinClass<TItem>> & T;
23
23
 
24
24
  export declare class EventContextMixinClass<TItem> {
25
25
  /**
@@ -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?: AddEventListenerOptions | boolean,
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?: EventListenerOptions | boolean,
64
64
  ): void;
65
65
  }
66
66
 
@@ -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
- ): T & Constructor<RowDetailsMixinClass<TItem>>;
17
+ ): Constructor<RowDetailsMixinClass<TItem>> & T;
18
18
 
19
19
  export declare class RowDetailsMixinClass<TItem> {
20
20
  /**
@@ -5,7 +5,7 @@
5
5
  */
6
6
  import type { Constructor } from '@open-wc/dedupe-mixin';
7
7
 
8
- export declare function ScrollMixin<T extends Constructor<HTMLElement>>(base: T): T & Constructor<ScrollMixinClass>;
8
+ export declare function ScrollMixin<T extends Constructor<HTMLElement>>(base: T): Constructor<ScrollMixinClass> & T;
9
9
 
10
10
  export declare class ScrollMixinClass {
11
11
  /**
@@ -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?: 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?: boolean | EventListenerOptions,
66
+ options?: EventListenerOptions | boolean,
67
67
  ): void;
68
68
  }
69
69
 
@@ -184,7 +184,7 @@ class GridSelectionColumn extends GridColumn {
184
184
  return;
185
185
  }
186
186
 
187
- if (selectAll && Array.isArray(this._grid.items)) {
187
+ if (selectAll && this.__hasArrayDataProvider()) {
188
188
  this.__withFilteredItemsArray((items) => {
189
189
  this._grid.selectedItems = items;
190
190
  });
@@ -256,10 +256,15 @@ class GridSelectionColumn extends GridColumn {
256
256
  this.__previousActiveItem = activeItem;
257
257
  }
258
258
 
259
+ /** @private */
260
+ __hasArrayDataProvider() {
261
+ return Array.isArray(this._grid.items) && !!this._grid.dataProvider;
262
+ }
263
+
259
264
  /** @private */
260
265
  __onSelectedItemsChanged() {
261
266
  this._selectAllChangeLock = true;
262
- if (Array.isArray(this._grid.items)) {
267
+ if (this.__hasArrayDataProvider()) {
263
268
  this.__withFilteredItemsArray((items) => {
264
269
  if (!this._grid.selectedItems.length) {
265
270
  this.selectAll = false;
@@ -7,7 +7,7 @@ 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
- ): T & Constructor<SelectionMixinClass<TItem>>;
10
+ ): Constructor<SelectionMixinClass<TItem>> & T;
11
11
 
12
12
  export declare class SelectionMixinClass<TItem> {
13
13
  /**
@@ -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?: 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?: boolean | EventListenerOptions,
58
+ options?: EventListenerOptions | boolean,
59
59
  ): void;
60
60
  }
61
61
 
@@ -5,7 +5,7 @@
5
5
  */
6
6
  import type { Constructor } from '@open-wc/dedupe-mixin';
7
7
 
8
- export declare function SortMixin<T extends Constructor<HTMLElement>>(base: T): T & Constructor<SortMixinClass>;
8
+ export declare function SortMixin<T extends Constructor<HTMLElement>>(base: T): Constructor<SortMixinClass> & T;
9
9
 
10
10
  export declare class SortMixinClass {
11
11
  /**
@@ -28,5 +28,5 @@ export declare class SortMixinClass {
28
28
  *
29
29
  * @attr {string} multi-sort-priority
30
30
  */
31
- multiSortPriority: 'prepend' | 'append';
31
+ multiSortPriority: 'append' | 'prepend';
32
32
  }
@@ -4,6 +4,12 @@
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
 
7
+ let multiSortAppend = false;
8
+
9
+ export const setDefaultMultiSortPriorityAppend = (priority) => {
10
+ multiSortAppend = priority;
11
+ };
12
+
7
13
  /**
8
14
  * @polymerMixin
9
15
  */
@@ -37,7 +43,7 @@ export const SortMixin = (superClass) =>
37
43
  */
38
44
  multiSortPriority: {
39
45
  type: String,
40
- value: 'prepend',
46
+ value: () => (multiSortAppend ? 'append' : 'prepend'),
41
47
  },
42
48
 
43
49
  /**
@@ -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?: 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?: boolean | EventListenerOptions,
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 $_documentContainer = document.createElement('template');
10
+ const template = document.createElement('template');
11
11
 
12
- $_documentContainer.innerHTML = `
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($_documentContainer.content);
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,
@@ -11,7 +11,7 @@ export type GridCellClassNameGenerator<TItem> = (column: GridColumn<TItem>, mode
11
11
 
12
12
  export declare function StylingMixin<TItem, T extends Constructor<HTMLElement>>(
13
13
  base: T,
14
- ): T & Constructor<StylingMixinClass<TItem>>;
14
+ ): Constructor<StylingMixinClass<TItem>> & T;
15
15
 
16
16
  export declare class StylingMixinClass<TItem> {
17
17
  /**
@@ -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?: 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?: boolean | EventListenerOptions,
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 $_documentContainer = document.createElement('template');
11
+ const template = document.createElement('template');
12
12
 
13
- $_documentContainer.innerHTML = `
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($_documentContainer.content);
24
+ document.head.appendChild(template.content);
25
25
 
26
26
  /**
27
27
  * `<vaadin-grid-tree-toggle>` is a helper element for the `<vaadin-grid>`
@@ -6,6 +6,7 @@
6
6
  import type { DisabledMixinClass } from '@vaadin/component-base/src/disabled-mixin.js';
7
7
  import type { ElementMixinClass } from '@vaadin/component-base/src/element-mixin.js';
8
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';
9
10
  import type { ActiveItemMixinClass } from './vaadin-grid-active-item-mixin.js';
10
11
  import type { ArrayDataProviderMixinClass } from './vaadin-grid-array-data-provider-mixin.js';
11
12
  import type { GridColumn } from './vaadin-grid-column.js';
@@ -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` : Set when grid rows are dragged | :host
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
@@ -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?: boolean | AddEventListenerOptions,
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?: boolean | EventListenerOptions,
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>,
@@ -191,7 +191,7 @@ import { StylingMixin } from './vaadin-grid-styling-mixin.js';
191
191
  * `overflow` | Set when rows are overflowing the grid viewport. Possible values: `top`, `bottom`, `start`, `end` | :host
192
192
  * `reordering` | Set when the grid's columns are being reordered | :host
193
193
  * `dragover` | Set when the grid (not a specific row) is dragged over | :host
194
- * `dragging-rows` : Set when grid rows are dragged | :host
194
+ * `dragging-rows` | Set when grid rows are dragged | :host
195
195
  * `reorder-status` | Reflects the status of a cell while columns are being reordered | cell
196
196
  * `frozen` | Frozen cell | cell
197
197
  * `last-frozen` | Last frozen cell | cell
@@ -395,13 +395,3 @@ registerStyles(
395
395
  `,
396
396
  { moduleId: 'lumo-grid' },
397
397
  );
398
-
399
- registerStyles(
400
- 'vaadin-checkbox',
401
- css`
402
- :host(.vaadin-grid-select-all-checkbox) {
403
- font-size: var(--lumo-font-size-m);
404
- }
405
- `,
406
- { moduleId: 'vaadin-grid-select-all-checkbox-lumo' },
407
- );