@dxos/lit-grid 0.8.3-staging.0fa589b → 0.8.4-main.28f8d3d

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.
Files changed (98) hide show
  1. package/dist/src/dx-grid-axis-resize-handle.d.ts.map +1 -1
  2. package/dist/src/dx-grid-axis-resize-handle.js +3 -5
  3. package/dist/src/dx-grid-axis-resize-handle.js.map +1 -1
  4. package/dist/src/dx-grid-multiselect-cell.d.ts.map +1 -1
  5. package/dist/src/dx-grid-multiselect-cell.js +2 -1
  6. package/dist/src/dx-grid-multiselect-cell.js.map +1 -1
  7. package/dist/src/dx-grid.d.ts +4 -3
  8. package/dist/src/dx-grid.d.ts.map +1 -1
  9. package/dist/src/dx-grid.js +118 -97
  10. package/dist/src/dx-grid.js.map +1 -1
  11. package/dist/src/dx-grid.lit-stories.d.ts +1 -0
  12. package/dist/src/dx-grid.lit-stories.d.ts.map +1 -1
  13. package/dist/src/dx-grid.lit-stories.js +19 -20
  14. package/dist/src/dx-grid.lit-stories.js.map +1 -1
  15. package/dist/src/playwright/dx-grid.spec.d.ts.map +1 -0
  16. package/dist/src/{testing/playwright → playwright}/dx-grid.spec.js +3 -3
  17. package/dist/src/playwright/dx-grid.spec.js.map +1 -0
  18. package/dist/src/playwright/playwright.config.d.ts +3 -0
  19. package/dist/src/playwright/playwright.config.d.ts.map +1 -0
  20. package/dist/src/playwright/playwright.config.js +15 -0
  21. package/dist/src/playwright/playwright.config.js.map +1 -0
  22. package/dist/src/testing/{playwright/dx-grid-manager.d.ts → dx-grid-manager.d.ts} +1 -1
  23. package/dist/src/testing/dx-grid-manager.d.ts.map +1 -0
  24. package/dist/src/testing/dx-grid-manager.js.map +1 -0
  25. package/dist/src/testing/index.d.ts +1 -1
  26. package/dist/src/testing/index.d.ts.map +1 -1
  27. package/dist/src/testing/index.js +1 -1
  28. package/dist/src/testing/index.js.map +1 -1
  29. package/dist/src/util.d.ts +4 -1
  30. package/dist/src/util.d.ts.map +1 -1
  31. package/dist/src/util.js +11 -11
  32. package/dist/src/util.js.map +1 -1
  33. package/dist/tsconfig.tsbuildinfo +1 -1
  34. package/package.json +6 -5
  35. package/src/dx-grid-axis-resize-handle.pcss +1 -0
  36. package/src/dx-grid-axis-resize-handle.ts +1 -1
  37. package/src/dx-grid-multiselect-cell.pcss +2 -2
  38. package/src/dx-grid-multiselect-cell.ts +2 -1
  39. package/src/dx-grid.lit-stories.ts +6 -2
  40. package/src/dx-grid.pcss +121 -15
  41. package/src/dx-grid.ts +99 -33
  42. package/src/{testing/playwright → playwright}/dx-grid.spec.ts +5 -5
  43. package/src/playwright/playwright.config.ts +17 -0
  44. package/src/testing/{playwright/dx-grid-manager.ts → dx-grid-manager.ts} +2 -2
  45. package/src/testing/index.ts +1 -1
  46. package/src/util.ts +13 -9
  47. package/dist/src/testing/playwright/dx-grid-manager.d.ts.map +0 -1
  48. package/dist/src/testing/playwright/dx-grid-manager.js.map +0 -1
  49. package/dist/src/testing/playwright/dx-grid.spec.d.ts.map +0 -1
  50. package/dist/src/testing/playwright/dx-grid.spec.js.map +0 -1
  51. package/dist/types/src/defs.d.ts +0 -3
  52. package/dist/types/src/defs.d.ts.map +0 -1
  53. package/dist/types/src/defs.js +0 -6
  54. package/dist/types/src/defs.js.map +0 -1
  55. package/dist/types/src/dx-grid-axis-resize-handle.d.ts +0 -16
  56. package/dist/types/src/dx-grid-axis-resize-handle.d.ts.map +0 -1
  57. package/dist/types/src/dx-grid-axis-resize-handle.js +0 -100
  58. package/dist/types/src/dx-grid-axis-resize-handle.js.map +0 -1
  59. package/dist/types/src/dx-grid-multiselect-cell.d.ts +0 -13
  60. package/dist/types/src/dx-grid-multiselect-cell.d.ts.map +0 -1
  61. package/dist/types/src/dx-grid-multiselect-cell.js +0 -56
  62. package/dist/types/src/dx-grid-multiselect-cell.js.map +0 -1
  63. package/dist/types/src/dx-grid.d.ts +0 -170
  64. package/dist/types/src/dx-grid.d.ts.map +0 -1
  65. package/dist/types/src/dx-grid.js +0 -1347
  66. package/dist/types/src/dx-grid.js.map +0 -1
  67. package/dist/types/src/dx-grid.lit-stories.d.ts +0 -46
  68. package/dist/types/src/dx-grid.lit-stories.d.ts.map +0 -1
  69. package/dist/types/src/dx-grid.lit-stories.js +0 -179
  70. package/dist/types/src/dx-grid.lit-stories.js.map +0 -1
  71. package/dist/types/src/index.d.ts +0 -5
  72. package/dist/types/src/index.d.ts.map +0 -1
  73. package/dist/types/src/index.js +0 -8
  74. package/dist/types/src/index.js.map +0 -1
  75. package/dist/types/src/testing/index.d.ts +0 -2
  76. package/dist/types/src/testing/index.d.ts.map +0 -1
  77. package/dist/types/src/testing/index.js +0 -5
  78. package/dist/types/src/testing/index.js.map +0 -1
  79. package/dist/types/src/testing/playwright/dx-grid-manager.d.ts +0 -24
  80. package/dist/types/src/testing/playwright/dx-grid-manager.d.ts.map +0 -1
  81. package/dist/types/src/testing/playwright/dx-grid-manager.js +0 -79
  82. package/dist/types/src/testing/playwright/dx-grid-manager.js.map +0 -1
  83. package/dist/types/src/testing/playwright/dx-grid.spec.d.ts +0 -2
  84. package/dist/types/src/testing/playwright/dx-grid.spec.d.ts.map +0 -1
  85. package/dist/types/src/testing/playwright/dx-grid.spec.js +0 -92
  86. package/dist/types/src/testing/playwright/dx-grid.spec.js.map +0 -1
  87. package/dist/types/src/types.d.ts +0 -137
  88. package/dist/types/src/types.d.ts.map +0 -1
  89. package/dist/types/src/types.js +0 -46
  90. package/dist/types/src/types.js.map +0 -1
  91. package/dist/types/src/util.d.ts +0 -39
  92. package/dist/types/src/util.d.ts.map +0 -1
  93. package/dist/types/src/util.js +0 -165
  94. package/dist/types/src/util.js.map +0 -1
  95. package/dist/types/tsconfig.tsbuildinfo +0 -1
  96. package/src/testing/playwright/playwright.config.cts +0 -18
  97. /package/dist/src/{testing/playwright → playwright}/dx-grid.spec.d.ts +0 -0
  98. /package/dist/src/testing/{playwright/dx-grid-manager.js → dx-grid-manager.js} +0 -0
