@vaadin/grid-pro 25.2.0-alpha1 → 25.2.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.
@@ -1066,6 +1066,20 @@
1066
1066
  "package": "@vaadin/grid/src/vaadin-grid.js"
1067
1067
  }
1068
1068
  },
1069
+ {
1070
+ "kind": "field",
1071
+ "name": "disabled",
1072
+ "privacy": "public",
1073
+ "type": {
1074
+ "text": "boolean"
1075
+ },
1076
+ "description": "If true, the user cannot interact with this element.",
1077
+ "attribute": "disabled",
1078
+ "inheritedFrom": {
1079
+ "name": "DisabledMixin",
1080
+ "package": "@vaadin/a11y-base/src/disabled-mixin.js"
1081
+ }
1082
+ },
1069
1083
  {
1070
1084
  "kind": "field",
1071
1085
  "name": "dragFilter",
@@ -1532,11 +1546,6 @@
1532
1546
  "name": "Grid",
1533
1547
  "package": "@vaadin/grid/src/vaadin-grid.js"
1534
1548
  }
1535
- },
1536
- {
1537
- "kind": "field",
1538
- "name": "slotStyles",
1539
- "readonly": true
1540
1549
  }
1541
1550
  ],
1542
1551
  "events": [
@@ -1577,7 +1586,7 @@
1577
1586
  "type": {
1578
1587
  "text": "CustomEvent"
1579
1588
  },
1580
- "description": "Fired when a cell is focused with click or keyboard navigation.",
1589
+ "description": "Fired when a cell is focused with click or keyboard navigation. Use the `context` property to read event details.",
1581
1590
  "name": "cell-focus",
1582
1591
  "inheritedFrom": {
1583
1592
  "name": "Grid",
@@ -1666,7 +1675,7 @@
1666
1675
  "type": {
1667
1676
  "text": "CustomEvent"
1668
1677
  },
1669
- "description": "Fired before exiting the cell edit mode, if the value has been changed.",
1678
+ "description": "Fired before exiting cell edit mode if the value has been changed. If the default is prevented, the value change is not applied.",
1670
1679
  "inheritedFrom": {
1671
1680
  "name": "InlineEditingMixin",
1672
1681
  "module": "src/vaadin-grid-pro-inline-editing-mixin.js"
@@ -1818,6 +1827,18 @@
1818
1827
  "package": "@vaadin/grid/src/vaadin-grid.js"
1819
1828
  }
1820
1829
  },
1830
+ {
1831
+ "name": "disabled",
1832
+ "type": {
1833
+ "text": "boolean"
1834
+ },
1835
+ "description": "If true, the user cannot interact with this element.",
1836
+ "fieldName": "disabled",
1837
+ "inheritedFrom": {
1838
+ "name": "DisabledMixin",
1839
+ "package": "@vaadin/a11y-base/src/disabled-mixin.js"
1840
+ }
1841
+ },
1821
1842
  {
1822
1843
  "name": "drag-filter",
1823
1844
  "type": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/grid-pro",
3
- "version": "25.2.0-alpha1",
3
+ "version": "25.2.0-alpha10",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -37,22 +37,22 @@
37
37
  ],
38
38
  "dependencies": {
39
39
  "@open-wc/dedupe-mixin": "^1.3.0",
40
- "@vaadin/a11y-base": "25.2.0-alpha1",
41
- "@vaadin/checkbox": "25.2.0-alpha1",
42
- "@vaadin/component-base": "25.2.0-alpha1",
43
- "@vaadin/grid": "25.2.0-alpha1",
44
- "@vaadin/lit-renderer": "25.2.0-alpha1",
45
- "@vaadin/select": "25.2.0-alpha1",
46
- "@vaadin/text-field": "25.2.0-alpha1",
47
- "@vaadin/vaadin-themable-mixin": "25.2.0-alpha1",
40
+ "@vaadin/a11y-base": "25.2.0-alpha10",
41
+ "@vaadin/checkbox": "25.2.0-alpha10",
42
+ "@vaadin/component-base": "25.2.0-alpha10",
43
+ "@vaadin/grid": "25.2.0-alpha10",
44
+ "@vaadin/lit-renderer": "25.2.0-alpha10",
45
+ "@vaadin/select": "25.2.0-alpha10",
46
+ "@vaadin/text-field": "25.2.0-alpha10",
47
+ "@vaadin/vaadin-themable-mixin": "25.2.0-alpha10",
48
48
  "lit": "^3.0.0"
49
49
  },
50
50
  "devDependencies": {
51
- "@vaadin/aura": "25.2.0-alpha1",
52
- "@vaadin/chai-plugins": "25.2.0-alpha1",
53
- "@vaadin/test-runner-commands": "25.2.0-alpha1",
51
+ "@vaadin/aura": "25.2.0-alpha10",
52
+ "@vaadin/chai-plugins": "25.2.0-alpha10",
53
+ "@vaadin/test-runner-commands": "25.2.0-alpha10",
54
54
  "@vaadin/testing-helpers": "^2.0.0",
55
- "@vaadin/vaadin-lumo-styles": "25.2.0-alpha1",
55
+ "@vaadin/vaadin-lumo-styles": "25.2.0-alpha10",
56
56
  "sinon": "^21.0.2"
57
57
  },
58
58
  "cvdlName": "vaadin-grid-pro",
@@ -61,5 +61,5 @@
61
61
  "web-types.json",
62
62
  "web-types.lit.json"
63
63
  ],
