@vaadin/grid-pro 24.5.0-beta1 → 24.5.0-rc2

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-pro",
3
- "version": "24.5.0-beta1",
3
+ "version": "24.5.0-rc2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -39,19 +39,19 @@
39
39
  "dependencies": {
40
40
  "@open-wc/dedupe-mixin": "^1.3.0",
41
41
  "@polymer/polymer": "^3.0.0",
42
- "@vaadin/checkbox": "24.5.0-beta1",
43
- "@vaadin/component-base": "24.5.0-beta1",
44
- "@vaadin/grid": "24.5.0-beta1",
45
- "@vaadin/lit-renderer": "24.5.0-beta1",
46
- "@vaadin/select": "24.5.0-beta1",
47
- "@vaadin/text-field": "24.5.0-beta1",
48
- "@vaadin/vaadin-lumo-styles": "24.5.0-beta1",
49
- "@vaadin/vaadin-material-styles": "24.5.0-beta1",
50
- "@vaadin/vaadin-themable-mixin": "24.5.0-beta1",
42
+ "@vaadin/checkbox": "24.5.0-rc2",
43
+ "@vaadin/component-base": "24.5.0-rc2",
44
+ "@vaadin/grid": "24.5.0-rc2",
45
+ "@vaadin/lit-renderer": "24.5.0-rc2",
46
+ "@vaadin/select": "24.5.0-rc2",
47
+ "@vaadin/text-field": "24.5.0-rc2",
48
+ "@vaadin/vaadin-lumo-styles": "24.5.0-rc2",
49
+ "@vaadin/vaadin-material-styles": "24.5.0-rc2",
50
+ "@vaadin/vaadin-themable-mixin": "24.5.0-rc2",
51
51
  "lit": "^3.0.0"
52
52
  },
53
53
  "devDependencies": {
54
- "@vaadin/chai-plugins": "24.5.0-beta1",
54
+ "@vaadin/chai-plugins": "24.5.0-rc2",
55
55
  "@vaadin/testing-helpers": "^1.0.0",
56
56
  "sinon": "^18.0.0"
57
57
  },
@@ -60,5 +60,5 @@
60
60
  "web-types.json",
61
61
  "web-types.lit.json"
62
62
  ],
63
- "gitHead": "da4b57724d7089e3766d59d01068159322adb2b8"
63
+ "gitHead": "be5bf40aec33761c6defdb5b3093c7b6dd5d97fd"
64
64
  }
@@ -281,8 +281,6 @@ export const GridProEditColumnMixin = (superClass) =>
281
281
  const editor = this._getEditorComponent(cell);
282
282
  editor.addEventListener('focusout', this._grid.__boundEditorFocusOut);
283
283
  editor.addEventListener('focusin', this._grid.__boundEditorFocusIn);
284
- editor.addEventListener('internal-tab', this._grid.__boundCancelCellSwitch);
285
- document.body.addEventListener('focusin', this._grid.__boundGlobalFocusIn);
286
284
  this._setEditorOptions(editor);
287
285
  this._setEditorValue(editor, get(this.path, model.item));
288
286
  editor._grid = this._grid;
@@ -300,8 +298,6 @@ export const GridProEditColumnMixin = (superClass) =>
300
298
  * @protected
301
299
  */
302
300
  _stopCellEdit(cell, model) {
303
- document.body.removeEventListener('focusin', this._grid.__boundGlobalFocusIn);
304
-
305
301
  this._removeEditor(cell, model);
306
302
  }
307
303
  };
@@ -65,8 +65,6 @@ export const InlineEditingMixin = (superClass) =>
65
65
  this.__boundItemPropertyChanged = this._onItemPropertyChanged.bind(this);
66
66
  this.__boundEditorFocusOut = this._onEditorFocusOut.bind(this);
67
67
  this.__boundEditorFocusIn = this._onEditorFocusIn.bind(this);
68
- this.__boundCancelCellSwitch = this._setCancelCellSwitch.bind(this);
69
- this.__boundGlobalFocusIn = this._onGlobalFocusIn.bind(this);
70
68
 