@@ -8,18 +8,16 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
8
8
  return c > 3 && r && Object.defineProperty(target, key, r), r;
9
9
  };
10
10
  import { LitElement, html, nothing } from 'lit';
11
- import { customElement, state, property } from 'lit/decorators.js';
12
- import { ref, createRef } from 'lit/directives/ref.js';
11
+ import { customElement, property, state } from 'lit/decorators.js';
12
+ import { createRef, ref } from 'lit/directives/ref.js';
13
13
  import { styleMap } from 'lit/directives/style-map.js';
14
- import { unsafeStatic, html as staticHtml } from 'lit/static-html.js';
14
+ import { html as staticHtml, unsafeStatic } from 'lit/static-html.js';
15
15
  import { defaultColSize, defaultRowSize } from './defs';
16
- // eslint-disable-next-line unused-imports/no-unused-imports
17
16
  import './dx-grid-axis-resize-handle';
18
17
  import { DxAxisResize, DxEditRequest, DxGridCellsSelect, separator, } from './types';
19
- import { toCellIndex, gap, resizeTolerance, sizeColMin, sizeColMax, sizeRowMin, sizeRowMax, shouldSelect, selectionProps, cellSelected, closestAction, closestCell, targetIsPlane, resolveRowPlane, resolveColPlane, resolveFrozenPlane, isSameCell, isReadonly, } from './util';
18
+ import { cellSelected, closestAction, closestCell, gap, isReadonly, isSameCell, resizeTolerance, resolveColPlane, resolveFrozenPlane, resolveRowPlane, selectionProps, shouldSelect, sizeColMax, sizeColMin, sizeRowMax, sizeRowMin, targetIsPlane, toCellIndex, } from './util';
20
19
  let DxGrid = class DxGrid extends LitElement {
21
20
  constructor() {
22
- var _a;
23
21
  super();
24
22
  this.gridId = 'default-grid-id';
25
23
  this.rowDefault = {
@@ -133,8 +131,7 @@ let DxGrid = class DxGrid extends LitElement {
133
131
  }
134
132
  };
135
133
  this.handlePointerUp = (event) => {
136
- var _a;
137
- if (((_a = this.pointer) === null || _a === void 0 ? void 0 : _a.state) === 'selecting') {
134
+ if (this.pointer?.state === 'selecting') {
138
135
  const cell = closestCell(event.target);
139
136
  if (cell) {
140
137
  this.setSelectionEnd(cell);
@@ -144,8 +141,7 @@ let DxGrid = class DxGrid extends LitElement {
144
141
  this.pointer = null;
145
142
  };
146
143
  this.handlePointerMove = (event) => {
147
- var _a, _b;
148
- if (((_a = this.pointer) === null || _a === void 0 ? void 0 : _a.state) === 'panning') {
144
+ if (this.pointer?.state === 'panning') {
149
145
  const panEvent = event;
150
146
  panEvent.deltaX = this.pointer.pageX - event.pageX;
151
147
  panEvent.deltaY = this.pointer.pageY - event.pageY;
@@ -156,7 +152,7 @@ let DxGrid = class DxGrid extends LitElement {
156
152
  else if (shouldSelect(this.pointer, event)) {
157
153
  this.pointer = { state: 'selecting' };
158
154
  }
159
- else if (((_b = this.pointer) === null || _b === void 0 ? void 0 : _b.state) === 'selecting') {
155
+ else if (this.pointer?.state === 'selecting') {
160
156
  const cell = closestCell(event.target);
161
157
  if (cell &&
162
158
  cell.plane === this.selectionStart.plane &&
@@ -169,8 +165,7 @@ let DxGrid = class DxGrid extends LitElement {
169
165
  // Resize & reposition handlers, observer, ref
170
166
  //
171
167
  this.observer = new ResizeObserver((entries) => {
172
- var _a, _b, _c;
173
- const { inlineSize, blockSize } = (_c = (_b = (_a = entries === null || entries === void 0 ? void 0 : entries[0]) === null || _a === void 0 ? void 0 : _a.contentBoxSize) === null || _b === void 0 ? void 0 : _b[0]) !== null && _c !== void 0 ? _c : {
168
+ const { inlineSize, blockSize } = entries?.[0]?.contentBoxSize?.[0] ?? {
174
169
  inlineSize: 0,
175
170
  blockSize: 0,
176
171
  };
@@ -196,20 +191,28 @@ let DxGrid = class DxGrid extends LitElement {
196
191
  }
197
192
  };
198
193
  this.handleTopLevelWheel = (event) => {
199
- var _a;
200
- if (event.gridId === ((_a = this.gridId) !== null && _a !== void 0 ? _a : 'never')) {
194
+ if (event.gridId === (this.gridId ?? 'never')) {
201
195
  if (this.overscroll === 'trap' ||
202
196
  (this.overscroll === 'inline' && event.overscrollInline === 0) ||
203
197
  (this.overscroll === 'block' && event.overscrollBlock === 0)) {
204
- event.preventDefault();
205
- event.stopPropagation();
198
+ const element = event.target;
199
+ const activeCell = element.closest('[data-dx-active]');
200
+ const contentEl = element.closest('.dx-grid__cell__content');
201
+ if (!(element &&
202
+ activeCell &&
203
+ contentEl &&
204
+ (contentEl.scrollWidth > contentEl.clientWidth || contentEl.scrollHeight > contentEl.clientHeight))) {
205
+ event.preventDefault();
206
+ event.stopPropagation();
207
+ }
206
208
  }
207
209
  }
208
210
  };
209
211
  this.handleWheel = (event) => {
210
212
  if (this.mode === 'browse') {
211
- const nextPosInline = this.posInline + event.deltaX;
212
- const nextPosBlock = this.posBlock + event.deltaY;
213
+ const { deltaX, deltaY } = this.getOverflowingCellModifiedDeltas(event);
214
+ const nextPosInline = this.posInline + deltaX;
215
+ const nextPosBlock = this.posBlock + deltaY;
213
216
  const maxPosInline = this.maxPosInline();
214
217
  const maxPosBlock = this.maxPosBlock();
215
218
  this.updatePos(nextPosInline, nextPosBlock, maxPosInline, maxPosBlock);
@@ -221,7 +224,7 @@ let DxGrid = class DxGrid extends LitElement {
221
224
  }
222
225
  };
223
226
  // Wheel, top-level and element-level
224
- (_a = document.defaultView) === null || _a === void 0 ? void 0 : _a.addEventListener('wheel', this.handleTopLevelWheel, { passive: false });
227
+ document.defaultView?.addEventListener('wheel', this.handleTopLevelWheel, { passive: false });
225
228
  this.addEventListener('wheel', this.handleWheel);
226
229
  // Custom event(s)
227
230
  this.addEventListener('dx-axis-resize-internal', this.handleAxisResizeInternal);
@@ -305,18 +308,16 @@ let DxGrid = class DxGrid extends LitElement {
305
308
  }
306
309
  }
307
310
  moveFocusBetweenPlanes(event, plane) {
308
- var _a, _b, _c, _d;
309
- const planeElement = (_a = this.gridRef.value) === null || _a === void 0 ? void 0 : _a.querySelector(`[data-dx-grid-plane="${plane}"]`);
311
+ const planeElement = this.gridRef.value?.querySelector(`[data-dx-grid-plane="${plane}"]`);
310
312
  if (planeElement) {
311
313
  const axis = event.key === 'ArrowUp' || event.key === 'ArrowDown' ? 'col' : 'row';
312
314
  const delta = event.key === 'ArrowLeft' || event.key === 'ArrowUp' ? -1 : 1;
313
- const planeAxis = planeElement === null || planeElement === void 0 ? void 0 : planeElement.getAttribute(`data-dx-grid-plane-${axis}`);
314
- const adjacentPlanes = Array.from((_c = (_b = this.gridRef.value) === null || _b === void 0 ? void 0 : _b.querySelectorAll(`[data-dx-grid-plane-${axis}="${planeAxis}"]`)) !== null && _c !== void 0 ? _c : [planeElement]).filter((el) => !!el);
315
- (_d = adjacentPlanes[(adjacentPlanes.length + adjacentPlanes.indexOf(planeElement) + delta) % adjacentPlanes.length]) === null || _d === void 0 ? void 0 : _d.focus({ preventScroll: true });
315
+ const planeAxis = planeElement?.getAttribute(`data-dx-grid-plane-${axis}`);
316
+ const adjacentPlanes = Array.from(this.gridRef.value?.querySelectorAll(`[data-dx-grid-plane-${axis}="${planeAxis}"]`) ?? [planeElement]).filter((el) => !!el);
317
+ adjacentPlanes[(adjacentPlanes.length + adjacentPlanes.indexOf(planeElement) + delta) % adjacentPlanes.length]?.focus({ preventScroll: true });
316
318
  }
317
319
  }
318
320
  moveFocusIntoPlane(plane) {
319
- var _a;
320
321
  if (this.focusedCell.plane !== plane) {
321
322
  const colPlane = resolveColPlane(plane);
322
323
  const rowPlane = resolveRowPlane(plane);
@@ -326,11 +327,10 @@ let DxGrid = class DxGrid extends LitElement {
326
327
  row: rowPlane === 'grid' ? this.visRowMin : 0,
327
328
  };
328
329
  }
329
- (_a = this.focusedCellElement()) === null || _a === void 0 ? void 0 : _a.focus({ preventScroll: true });
330
+ this.focusedCellElement()?.focus({ preventScroll: true });
330
331
  }
331
332
  moveFocusToPlane() {
332
- var _a;
333
- (_a = this.focusedPlaneElement()) === null || _a === void 0 ? void 0 : _a.focus({ preventScroll: true });
333
+ this.focusedPlaneElement()?.focus({ preventScroll: true });
334
334
  }
335
335
  handleKeydown(event) {
336
336
  if (this.focusActive && this.mode === 'browse') {
@@ -381,6 +381,13 @@ let DxGrid = class DxGrid extends LitElement {
381
381
  event.preventDefault();
382
382
  this.dispatchEditRequest();
383
383
  break;
384
+ case 'Backspace':
385
+ case 'Delete':
386
+ if (!event.defaultPrevented) {
387
+ event.preventDefault();
388
+ this.dispatchEditRequest('');
389
+ }
390
+ break;
384
391
  default:
385
392
  if (event.key.length === 1 && event.key.match(/\P{Cc}/u) && !(event.metaKey || event.ctrlKey)) {
386
393
  this.dispatchEditRequest(event.key);
@@ -394,19 +401,16 @@ let DxGrid = class DxGrid extends LitElement {
394
401
  // Accessors
395
402
  //
396
403
  colSize(c, plane) {
397
- var _a, _b, _c, _d, _e;
398
404
  const resolvedPlane = resolveColPlane(plane);
399
- return (_e = (_c = (_b = (_a = this.colSizes) === null || _a === void 0 ? void 0 : _a[resolvedPlane]) === null || _b === void 0 ? void 0 : _b[c]) !== null && _c !== void 0 ? _c : (_d = this.columnDefault[resolvedPlane]) === null || _d === void 0 ? void 0 : _d.size) !== null && _e !== void 0 ? _e : defaultColSize;
405
+ return this.colSizes?.[resolvedPlane]?.[c] ?? this.columnDefault[resolvedPlane]?.size ?? defaultColSize;
400
406
  }
401
407
  rowSize(r, plane) {
402
- var _a, _b, _c, _d, _e;
403
408
  const resolvedPlane = resolveRowPlane(plane);
404
- return (_e = (_c = (_b = (_a = this.rowSizes) === null || _a === void 0 ? void 0 : _a[resolvedPlane]) === null || _b === void 0 ? void 0 : _b[r]) !== null && _c !== void 0 ? _c : (_d = this.rowDefault[resolvedPlane]) === null || _d === void 0 ? void 0 : _d.size) !== null && _e !== void 0 ? _e : defaultRowSize;
409
+ return this.rowSizes?.[resolvedPlane]?.[r] ?? this.rowDefault[resolvedPlane]?.size ?? defaultRowSize;
405
410
  }
406
411
  cell(c, r, plane) {
407
- var _a, _b, _c, _d, _e;
408
412
  const index = `${c}${separator}${r}`;
409
- return (_c = (_b = (_a = this.cells) === null || _a === void 0 ? void 0 : _a[plane]) === null || _b === void 0 ? void 0 : _b[index]) !== null && _c !== void 0 ? _c : (_e = (_d = this.initialCells) === null || _d === void 0 ? void 0 : _d[plane]) === null || _e === void 0 ? void 0 : _e[index];
413
+ return this.cells?.[plane]?.[index] ?? this.initialCells?.[plane]?.[index];
410
414
  }
411
415
  cellActive(c, r, plane) {
412
416
  return this.focusedCell.plane === plane && this.focusedCell.col === c && this.focusedCell.row === r;
@@ -467,11 +471,11 @@ let DxGrid = class DxGrid extends LitElement {
467
471
  return this.intrinsicBlockSize - this.sizeBlock;
468
472
  }
469
473
  updatePosInline(inline, maxInline = this.maxPosInline()) {
470
- this.posInline = Math.max(0, Math.min(maxInline, inline !== null && inline !== void 0 ? inline : this.posInline));
474
+ this.posInline = Math.max(0, Math.min(maxInline, inline ?? this.posInline));
471
475
  this.maybeUpdateVisInline();
472
476
  }
473
477
  updatePosBlock(block, maxBlock = this.maxPosBlock()) {
474
- this.posBlock = Math.max(0, Math.min(maxBlock, block !== null && block !== void 0 ? block : this.posBlock));
478
+ this.posBlock = Math.max(0, Math.min(maxBlock, block ?? this.posBlock));
475
479
  this.maybeUpdateVisBlock();
476
480
  }
477
481
  updatePos(inline, block, maxInline, maxBlock) {
@@ -479,7 +483,6 @@ let DxGrid = class DxGrid extends LitElement {
479
483
  this.updatePosBlock(block, maxBlock);
480
484
  }
481
485
  updateVisInline() {
482
- var _a, _b;
483
486
  // todo: avoid starting from zero
484
487
  let axisCursor = 0;
485
488
  let pxCursor = this.colSize(axisCursor, 'grid');
@@ -509,15 +512,14 @@ let DxGrid = class DxGrid extends LitElement {
509
512
  this.templateGridColumns = [...Array(this.visColMax - this.visColMin)]
510
513
  .map((_, c0) => `${this.colSize(this.visColMin + c0, 'grid')}px`)
511
514
  .join(' ');
512
- this.templatefrozenColsStart = [...Array((_a = this.frozen.frozenColsStart) !== null && _a !== void 0 ? _a : 0)]
515
+ this.templatefrozenColsStart = [...Array(this.frozen.frozenColsStart ?? 0)]
513
516
  .map((_, c0) => `${this.colSize(c0, 'frozenColsStart')}px`)
514
517
  .join(' ');
515
- this.templatefrozenColsEnd = [...Array((_b = this.frozen.frozenColsEnd) !== null && _b !== void 0 ? _b : 0)]
518
+ this.templatefrozenColsEnd = [...Array(this.frozen.frozenColsEnd ?? 0)]
516
519
  .map((_, c0) => `${this.colSize(c0, 'frozenColsEnd')}px`)
517
520
  .join(' ');
518
521
  }
519
522
  updateVisBlock() {
520
- var _a, _b;
521
523
  // todo: avoid starting from zero
522
524
  let axisCursor = 0;
523
525
  let pxCursor = this.rowSize(axisCursor, 'grid');
@@ -547,10 +549,10 @@ let DxGrid = class DxGrid extends LitElement {
547
549
  this.templateGridRows = [...Array(this.visRowMax - this.visRowMin)]
548
550
  .map((_, r0) => `${this.rowSize(this.visRowMin + r0, 'grid')}px`)
549
551
  .join(' ');
550
- this.templatefrozenRowsStart = [...Array((_a = this.frozen.frozenRowsStart) !== null && _a !== void 0 ? _a : 0)]
552
+ this.templatefrozenRowsStart = [...Array(this.frozen.frozenRowsStart ?? 0)]
551
553
  .map((_, r0) => `${this.rowSize(r0, 'frozenRowsStart')}px`)
552
554
  .join(' ');
553
- this.templatefrozenRowsEnd = [...Array((_b = this.frozen.frozenRowsEnd) !== null && _b !== void 0 ? _b : 0)]
555
+ this.templatefrozenRowsEnd = [...Array(this.frozen.frozenRowsEnd ?? 0)]
554
556
  .map((_, r0) => `${this.rowSize(r0, 'frozenRowsEnd')}px`)
555
557
  .join(' ');
556
558
  }
@@ -559,7 +561,6 @@ let DxGrid = class DxGrid extends LitElement {
559
561
  this.updateVisBlock();
560
562
  }
561
563
  updateCells(includeFixed) {
562
- var _a, _b, _c, _d, _e, _f, _g, _h;
563
564
  this.cells.grid = this.getCells({
564
565
  start: { col: this.visColMin, row: this.visRowMin },
565
566
  end: { col: this.visColMax, row: this.visRowMax },
@@ -578,25 +579,25 @@ let DxGrid = class DxGrid extends LitElement {
578
579
  }, plane);
579
580
  });
580
581
  if (includeFixed) {
581
- if (((_a = this.frozen.frozenColsStart) !== null && _a !== void 0 ? _a : 0) > 0 && ((_b = this.frozen.frozenRowsStart) !== null && _b !== void 0 ? _b : 0) > 0) {
582
+ if ((this.frozen.frozenColsStart ?? 0) > 0 && (this.frozen.frozenRowsStart ?? 0) > 0) {
582
583
  this.cells.fixedStartStart = this.getCells({
583
584
  start: { col: 0, row: 0 },
584
585
  end: { col: this.frozen.frozenColsStart, row: this.frozen.frozenRowsStart },
585
586
  }, 'fixedStartStart');
586
587
  }
587
- if (((_c = this.frozen.frozenColsEnd) !== null && _c !== void 0 ? _c : 0) > 0 && ((_d = this.frozen.frozenRowsStart) !== null && _d !== void 0 ? _d : 0) > 0) {
588
+ if ((this.frozen.frozenColsEnd ?? 0) > 0 && (this.frozen.frozenRowsStart ?? 0) > 0) {
588
589
  this.cells.fixedStartEnd = this.getCells({
589
590
  start: { col: 0, row: 0 },
590
591
  end: { col: this.frozen.frozenColsEnd, row: this.frozen.frozenRowsStart },
591
592
  }, 'fixedStartEnd');
592
593
  }
593
- if (((_e = this.frozen.frozenColsStart) !== null && _e !== void 0 ? _e : 0) > 0 && ((_f = this.frozen.frozenRowsEnd) !== null && _f !== void 0 ? _f : 0) > 0) {
594
+ if ((this.frozen.frozenColsStart ?? 0) > 0 && (this.frozen.frozenRowsEnd ?? 0) > 0) {
594
595
  this.cells.fixedEndStart = this.getCells({
595
596
  start: { col: 0, row: 0 },
596
597
  end: { col: this.frozen.frozenColsStart, row: this.frozen.frozenRowsEnd },
597
598
  }, 'fixedEndStart');
598
599
  }
599
- if (((_g = this.frozen.frozenColsEnd) !== null && _g !== void 0 ? _g : 0) > 0 && ((_h = this.frozen.frozenRowsEnd) !== null && _h !== void 0 ? _h : 0) > 0) {
600
+ if ((this.frozen.frozenColsEnd ?? 0) > 0 && (this.frozen.frozenRowsEnd ?? 0) > 0) {
600
601
  this.cells.fixedEndEnd = this.getCells({
601
602
  start: { col: 0, row: 0 },
602
603
  end: { col: this.frozen.frozenColsEnd, row: this.frozen.frozenRowsEnd },
@@ -634,12 +635,10 @@ let DxGrid = class DxGrid extends LitElement {
634
635
  return `[data-dx-grid-plane=${this.focusedCell.plane}]`;
635
636
  }
636
637
  focusedCellElement() {
637
- var _a;
638
- return (_a = this.gridRef.value) === null || _a === void 0 ? void 0 : _a.querySelector(this.focusedCellQuery());
638
+ return this.gridRef.value?.querySelector(this.focusedCellQuery());
639
639
  }
640
640
  focusedPlaneElement() {
641
- var _a;
642
- return (_a = this.gridRef.value) === null || _a === void 0 ? void 0 : _a.querySelector(this.focusedPlaneQuery());
641
+ return this.gridRef.value?.querySelector(this.focusedPlaneQuery());
643
642
  }
644
643
  //
645
644
  // `outOfVis` returns by how many rows/cols the focused cell is outside of the `vis` range for an axis, inset by a
@@ -798,10 +797,9 @@ let DxGrid = class DxGrid extends LitElement {
798
797
  // Resize handlers
799
798
  //
800
799
  axisResizeable(plane, axis, index) {
801
- var _a, _b, _c, _d, _e, _f, _g, _h;
802
800
  return axis === 'col'
803
- ? !!((_c = (_b = (_a = this.columns[plane]) === null || _a === void 0 ? void 0 : _a[index]) === null || _b === void 0 ? void 0 : _b.resizeable) !== null && _c !== void 0 ? _c : (_d = this.columnDefault[plane]) === null || _d === void 0 ? void 0 : _d.resizeable)
804
- : !!((_g = (_f = (_e = this.rows[plane]) === null || _e === void 0 ? void 0 : _e[index]) === null || _f === void 0 ? void 0 : _f.resizeable) !== null && _g !== void 0 ? _g : (_h = this.rowDefault[plane]) === null || _h === void 0 ? void 0 : _h.resizeable);
801
+ ? !!(this.columns[plane]?.[index]?.resizeable ?? this.columnDefault[plane]?.resizeable)
802
+ : !!(this.rows[plane]?.[index]?.resizeable ?? this.rowDefault[plane]?.resizeable);
805
803
  }
806
804
  handleAxisResizeInternal(event) {
807
805
  event.stopPropagation();
@@ -832,7 +830,6 @@ let DxGrid = class DxGrid extends LitElement {
832
830
  //
833
831
  // TODO(thure): This is for rendering presentational objects superimposed onto the canonical grid (e.g. DnD drop line for #8108).
834
832
  renderPresentationLayer(offsetInline, offsetBlock) {
835
- var _a, _b, _c, _d, _e, _f;
836
833
  const visibleCols = this.visColMax - this.visColMin;
837
834
  const visibleRows = this.visRowMax - this.visRowMin;
838
835
  return html `<div
@@ -840,32 +837,29 @@ let DxGrid = class DxGrid extends LitElement {
840
837
  class="dx-grid-layer--presentation"
841
838
  style=${styleMap({
842
839
  gridTemplateColumns: [
843
- ...[...Array((_a = this.frozen.frozenColsStart) !== null && _a !== void 0 ? _a : 0)].map((_, c0) => `${this.colSize(c0, 'frozenColsStart')}px`),
840
+ ...[...Array(this.frozen.frozenColsStart ?? 0)].map((_, c0) => `${this.colSize(c0, 'frozenColsStart')}px`),
844
841
  ...[...Array(visibleCols)].map((_, c0) => c0 === visibleCols - 1
845
842
  ? '1fr'
846
843
  : `${this.colSize(this.visColMin + c0, 'grid') + (c0 === 0 ? offsetInline : 0)}px`),
847
- ...[...Array((_b = this.frozen.frozenColsEnd) !== null && _b !== void 0 ? _b : 0)].map((_, c0) => `${this.colSize(c0, 'frozenColsEnd')}px`),
844
+ ...[...Array(this.frozen.frozenColsEnd ?? 0)].map((_, c0) => `${this.colSize(c0, 'frozenColsEnd')}px`),
848
845
  ].join(' '),
849
846
  gridTemplateRows: [
850
- ...[...Array((_c = this.frozen.frozenRowsStart) !== null && _c !== void 0 ? _c : 0)].map((_, r0) => `${this.rowSize(r0, 'frozenRowsStart')}px`),
847
+ ...[...Array(this.frozen.frozenRowsStart ?? 0)].map((_, r0) => `${this.rowSize(r0, 'frozenRowsStart')}px`),
851
848
  ...[...Array(visibleRows)].map((_, r0) => r0 === visibleRows - 1
852
849
  ? '1fr'
853
850
  : `${this.rowSize(this.visRowMin + r0, 'grid') + (r0 === 0 ? offsetBlock : 0)}px`),
854
- ...[...Array((_d = this.frozen.frozenRowsEnd) !== null && _d !== void 0 ? _d : 0)].map((_, r0) => `${this.rowSize(r0, 'frozenRowsEnd')}px`),
851
+ ...[...Array(this.frozen.frozenRowsEnd ?? 0)].map((_, r0) => `${this.rowSize(r0, 'frozenRowsEnd')}px`),
855
852
  ].join(' '),
856
853
  })}
857
854
  >
858
855
  ${
859
856
  /* TODO(thure): These are debug cells, remove when rendering actual overlay content. */ [
860
- ...Array(((_e = this.frozen.frozenRowsStart) !== null && _e !== void 0 ? _e : 0) + visibleRows + ((_f = this.frozen.frozenRowsEnd) !== null && _f !== void 0 ? _f : 0)),
861
- ].map((_, r0) => {
862
- var _a, _b;
863
- return [...Array(((_a = this.frozen.frozenColsStart) !== null && _a !== void 0 ? _a : 0) + visibleCols + ((_b = this.frozen.frozenColsEnd) !== null && _b !== void 0 ? _b : 0))].map((_, c0) => html `<div
857
+ ...Array((this.frozen.frozenRowsStart ?? 0) + visibleRows + (this.frozen.frozenRowsEnd ?? 0)),
858
+ ].map((_, r0) => [...Array((this.frozen.frozenColsStart ?? 0) + visibleCols + (this.frozen.frozenColsEnd ?? 0))].map((_, c0) => html `<div
864
859
  role="none"
865
860
  class="dx-grid-layer--presentation__cell"
866
861
  style="grid-column:${c0 + 1};grid-row:${r0 + 1}"
867
- ></div>`);
868
- })}
862
+ ></div>`))}
869
863
  </div>`;
870
864
  }
871
865
  renderFixed(plane, selection) {
@@ -873,7 +867,7 @@ let DxGrid = class DxGrid extends LitElement {
873
867
  const rowPlane = resolveRowPlane(plane);
874
868
  const cols = this.frozen[colPlane];
875
869
  const rows = this.frozen[rowPlane];
876
- return (cols !== null && cols !== void 0 ? cols : 0) > 0 && (rows !== null && rows !== void 0 ? rows : 0) > 0
870
+ return (cols ?? 0) > 0 && (rows ?? 0) > 0
877
871
  ? html `<div
878
872
  role="none"
879
873
  tabindex="0"
@@ -897,7 +891,7 @@ let DxGrid = class DxGrid extends LitElement {
897
891
  renderFrozenRows(plane, visibleCols, offsetInline, selection) {
898
892
  const rowPlane = resolveRowPlane(plane);
899
893
  const rows = this.frozen[rowPlane];
900
- return (rows !== null && rows !== void 0 ? rows : 0) > 0
894
+ return (rows ?? 0) > 0
901
895
  ? html `<div
902
896
  role="none"
903
897
  class="dx-grid__plane--frozen-row"
@@ -925,7 +919,7 @@ let DxGrid = class DxGrid extends LitElement {
925
919
  renderFrozenColumns(plane, visibleRows, offsetBlock, selection) {
926
920
  const colPlane = resolveColPlane(plane);
927
921
  const cols = this.frozen[colPlane];
928
- return (cols !== null && cols !== void 0 ? cols : 0) > 0
922
+ return (cols ?? 0) > 0
929
923
  ? html `<div
930
924
  role="none"
931
925
  class="dx-grid__plane--frozen-col"
@@ -951,17 +945,16 @@ let DxGrid = class DxGrid extends LitElement {
951
945
  : null;
952
946
  }
953
947
  cellReadonly(col, row, plane) {
954
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
955
948
  const colPlane = resolveColPlane(plane);
956
949
  const rowPlane = resolveRowPlane(plane);
957
950
  // Check cell-specific setting first.
958
- const cellReadonly = (_a = this.cell(col, row, plane)) === null || _a === void 0 ? void 0 : _a.readonly;
951
+ const cellReadonly = this.cell(col, row, plane)?.readonly;
959
952
  if (cellReadonly !== undefined) {
960
953
  return isReadonly(cellReadonly);
961
954
  }
962
955
  // Check column/row defaults.
963
- const colReadOnly = (_e = (_d = (_c = (_b = this.columns) === null || _b === void 0 ? void 0 : _b[colPlane]) === null || _c === void 0 ? void 0 : _c[col]) === null || _d === void 0 ? void 0 : _d.readonly) !== null && _e !== void 0 ? _e : (_g = (_f = this.columnDefault) === null || _f === void 0 ? void 0 : _f[colPlane]) === null || _g === void 0 ? void 0 : _g.readonly;
964
- const rowReadOnly = (_l = (_k = (_j = (_h = this.rows) === null || _h === void 0 ? void 0 : _h[rowPlane]) === null || _j === void 0 ? void 0 : _j[row]) === null || _k === void 0 ? void 0 : _k.readonly) !== null && _l !== void 0 ? _l : (_o = (_m = this.rowDefault) === null || _m === void 0 ? void 0 : _m[rowPlane]) === null || _o === void 0 ? void 0 : _o.readonly;
956
+ const colReadOnly = this.columns?.[colPlane]?.[col]?.readonly ?? this.columnDefault?.[colPlane]?.readonly;
957
+ const rowReadOnly = this.rows?.[rowPlane]?.[row]?.readonly ?? this.rowDefault?.[rowPlane]?.readonly;
965
958
  return isReadonly(colReadOnly) || isReadonly(rowReadOnly);
966
959
  }
967
960
  /**
@@ -969,35 +962,59 @@ let DxGrid = class DxGrid extends LitElement {
969
962
  * @returns true if the cells text content is selectable, false otherwise.
970
963
  */
971
964
  cellTextSelectable(col, row, plane) {
972
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
973
965
  const colPlane = resolveColPlane(plane);
974
966
  const rowPlane = resolveRowPlane(plane);
975
967
  // Check cell-specific setting first.
976
- const cellReadonly = (_a = this.cell(col, row, plane)) === null || _a === void 0 ? void 0 : _a.readonly;
968
+ const cellReadonly = this.cell(col, row, plane)?.readonly;
977
969
  if (cellReadonly !== undefined) {
978
970
  return cellReadonly === 'text-select';
979
971
  }
980
972
  // Check column/row defaults.
981
- const colReadonly = (_e = (_d = (_c = (_b = this.columns) === null || _b === void 0 ? void 0 : _b[colPlane]) === null || _c === void 0 ? void 0 : _c[col]) === null || _d === void 0 ? void 0 : _d.readonly) !== null && _e !== void 0 ? _e : (_g = (_f = this.columnDefault) === null || _f === void 0 ? void 0 : _f[colPlane]) === null || _g === void 0 ? void 0 : _g.readonly;
982
- const rowReadonly = (_l = (_k = (_j = (_h = this.rows) === null || _h === void 0 ? void 0 : _h[rowPlane]) === null || _j === void 0 ? void 0 : _j[row]) === null || _k === void 0 ? void 0 : _k.readonly) !== null && _l !== void 0 ? _l : (_o = (_m = this.rowDefault) === null || _m === void 0 ? void 0 : _m[rowPlane]) === null || _o === void 0 ? void 0 : _o.readonly;
973
+ const colReadonly = this.columns?.[colPlane]?.[col]?.readonly ?? this.columnDefault?.[colPlane]?.readonly;
974
+ const rowReadonly = this.rows?.[rowPlane]?.[row]?.readonly ?? this.rowDefault?.[rowPlane]?.readonly;
983
975
  return colReadonly === 'text-select' || rowReadonly === 'text-select';
984
976
  }
977
+ getOverflowingCellModifiedDeltas(event) {
978
+ if (!event.target) {
979
+ return event;
980
+ }
981
+ const element = event.target;
982
+ const activeCell = element.closest('[data-dx-active]');
983
+ const contentEl = element.closest('.dx-grid__cell__content');
984
+ if (!activeCell || !contentEl || !document.activeElement?.contains(element)) {
985
+ return event;
986
+ }
987
+ // Commented-out code will let the event delta through unmodified if the cell can scroll but is scrolled to the end
988
+ // in the same direction as the wheel event, a.k.a. “overscroll”; this is probably undesirable, though.
989
+ const { scrollWidth, clientWidth, scrollHeight, clientHeight /*, scrollLeft, scrollTop */ } = contentEl;
990
+ if (scrollWidth <= clientWidth && scrollHeight <= clientHeight) {
991
+ return event;
992
+ }
993
+ const deltaX = scrollWidth > clientWidth /* &&
994
+ ((event.deltaX < 0 && scrollLeft > 0) || (event.deltaX > 0 && scrollLeft < scrollWidth - clientWidth)) */
995
+ ? 0
996
+ : event.deltaX;
997
+ const deltaY = scrollHeight > clientHeight /* &&
998
+ ((event.deltaY < 0 && scrollTop > 0) || (event.deltaY > 0 && scrollTop < scrollHeight - clientHeight)) */
999
+ ? 0
1000
+ : event.deltaY;
1001
+ return { deltaX, deltaY };
1002
+ }
985
1003
  renderCell(col, row, plane, selected, visCol = col, visRow = row) {
986
- var _a, _b;
987
1004
  const cell = this.cell(col, row, plane);
988
1005
  const active = this.cellActive(col, row, plane);
989
1006
  const readonly = this.cellReadonly(col, row, plane);
990
1007
  const textSelectable = this.cellTextSelectable(col, row, plane);
991
- const resizeIndex = (cell === null || cell === void 0 ? void 0 : cell.resizeHandle) ? (cell.resizeHandle === 'col' ? col : row) : undefined;
992
- const resizePlane = (cell === null || cell === void 0 ? void 0 : cell.resizeHandle) ? resolveFrozenPlane(cell.resizeHandle, plane) : undefined;
993
- const accessory = (cell === null || cell === void 0 ? void 0 : cell.accessoryHtml) ? staticHtml `${unsafeStatic(cell.accessoryHtml)}` : null;
1008
+ const resizeIndex = cell?.resizeHandle ? (cell.resizeHandle === 'col' ? col : row) : undefined;
1009
+ const resizePlane = cell?.resizeHandle ? resolveFrozenPlane(cell.resizeHandle, plane) : undefined;
1010
+ const accessory = cell?.accessoryHtml ? staticHtml `${unsafeStatic(cell.accessoryHtml)}` : null;
994
1011
  return html `<div
995
1012
  role="gridcell"
996
1013
  tabindex="0"
997
1014
  aria-selected=${selected ? 'true' : nothing}
998
1015
  aria-readonly=${readonly ? 'true' : nothing}
999
- class=${(_a = cell === null || cell === void 0 ? void 0 : cell.className) !== null && _a !== void 0 ? _a : nothing}
1000
- data-refs=${(_b = cell === null || cell === void 0 ? void 0 : cell.dataRefs) !== null && _b !== void 0 ? _b : nothing}
1016
+ class=${cell?.className ?? nothing}
1017
+ data-refs=${cell?.dataRefs ?? nothing}
1001
1018
  ?data-dx-active=${active}
1002
1019
  data-text-selectable=${textSelectable ? 'true' : 'false'}
1003
1020
  data-dx-grid-action="cell"
@@ -1005,9 +1022,8 @@ let DxGrid = class DxGrid extends LitElement {
1005
1022
  aria-rowindex=${row}
1006
1023
  style="grid-column:${visCol + 1};grid-row:${visRow + 1}"
1007
1024
  >
1008
- ${this.mode !== 'browse' && active ? null : cell === null || cell === void 0 ? void 0 : cell.value}${this.mode !== 'browse' && active
1009
- ? null
1010
- : accessory}${(cell === null || cell === void 0 ? void 0 : cell.resizeHandle) &&
1025
+ <div role="none" class="dx-grid__cell__content">${cell?.value}${accessory}</div>
1026
+ ${cell?.resizeHandle &&
1011
1027
  this.mode === 'browse' &&
1012
1028
  this.axisResizeable(resizePlane, cell.resizeHandle, resizeIndex)
1013
1029
  ? html `<dx-grid-axis-resize-handle
@@ -1113,10 +1129,9 @@ let DxGrid = class DxGrid extends LitElement {
1113
1129
  this.updateIntrinsicBlockSize();
1114
1130
  }
1115
1131
  computeColSizes() {
1116
- var _a;
1117
- this.colSizes = Object.entries((_a = this.columns) !== null && _a !== void 0 ? _a : {}).reduce((acc, [plane, planeColMeta]) => {
1132
+ this.colSizes = Object.entries(this.columns ?? {}).reduce((acc, [plane, planeColMeta]) => {
1118
1133
  acc[plane] = Object.entries(planeColMeta).reduce((planeAcc, [col, colMeta]) => {
1119
- if (colMeta === null || colMeta === void 0 ? void 0 : colMeta.size) {
1134
+ if (colMeta?.size) {
1120
1135
  planeAcc[col] = colMeta.size;
1121
1136
  }
1122
1137
  return planeAcc;
@@ -1125,10 +1140,9 @@ let DxGrid = class DxGrid extends LitElement {
1125
1140
  }, { grid: {} });
1126
1141
  }
1127
1142
  computeRowSizes() {
1128
- var _a;
1129
- this.rowSizes = Object.entries((_a = this.rows) !== null && _a !== void 0 ? _a : {}).reduce((acc, [plane, planeRowMeta]) => {
1143
+ this.rowSizes = Object.entries(this.rows ?? {}).reduce((acc, [plane, planeRowMeta]) => {
1130
1144
  acc[plane] = Object.entries(planeRowMeta).reduce((planeAcc, [row, rowMeta]) => {
1131
- if (rowMeta === null || rowMeta === void 0 ? void 0 : rowMeta.size) {
1145
+ if (rowMeta?.size) {
1132
1146
  planeAcc[row] = rowMeta.size;
1133
1147
  }
1134
1148
  return planeAcc;
@@ -1160,6 +1174,12 @@ let DxGrid = class DxGrid extends LitElement {
1160
1174
  this.updatePosInline();
1161
1175
  this.updateVisInline();
1162
1176
  }
1177
+ if (changedProperties.has('frozen')) {
1178
+ this.updateIntrinsicBlockSize();
1179
+ this.updateIntrinsicInlineSize();
1180
+ this.updateVisBlock();
1181
+ this.updateVisInline();
1182
+ }
1163
1183
  if (this.getCells &&
1164
1184
  (changedProperties.has('initialCells') ||
1165
1185
  changedProperties.has('visColMin') ||
@@ -1169,7 +1189,8 @@ let DxGrid = class DxGrid extends LitElement {
1169
1189
  changedProperties.has('columns') ||
1170
1190
  changedProperties.has('rows') ||
1171
1191
  changedProperties.has('limitColumns') ||
1172
- changedProperties.has('limitRows'))) {
1192
+ changedProperties.has('limitRows') ||
1193
+ changedProperties.has('frozen'))) {
1173
1194
  this.updateCells(true);
1174
1195
  }
1175
1196
  }
@@ -1184,20 +1205,20 @@ let DxGrid = class DxGrid extends LitElement {
1184
1205
  this.refocus();
1185
1206
  }
1186
1207
  }
1187
- updateIfWithinBounds({ col, row }) {
1208
+ updateIfWithinBounds({ col, row }, includeFixed) {
1188
1209
  if (col >= this.visColMin && col <= this.visColMax && row >= this.visRowMin && row <= this.visRowMax) {
1210
+ this.updateCells(includeFixed);
1189
1211
  this.requestUpdate();
1190
1212
  return true;
1191
1213
  }
1192
1214
  return false;
1193
1215
  }
1194
1216
  disconnectedCallback() {
1195
- var _a;
1196
1217
  super.disconnectedCallback();
1197
1218
  if (this.viewportRef.value) {
1198
1219
  this.observer.unobserve(this.viewportRef.value);
1199
1220
  }
1200
- (_a = document.defaultView) === null || _a === void 0 ? void 0 : _a.removeEventListener('wheel', this.handleTopLevelWheel);
1221
+ document.defaultView?.removeEventListener('wheel', this.handleTopLevelWheel);
1201
1222
  }
1202
1223
  createRenderRoot() {
1203
1224
  return this;
@@ -1342,6 +1363,6 @@ DxGrid = __decorate([
1342
1363
  customElement('dx-grid')
1343
1364
  ], DxGrid);
1344
1365
  export { DxGrid };
1345
- export { rowToA1Notation, colToA1Notation, closestAction, closestCell, parseCellIndex, toPlaneCellIndex, cellQuery, } from './util';
1366
+ export { rowToA1Notation, colToA1Notation, closestAction, closestCell, parseCellIndex, toPlaneCellIndex, cellQuery, accessoryHandlesPointerdownAttrs, } from './util';
1346
1367
  export const commentedClassName = 'dx-grid__cell--commented';
1347
1368
  //# sourceMappingURL=dx-grid.js.map