64
- "gitHead": "866f813f89655a351cbd25328eba1fcb317e267d"
64
+ "gitHead": "1303b6a3eeecb44a9d26f2b53cb56d9e906febdf"
65
65
  }
@@ -60,7 +60,6 @@ export const GridProEditColumnMixin = (superClass) =>
60
60
  */
61
61
  editorType: {
62
62
  type: String,
63
- notify: true, // FIXME(web-padawan): needed by Flow counterpart
64
63
  value: 'text',
65
64
  },
66
65
 
@@ -29,7 +29,9 @@ export * from './vaadin-grid-pro-edit-column-mixin.js';
29
29
  * ...
30
30
  * ```
31
31
  */
32
- declare class GridProEditColumn<TItem = GridDefaultItem> extends HTMLElement {}
32
+ declare class GridProEditColumn<TItem = GridDefaultItem> extends HTMLElement {
33
+ hidden: boolean;
34
+ }
33
35
 
34
36
  interface GridProEditColumn<TItem = GridDefaultItem>
35
37
  extends GridProEditColumnMixinClass<TItem>, GridColumnMixin<TItem, GridColumn<TItem>>, GridColumn<TItem> {}
@@ -96,13 +96,13 @@ export const GridProEditSelectMixin = (superClass) =>
96
96
  }
97
97
 
98
98
  _optionsChanged(options) {
99
- if (options && options.length) {
99
+ if (options?.length) {
100
100
  this.items = options.map((option) => ({
101
101
  label: option,
102
102
  value: option,
103
103
  }));
104
104
 
105
- this._overlayElement = this._overlayElement || this.shadowRoot.querySelector('vaadin-select-overlay');
105
+ this._overlayElement ||= this.shadowRoot.querySelector('vaadin-select-overlay');
106
106
  this._overlayElement.addEventListener('vaadin-overlay-outside-click', () => {
107
107
  this._grid._stopEdit();
108
108
  });
@@ -28,7 +28,6 @@ export const InlineEditingMixin = (superClass) =>
28
28
  */
29
29
  enterNextRow: {
30
30
  type: Boolean,
31
- notify: true, // FIXME(yuriy-fix): needed by Flow counterpart
32
31
  },
33
32
 
34
33
  /**
@@ -41,7 +40,6 @@ export const InlineEditingMixin = (superClass) =>
41
40
  */
42
41
  singleCellEdit: {
43
42
  type: Boolean,
44
- notify: true, // FIXME(yuriy-fix): needed by Flow counterpart
45
43
  },
46
44
 
47
45
  /**
@@ -230,7 +228,7 @@ export const InlineEditingMixin = (superClass) =>
230
228
  return;
231
229
  }
232
230
 
233
- if (edited && edited.cell === cell) {
231
+ if (edited?.cell === cell) {
234
232
  return;
235
233
  }
236
234
 
@@ -257,7 +255,7 @@ export const InlineEditingMixin = (superClass) =>
257
255
 
258
256
  /** @private */
259
257
  _isEditColumn(column) {
260
- return column && column.localName.toLowerCase() === 'vaadin-grid-pro-edit-column';
258
+ return column?.localName.toLowerCase() === 'vaadin-grid-pro-edit-column';
261
259
  }
262
260
 
263
261
  /** @private */
@@ -303,7 +301,7 @@ export const InlineEditingMixin = (superClass) =>
303
301
  return;
304
302
  }
305
303
 
306
- if (edited && edited.cell === cell && column._getEditorComponent(cell).contains(e.target)) {
304
+ if (edited?.cell === cell && column._getEditorComponent(cell).contains(e.target)) {
307
305
  return;
308
306
  }
309
307
 
@@ -325,6 +323,19 @@ export const InlineEditingMixin = (superClass) =>
325
323
  this._debouncerStopEdit = Debouncer.debounce(this._debouncerStopEdit, animationFrame, this._stopEdit.bind(this));
326
324
  }
327
325
 
326
+ /**
327
+ * Override method from ScrollMixin to stop editing if the edited cell
328
+ * is scrolled out of the view and removed from the DOM.
329
+ * @private
330
+ */
331
+ __updateColumnsBodyContentHidden() {
332
+ super.__updateColumnsBodyContentHidden();
333
+
334
+ if (this.__edited && !this.__edited.cell.isConnected) {
335
+ this._stopEdit(true, false);
336
+ }
337
+ }
338
+
328
339
  /** @private */
329
340
  __shouldIgnoreFocusOut(event) {
330
341
  const edited = this.__edited;
@@ -357,9 +368,11 @@ export const InlineEditingMixin = (superClass) =>
357
368
  // Cancel debouncer enqueued on focusout
358
369
  this._cancelStopEdit();
359
370
 
360
- this._scrollHorizontallyToCell(cell);
371
+ // Scroll column into view synchronously, which also triggers lazy column
372
+ // rendering to ensure cells for that column are in the DOM.
373
+ this.scrollToColumn(column);
361
374
 
362
- const model = this.__getRowModel(cell.parentElement);
375
+ const model = this.__getRowModel(cell.__parentRow);
363
376
  this.__edited = { cell, column, model };
364
377
  column._startCellEdit(cell, model);
365
378
 
@@ -448,7 +461,7 @@ export const InlineEditingMixin = (superClass) =>
448
461
 
449
462
  // Do not prevent Tab to allow native input blur and wait for it,
450
463
  // unless the keydown event is from the edit cell select overlay.
451
- if (e.key === 'Tab' && editor && editor.contains(e.target)) {
464
+ if (e.key === 'Tab' && editor?.contains(e.target)) {
452
465
  const ignore = await new Promise((resolve) => {
453
466
  editor.addEventListener(
454
467
  'focusout',
@@ -505,7 +518,7 @@ export const InlineEditingMixin = (superClass) =>
505
518
  // Stop looking if the next cell is editable
506
519
  const nextRow = this._getRowByIndex(nextIndex);
507
520
  // eslint-disable-next-line @typescript-eslint/no-loop-func
508
- nextCell = nextRow && Array.from(nextRow.children).find((cell) => cell._column === nextColumn);
521
+ nextCell = nextRow && Array.from(nextRow.__cells).find((cell) => cell._column === nextColumn);
509
522
  if (nextCell && this._isCellEditable(nextCell)) {
510
523
  break;
511
524
  }
@@ -537,7 +550,7 @@ export const InlineEditingMixin = (superClass) =>
537
550
  if (!this._isCellEditable(cell)) {
538
551
  // Cell is no longer editable, cancel edit
539
552
  this._stopEdit(true, true);
540
- } else if (cell.parentNode === row && item && this.getItemId(model.item) !== this.getItemId(item)) {
553
+ } else if (cell.__parentRow === row && item && this.getItemId(model.item) !== this.getItemId(item)) {
541
554
  // Edited item identity has changed, stop edit
542
555
  this._stopEdit();
543
556
  }
@@ -573,29 +586,7 @@ export const InlineEditingMixin = (superClass) =>
573
586
  return true;
574
587
  }
575
588
  // Otherwise, check isCellEditable function
576
- const model = this.__getRowModel(cell.parentElement);
589
+ const model = this.__getRowModel(cell.__parentRow);
577
590
  return column.isCellEditable(model);
578
591
  }
579
-
580
- /**
581
- * Fired before exiting the cell edit mode, if the value has been changed.
582
- * If the default is prevented, value change would not be applied.
583
- *
584
- * @event item-property-changed
585
- * @param {Object} detail
586
- * @param {Object} detail.index the row index of the edited cell
587
- * @param {Object} detail.item the grid item rendered to the row of the edited cell
588
- * @param {Object} detail.path the column path of the edited cell
589
- * @param {Object} detail.value the new value of the edited cell
590
- */
591
-
592
- /**
593
- * Fired when the user starts editing a grid cell.
594
- *
595
- * @event cell-edit-started
596
- * @param {Object} detail
597
- * @param {Object} detail.index the row index of the edited cell
598
- * @param {Object} detail.item the grid item rendered to the row of the edited cell
599
- * @param {Object} detail.path the column path of the edited cell
600
- */
601
592
  };
@@ -69,7 +69,7 @@ export interface GridProEventMap<TItem>
69
69
  * @fires {CustomEvent} grid-dragstart - Fired when starting to drag grid rows.
70
70
  * @fires {CustomEvent} grid-dragend - Fired when the dragging of the rows ends.
71
71
  * @fires {CustomEvent} grid-drop - Fired when a drop occurs on top of the grid.
72
- * @fires {CustomEvent} item-property-changed - Fired before exiting the cell edit mode, if the value has been changed.
72
+ * @fires {CustomEvent} item-property-changed - Fired before exiting cell edit mode if the value has been changed. If the default is prevented, the value change is not applied.
73
73
  * @fires {CustomEvent} loading-changed - Fired when the `loading` property changes.
74
74
  * @fires {CustomEvent} selected-items-changed - Fired when the `selectedItems` property changes.
75
75
  */
@@ -43,7 +43,7 @@ import { InlineEditingMixin } from './vaadin-grid-pro-inline-editing-mixin.js';
43
43
  * @fires {CustomEvent} grid-dragstart - Fired when starting to drag grid rows.
44
44
  * @fires {CustomEvent} grid-dragend - Fired when the dragging of the rows ends.
45
45
  * @fires {CustomEvent} grid-drop - Fired when a drop occurs on top of the grid.
46
- * @fires {CustomEvent} item-property-changed - Fired before exiting the cell edit mode, if the value has been changed.
46
+ * @fires {CustomEvent} item-property-changed - Fired before exiting cell edit mode if the value has been changed. If the default is prevented, the value change is not applied.
47
47
  * @fires {CustomEvent} loading-changed - Fired when the `loading` property changes.
48
48
  * @fires {CustomEvent} selected-items-changed - Fired when the `selectedItems` property changes.
49
49
  *