@vaadin/grid-pro 25.4.0-alpha5 → 25.4.0-alpha7

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": "25.4.0-alpha5",
3
+ "version": "25.4.0-alpha7",
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.4.0-alpha5",
41
- "@vaadin/checkbox": "25.4.0-alpha5",
42
- "@vaadin/component-base": "25.4.0-alpha5",
43
- "@vaadin/grid": "25.4.0-alpha5",
44
- "@vaadin/lit-renderer": "25.4.0-alpha5",
45
- "@vaadin/select": "25.4.0-alpha5",
46
- "@vaadin/text-field": "25.4.0-alpha5",
47
- "@vaadin/vaadin-themable-mixin": "25.4.0-alpha5",
40
+ "@vaadin/a11y-base": "25.4.0-alpha7",
41
+ "@vaadin/checkbox": "25.4.0-alpha7",
42
+ "@vaadin/component-base": "25.4.0-alpha7",
43
+ "@vaadin/grid": "25.4.0-alpha7",
44
+ "@vaadin/lit-renderer": "25.4.0-alpha7",
45
+ "@vaadin/select": "25.4.0-alpha7",
46
+ "@vaadin/text-field": "25.4.0-alpha7",
47
+ "@vaadin/vaadin-themable-mixin": "25.4.0-alpha7",
48
48
  "lit": "^3.0.0"
49
49
  },
50
50
  "devDependencies": {
51
- "@vaadin/aura": "25.4.0-alpha5",
52
- "@vaadin/chai-plugins": "25.4.0-alpha5",
53
- "@vaadin/test-runner-commands": "25.4.0-alpha5",
51
+ "@vaadin/aura": "25.4.0-alpha7",
52
+ "@vaadin/chai-plugins": "25.4.0-alpha7",
53
+ "@vaadin/test-runner-commands": "25.4.0-alpha7",
54
54
  "@vaadin/testing-helpers": "^2.0.0",
55
- "@vaadin/vaadin-lumo-styles": "25.4.0-alpha5",
55
+ "@vaadin/vaadin-lumo-styles": "25.4.0-alpha7",
56
56
  "sinon": "^22.0.0"
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": "65e9c9e49c0a723b08ee91b9aae8b901e91a3597"
64
+ "gitHead": "368fb0f0df09ec6f51766d9c44047c8d7620d6bd"
65
65
  }
@@ -231,7 +231,7 @@ export const InlineEditingMixin = (superClass) =>
231
231
  return;
232
232
  }
233
233
 