71
69
  this._addEditColumnListener('mousedown', (e) => {
72
70
  // Prevent grid from resetting navigating state
@@ -305,32 +303,36 @@ export const InlineEditingMixin = (superClass) =>
305
303
  }
306
304
 
307
305
  /** @private */
308
- _onEditorFocusOut() {
306
+ _onEditorFocusOut(event) {
307
+ if (this.__shouldIgnoreFocusOut(event)) {
308
+ return;
309
+ }
310
+
309
311
  // Schedule stop on editor component focusout
310
312
  this._debouncerStopEdit = Debouncer.debounce(this._debouncerStopEdit, animationFrame, this._stopEdit.bind(this));
311
313
  }
312
314
 
313
315
  /** @private */
314
- _onEditorFocusIn() {
315
- this._cancelStopEdit();
316
- }
317
-
318
- /** @private */
319
- _onGlobalFocusIn(e) {
316
+ __shouldIgnoreFocusOut(event) {
320
317
  const edited = this.__edited;
321
318
  if (edited) {
322
- // Detect focus moving to e.g. vaadin-select-overlay
323
- const overlay = Array.from(e.composedPath()).filter(
324
- (node) => node.nodeType === Node.ELEMENT_NODE && /^vaadin-(?!dialog).*-overlay$/iu.test(node.localName),
325
- )[0];
326
-
327
- if (overlay) {
328
- overlay.addEventListener('vaadin-overlay-outside-click', this.__boundEditorFocusOut);
329
- this._cancelStopEdit();
319
+ const { cell, column } = this.__edited;
320
+ const editor = column._getEditorComponent(cell);
321
+
322
+ const path = event.composedPath();
323
+ const nodes = path.slice(0, path.indexOf(editor) + 1).filter((node) => node.nodeType === Node.ELEMENT_NODE);
324
+ // Detect focus moving to e.g. vaadin-select-overlay or vaadin-date-picker-overlay
325
+ if (nodes.some((el) => typeof el._shouldRemoveFocus === 'function' && !el._shouldRemoveFocus(event))) {
326
+ return true;
330
327
  }
331
328
  }
332
329
  }
333
330
 
331
+ /** @private */
332
+ _onEditorFocusIn() {
333
+ this._cancelStopEdit();
334
+ }
335
+
334
336
  /** @private */
335
337
  _startEdit(cell, column) {
336
338
  const isCellEditable = this._isCellEditable(cell);
@@ -412,20 +414,12 @@ export const InlineEditingMixin = (superClass) =>
412
414
  }
413
415
  }
414
416
 
415
- /** @private */
416
- _setCancelCellSwitch() {
417
- this.__cancelCellSwitch = true;
418
- window.requestAnimationFrame(() => {
419
- this.__cancelCellSwitch = false;
420
- });
421
- }
422
-
423
417
  /**
424
418
  * @param {!KeyboardEvent} e
425
419
  * @protected
426
420
  */
427
- _switchEditCell(e) {
428
- if (this.__cancelCellSwitch || (e.defaultPrevented && e.keyCode === 9)) {
421
+ async _switchEditCell(e) {
422
+ if (e.defaultPrevented && e.keyCode === 9) {
429
423
  return;
430
424
  }
431
425
 
@@ -434,11 +428,35 @@ export const InlineEditingMixin = (superClass) =>
434
428
  const editableColumns = this._getEditColumns();
435
429
  const { cell, column, model } = this.__edited;
436
430
 
437
- this._stopEdit();
438
- e.preventDefault();
439
431
  // Prevent vaadin-grid handler from being called
440
432
  e.stopImmediatePropagation();
441
433
 
434
+ const editor = column._getEditorComponent(cell);
435
+
436
+ // Do not prevent Tab to allow native input blur and wait for it,
437
+ // unless the keydown event is from the edit cell select overlay.
438
+ if (e.key === 'Tab' && editor && editor.contains(e.target)) {
439
+ const ignore = await new Promise((resolve) => {
440
+ editor.addEventListener(
441
+ 'focusout',
442
+ (event) => {
443
+ resolve(this.__shouldIgnoreFocusOut(event));
444
+ },
445
+ { once: true },
446
+ );
447
+ });
448
+
449
+ // Ignore focusout event after which focus stays in the field,
450
+ // e.g. Tab between date and time pickers in date-time-picker.
451
+ if (ignore) {
452
+ return;
453
+ }
454
+ } else {
455
+ e.preventDefault();
456
+ }
457
+
458
+ this._stopEdit();
459
+
442
460
  // Try to find the next editable cell
443
461
  let nextIndex = model.index;
444
462
  let nextColumn = column;
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/grid-pro",
4
- "version": "24.5.0-beta1",
4
+ "version": "24.5.0-rc2",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
@@ -401,7 +401,7 @@
401
401
  },
402
402
  {
403
403
  "name": "vaadin-grid-pro",
404
- "description": "`<vaadin-grid-pro>` is a high quality data grid / data table Web Component with extended functionality.\nIt extends `<vaadin-grid>` and adds extra features on top of the basic ones.\n\nSee [`<vaadin-grid>`](https://cdn.vaadin.com/vaadin-web-components/24.5.0-beta1/#/elements/vaadin-grid) documentation for details.\n\n```\n<vaadin-grid-pro></vaadin-grid-pro>\n```\n\n### Internal components\n\nIn addition to `<vaadin-grid-pro>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-grid-pro-edit-checkbox>` - has the same API as [`<vaadin-checkbox>`](https://cdn.vaadin.com/vaadin-web-components/24.5.0-beta1/#/elements/vaadin-checkbox).\n- `<vaadin-grid-pro-edit-text-field>` - has the same API as [`<vaadin-text-field>`](https://cdn.vaadin.com/vaadin-web-components/24.5.0-beta1/#/elements/vaadin-text-field).\n- `<vaadin-grid-pro-edit-select>` - has the same API as [`<vaadin-select>`](https://cdn.vaadin.com/vaadin-web-components/24.5.0-beta1/#/elements/vaadin-select).",
404
+ "description": "`<vaadin-grid-pro>` is a high quality data grid / data table Web Component with extended functionality.\nIt extends `<vaadin-grid>` and adds extra features on top of the basic ones.\n\nSee [`<vaadin-grid>`](https://cdn.vaadin.com/vaadin-web-components/24.5.0-rc2/#/elements/vaadin-grid) documentation for details.\n\n```\n<vaadin-grid-pro></vaadin-grid-pro>\n```\n\n### Internal components\n\nIn addition to `<vaadin-grid-pro>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-grid-pro-edit-checkbox>` - has the same API as [`<vaadin-checkbox>`](https://cdn.vaadin.com/vaadin-web-components/24.5.0-rc2/#/elements/vaadin-checkbox).\n- `<vaadin-grid-pro-edit-text-field>` - has the same API as [`<vaadin-text-field>`](https://cdn.vaadin.com/vaadin-web-components/24.5.0-rc2/#/elements/vaadin-text-field).\n- `<vaadin-grid-pro-edit-select>` - has the same API as [`<vaadin-select>`](https://cdn.vaadin.com/vaadin-web-components/24.5.0-rc2/#/elements/vaadin-select).",
405
405
  "attributes": [
406
406
  {
407
407
  "name": "size",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/grid-pro",
4
- "version": "24.5.0-beta1",
4
+ "version": "24.5.0-rc2",
5
5
  "description-markup": "markdown",
6
6
  "framework": "lit",
7
7
  "framework-config": {
@@ -177,7 +177,7 @@
177
177
  },
178
178
  {
179
179
  "name": "vaadin-grid-pro",
180
- "description": "`<vaadin-grid-pro>` is a high quality data grid / data table Web Component with extended functionality.\nIt extends `<vaadin-grid>` and adds extra features on top of the basic ones.\n\nSee [`<vaadin-grid>`](https://cdn.vaadin.com/vaadin-web-components/24.5.0-beta1/#/elements/vaadin-grid) documentation for details.\n\n```\n<vaadin-grid-pro></vaadin-grid-pro>\n```\n\n### Internal components\n\nIn addition to `<vaadin-grid-pro>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-grid-pro-edit-checkbox>` - has the same API as [`<vaadin-checkbox>`](https://cdn.vaadin.com/vaadin-web-components/24.5.0-beta1/#/elements/vaadin-checkbox).\n- `<vaadin-grid-pro-edit-text-field>` - has the same API as [`<vaadin-text-field>`](https://cdn.vaadin.com/vaadin-web-components/24.5.0-beta1/#/elements/vaadin-text-field).\n- `<vaadin-grid-pro-edit-select>` - has the same API as [`<vaadin-select>`](https://cdn.vaadin.com/vaadin-web-components/24.5.0-beta1/#/elements/vaadin-select).",
180
+ "description": "`<vaadin-grid-pro>` is a high quality data grid / data table Web Component with extended functionality.\nIt extends `<vaadin-grid>` and adds extra features on top of the basic ones.\n\nSee [`<vaadin-grid>`](https://cdn.vaadin.com/vaadin-web-components/24.5.0-rc2/#/elements/vaadin-grid) documentation for details.\n\n```\n<vaadin-grid-pro></vaadin-grid-pro>\n```\n\n### Internal components\n\nIn addition to `<vaadin-grid-pro>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-grid-pro-edit-checkbox>` - has the same API as [`<vaadin-checkbox>`](https://cdn.vaadin.com/vaadin-web-components/24.5.0-rc2/#/elements/vaadin-checkbox).\n- `<vaadin-grid-pro-edit-text-field>` - has the same API as [`<vaadin-text-field>`](https://cdn.vaadin.com/vaadin-web-components/24.5.0-rc2/#/elements/vaadin-text-field).\n- `<vaadin-grid-pro-edit-select>` - has the same API as [`<vaadin-select>`](https://cdn.vaadin.com/vaadin-web-components/24.5.0-rc2/#/elements/vaadin-select).",
181
181
  "extension": true,
182
182
  "attributes": [
183
183
  {