234
- if (!this._isCellEditable(cell)) {
234
+ if (!this._isCellEditable(cell._column, cell.__parentRow)) {
235
235
  return;
236
236
  }
237
237
 
@@ -359,7 +359,7 @@ export const InlineEditingMixin = (superClass) =>
359
359
  /** @private */
360
360
  _startEdit(cell, column) {
361
361
  // TODO: remove `_editingDisabled` after Flow counterpart is updated.
362
- if (this.disabled || this._editingDisabled || !this._isCellEditable(cell)) {
362
+ if (this.disabled || this._editingDisabled || !this._isCellEditable(cell._column, cell.__parentRow)) {
363
363
  return;
364
364
  }
365
365
 
@@ -375,7 +375,7 @@ export const InlineEditingMixin = (superClass) =>
375
375
 
376
376
  // Stopping the previous edit runs listeners that may have made this cell
377
377
  // non-editable
378
- if (!this._isCellEditable(cell)) {
378
+ if (!this._isCellEditable(cell._column, cell.__parentRow)) {
379
379
  return;
380
380
  }
381
381
 
@@ -504,7 +504,8 @@ export const InlineEditingMixin = (superClass) =>
504
504
  // Try to find the next editable cell
505
505
  let nextIndex = model.index;
506
506
  let nextColumn = column;
507
- let nextCell = cell;
507
+ let nextRow = cell.__parentRow;
508
+ let found = false;
508
509
  let directionX = 0;
509
510
  let directionY = 0;
510
511
 
@@ -519,7 +520,7 @@ export const InlineEditingMixin = (superClass) =>
519
520
  }
520
521
 
521
522
  if (directionX || directionY) {
522
- while (nextCell) {
523
+ while (nextRow) {
523
524
  if (directionX) {
524
525
  // Move horizontally
525
526
  nextColumn = editableColumns[editableColumns.indexOf(nextColumn) + directionX];
@@ -534,21 +535,28 @@ export const InlineEditingMixin = (superClass) =>
534
535
  nextIndex += directionY;
535
536
  }
536
537
  // Stop looking if the next cell is editable
537
- const nextRow = this._getRowByIndex(nextIndex);
538
- // eslint-disable-next-line no-loop-func
539
- nextCell = nextRow && Array.from(nextRow.__cells).find((cell) => cell._column === nextColumn);
540
- if (nextCell && this._isCellEditable(nextCell)) {
538
+ nextRow = this._getRowByIndex(nextIndex);
539
+ if (nextRow && this._isCellEditable(nextColumn, nextRow)) {
540
+ found = true;
541
541
  break;
542
542
  }
543
543
  }
544
544
  }
545
545
 
546
546
  // Focus current cell as fallback
547
- if (!nextCell) {
548
- nextCell = cell;
547
+ if (!found) {
548
+ nextColumn = column;
549
+ nextRow = cell.__parentRow;
549
550
  nextIndex = model.index;
550
551
  }
551
552
 
553
+ if (this._lazyColumns) {
554
+ // Make sure the cells of the target column are rendered
555
+ this.scrollToColumn(nextColumn);
556
+ }
557
+
558
+ const nextCell = nextRow.__cells.find((cell) => cell._column === nextColumn);
559
+
552
560
  if (!this.singleCellEdit && nextCell !== cell) {
553
561
  this._startEdit(nextCell, nextColumn);
554
562
  } else {
@@ -559,13 +567,14 @@ export const InlineEditingMixin = (superClass) =>
559
567
 
560
568
  /**
561
569
  * @param {!HTMLElement} row
570
+ * @param {{ skipRenderers?: boolean }} options
562
571
  * @private
563
572
  */
564
- __updateRow(row) {
573
+ __updateRow(row, options) {
565
574
  const item = this.__getRowItem(row);
566
575
  if (this.__edited) {
567
576
  const { cell, model } = this.__edited;
568
- if (!this._isCellEditable(cell)) {
577
+ if (!this._isCellEditable(cell._column, cell.__parentRow)) {
569
578
  // Cell is no longer editable, cancel edit
570
579
  this._stopEdit(true, true);
571
580
  } else if (cell.__parentRow === row && item && this.getItemId(model.item) !== this.getItemId(item)) {
@@ -573,28 +582,33 @@ export const InlineEditingMixin = (superClass) =>
573
582
  this._stopEdit();
574
583
  }
575
584
  }
576
- super.__updateRow(row, item);
585
+ super.__updateRow(row, options);
577
586
  }
578
587
 
579
588
  /**
580
- * Override method from `StylingMixin` to apply `editable-cell` part to the
589
+ * Override method from `BodyRenderingMixin` to apply `editable-cell` part to the
581
590
  * cells of edit columns.
582
591
  *
583
592
  * @override
584
593
  */
585
- _generateCellPartNames(row, model) {
586
- super._generateCellPartNames(row, model);
594
+ __renderBodyRow(row) {
595
+ super.__renderBodyRow(row);
587
596
 
588
597
  iterateRowCells(row, (cell) => {
589
- const isEditable = !row.hasAttribute('loading') && this._isCellEditable(cell);
598
+ const isEditable = !row.hasAttribute('loading') && this._isCellEditable(cell._column, row);
590
599
  const target = cell._focusButton || cell;
591
600
  updatePart(target, 'editable-cell', isEditable);
592
601
  });
593
602
  }
594
603
 
595
- /** @private */
596
- _isCellEditable(cell) {
597
- const column = cell._column;
604
+ /**
605
+ * Returns true if the cell of the given column in the given row is editable.
606
+ *
607
+ * @param {!GridColumn} column
608
+ * @param {!HTMLElement} row
609
+ * @private
610
+ */
611
+ _isCellEditable(column, row) {
598
612
  // Not editable if the column is not an edit column
599
613
  if (!this._isEditColumn(column)) {
600
614
  return false;
@@ -604,7 +618,7 @@ export const InlineEditingMixin = (superClass) =>
604
618
  return true;
605
619
  }
606
620
  // Otherwise, check isCellEditable function
607
- const model = this.__getRowModel(cell.__parentRow);
621
+ const model = this.__getRowModel(row);
608
622
  return column.isCellEditable(model);
609
623
  }
610
624
  };
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": "25.4.0-alpha5",
4
+ "version": "25.4.0-alpha7",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
@@ -353,7 +353,7 @@
353
353
  },
354
354
  {
355
355
  "name": "vaadin-grid-pro",
356
- "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/25.4.0-alpha5/#/elements/vaadin-grid) documentation for details.\n\n```html\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/25.4.0-alpha5/#/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/25.4.0-alpha5/#/elements/vaadin-text-field).\n- `<vaadin-grid-pro-edit-select>` - has the same API as [`<vaadin-select>`](https://cdn.vaadin.com/vaadin-web-components/25.4.0-alpha5/#/elements/vaadin-select).\n\n### Styling\n\nThe following custom CSS properties are available for styling:\n\nCustom CSS property |\n:------------------------------------------------------|\n| `--vaadin-grid-background` |\n| `--vaadin-grid-border-color` |\n| `--vaadin-grid-border-radius` |\n| `--vaadin-grid-border-width` |\n| `--vaadin-grid-cell-background-color` |\n| `--vaadin-grid-cell-padding` |\n| `--vaadin-grid-cell-text-overflow` |\n| `--vaadin-grid-column-border-width` |\n| `--vaadin-grid-column-resize-handle-color` |\n| `--vaadin-grid-header-font-size` |\n| `--vaadin-grid-header-font-weight` |\n| `--vaadin-grid-header-text-color` |\n| `--vaadin-grid-pro-editable-cell-background-color` |\n| `--vaadin-grid-row-background-color` |\n| `--vaadin-grid-row-border-width` |\n| `--vaadin-grid-row-highlight-background-color` |\n| `--vaadin-grid-row-hover-background-color` |\n| `--vaadin-grid-row-odd-background-color` |\n| `--vaadin-grid-row-selected-background-color` |\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
356
+ "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/25.4.0-alpha7/#/elements/vaadin-grid) documentation for details.\n\n```html\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/25.4.0-alpha7/#/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/25.4.0-alpha7/#/elements/vaadin-text-field).\n- `<vaadin-grid-pro-edit-select>` - has the same API as [`<vaadin-select>`](https://cdn.vaadin.com/vaadin-web-components/25.4.0-alpha7/#/elements/vaadin-select).\n\n### Styling\n\nThe following custom CSS properties are available for styling:\n\nCustom CSS property |\n:------------------------------------------------------|\n| `--vaadin-grid-background` |\n| `--vaadin-grid-border-color` |\n| `--vaadin-grid-border-radius` |\n| `--vaadin-grid-border-width` |\n| `--vaadin-grid-cell-background-color` |\n| `--vaadin-grid-cell-padding` |\n| `--vaadin-grid-cell-text-overflow` |\n| `--vaadin-grid-column-border-width` |\n| `--vaadin-grid-column-resize-handle-color` |\n| `--vaadin-grid-header-font-size` |\n| `--vaadin-grid-header-font-weight` |\n| `--vaadin-grid-header-text-color` |\n| `--vaadin-grid-pro-editable-cell-background-color` |\n| `--vaadin-grid-row-background-color` |\n| `--vaadin-grid-row-border-width` |\n| `--vaadin-grid-row-highlight-background-color` |\n| `--vaadin-grid-row-hover-background-color` |\n| `--vaadin-grid-row-odd-background-color` |\n| `--vaadin-grid-row-selected-background-color` |\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
357
357
  "attributes": [
358
358
  {
359
359
  "name": "accessible-name",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/grid-pro",
4
- "version": "25.4.0-alpha5",
4
+ "version": "25.4.0-alpha7",
5
5
  "description-markup": "markdown",
6
6
  "framework": "lit",
7
7
  "framework-config": {
@@ -170,7 +170,7 @@
170
170
  },
171
171
  {
172
172
  "name": "vaadin-grid-pro",
173
- "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/25.4.0-alpha5/#/elements/vaadin-grid) documentation for details.\n\n```html\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/25.4.0-alpha5/#/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/25.4.0-alpha5/#/elements/vaadin-text-field).\n- `<vaadin-grid-pro-edit-select>` - has the same API as [`<vaadin-select>`](https://cdn.vaadin.com/vaadin-web-components/25.4.0-alpha5/#/elements/vaadin-select).\n\n### Styling\n\nThe following custom CSS properties are available for styling:\n\nCustom CSS property |\n:------------------------------------------------------|\n| `--vaadin-grid-background` |\n| `--vaadin-grid-border-color` |\n| `--vaadin-grid-border-radius` |\n| `--vaadin-grid-border-width` |\n| `--vaadin-grid-cell-background-color` |\n| `--vaadin-grid-cell-padding` |\n| `--vaadin-grid-cell-text-overflow` |\n| `--vaadin-grid-column-border-width` |\n| `--vaadin-grid-column-resize-handle-color` |\n| `--vaadin-grid-header-font-size` |\n| `--vaadin-grid-header-font-weight` |\n| `--vaadin-grid-header-text-color` |\n| `--vaadin-grid-pro-editable-cell-background-color` |\n| `--vaadin-grid-row-background-color` |\n| `--vaadin-grid-row-border-width` |\n| `--vaadin-grid-row-highlight-background-color` |\n| `--vaadin-grid-row-hover-background-color` |\n| `--vaadin-grid-row-odd-background-color` |\n| `--vaadin-grid-row-selected-background-color` |\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
173
+ "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/25.4.0-alpha7/#/elements/vaadin-grid) documentation for details.\n\n```html\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/25.4.0-alpha7/#/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/25.4.0-alpha7/#/elements/vaadin-text-field).\n- `<vaadin-grid-pro-edit-select>` - has the same API as [`<vaadin-select>`](https://cdn.vaadin.com/vaadin-web-components/25.4.0-alpha7/#/elements/vaadin-select).\n\n### Styling\n\nThe following custom CSS properties are available for styling:\n\nCustom CSS property |\n:------------------------------------------------------|\n| `--vaadin-grid-background` |\n| `--vaadin-grid-border-color` |\n| `--vaadin-grid-border-radius` |\n| `--vaadin-grid-border-width` |\n| `--vaadin-grid-cell-background-color` |\n| `--vaadin-grid-cell-padding` |\n| `--vaadin-grid-cell-text-overflow` |\n| `--vaadin-grid-column-border-width` |\n| `--vaadin-grid-column-resize-handle-color` |\n| `--vaadin-grid-header-font-size` |\n| `--vaadin-grid-header-font-weight` |\n| `--vaadin-grid-header-text-color` |\n| `--vaadin-grid-pro-editable-cell-background-color` |\n| `--vaadin-grid-row-background-color` |\n| `--vaadin-grid-row-border-width` |\n| `--vaadin-grid-row-highlight-background-color` |\n| `--vaadin-grid-row-hover-background-color` |\n| `--vaadin-grid-row-odd-background-color` |\n| `--vaadin-grid-row-selected-background-color` |\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
174
174
  "extension": true,
175
175
  "attributes": [
176
176
  {