@dxos/lit-grid 0.8.4-main.84f28bd → 0.8.4-main.ae835ea

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 (38) hide show
  1. package/dist/src/defs.d.ts +1 -0
  2. package/dist/src/defs.d.ts.map +1 -1
  3. package/dist/src/defs.js +1 -0
  4. package/dist/src/defs.js.map +1 -1
  5. package/dist/src/dx-grid-axis-resize-handle.d.ts.map +1 -1
  6. package/dist/src/dx-grid-axis-resize-handle.js +3 -5
  7. package/dist/src/dx-grid-axis-resize-handle.js.map +1 -1
  8. package/dist/src/dx-grid-multiselect-cell.d.ts.map +1 -1
  9. package/dist/src/dx-grid-multiselect-cell.js +2 -1
  10. package/dist/src/dx-grid-multiselect-cell.js.map +1 -1
  11. package/dist/src/dx-grid.d.ts +13 -8
  12. package/dist/src/dx-grid.d.ts.map +1 -1
  13. package/dist/src/dx-grid.js +205 -166
  14. package/dist/src/dx-grid.js.map +1 -1
  15. package/dist/src/dx-grid.lit-stories.js +15 -18
  16. package/dist/src/dx-grid.lit-stories.js.map +1 -1
  17. package/dist/src/playwright/dx-grid.spec.js.map +1 -1
  18. package/dist/src/testing/dx-grid-manager.d.ts.map +1 -1
  19. package/dist/src/testing/dx-grid-manager.js.map +1 -1
  20. package/dist/src/types.d.ts +9 -0
  21. package/dist/src/types.d.ts.map +1 -1
  22. package/dist/src/types.js.map +1 -1
  23. package/dist/src/util.d.ts +4 -1
  24. package/dist/src/util.d.ts.map +1 -1
  25. package/dist/src/util.js +11 -11
  26. package/dist/src/util.js.map +1 -1
  27. package/dist/tsconfig.tsbuildinfo +1 -1
  28. package/package.json +4 -4
  29. package/src/defs.ts +1 -0
  30. package/src/dx-grid-axis-resize-handle.pcss +6 -0
  31. package/src/dx-grid-axis-resize-handle.ts +1 -1
  32. package/src/dx-grid-multiselect-cell.ts +2 -1
  33. package/src/dx-grid.pcss +47 -31
  34. package/src/dx-grid.ts +200 -114
  35. package/src/playwright/dx-grid.spec.ts +1 -1
  36. package/src/testing/dx-grid-manager.ts +1 -1
  37. package/src/types.ts +11 -0
  38. package/src/util.ts +13 -9
@@ -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';
15
- import { defaultColSize, defaultRowSize } from './defs';
16
- // eslint-disable-next-line unused-imports/no-unused-imports
14
+ import { html as staticHtml, unsafeStatic } from 'lit/static-html.js';
15
+ import { defaultColSize, defaultRowSize, focusUnfurlDefault } from './defs';
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 = {
@@ -37,6 +35,7 @@ let DxGrid = class DxGrid extends LitElement {
37
35
  this.frozen = {};
38
36
  this.overscroll = undefined;
39
37
  this.activeRefs = '';
38
+ this.focusIndicatorVariant = 'sheet';
40
39
  /**
41
40
  * When this function is defined, it is used first to try to get a value for a cell,
42
41
  * and otherwise will fall back to `cells`.
@@ -83,6 +82,11 @@ let DxGrid = class DxGrid extends LitElement {
83
82
  this.templatefrozenRowsStart = '';
84
83
  this.templatefrozenRowsEnd = '';
85
84
  //
85
+ // `frozen…Size` is used to measure space available for the non-fixed planes
86
+ //
87
+ this.frozenColsSize = 0;
88
+ this.frozenRowsSize = 0;
89
+ //
86
90
  // Focus, selection, and resize states
87
91
  //
88
92
  this.pointer = null;
@@ -122,7 +126,7 @@ let DxGrid = class DxGrid extends LitElement {
122
126
  this.dispatchSelectionChange();
123
127
  }
124
128
  if (this.mode === 'edit-select') {
125
- // Prevent focus moving when editing while selection is possible
129
+ // Prevent focus moving when editing while selection is possible.
126
130
  event.preventDefault();
127
131
  }
128
132
  else if (this.focusActive && isSameCell(this.focusedCell, cellCoords)) {
@@ -133,8 +137,7 @@ let DxGrid = class DxGrid extends LitElement {
133
137
  }
134
138
  };
135
139
  this.handlePointerUp = (event) => {
136
- var _a;
137
- if (((_a = this.pointer) === null || _a === void 0 ? void 0 : _a.state) === 'selecting') {
140
+ if (this.pointer?.state === 'selecting') {
138
141
  const cell = closestCell(event.target);
139
142
  if (cell) {
140
143
  this.setSelectionEnd(cell);
@@ -144,8 +147,7 @@ let DxGrid = class DxGrid extends LitElement {
144
147
  this.pointer = null;
145
148
  };
146
149
  this.handlePointerMove = (event) => {
147
- var _a, _b;
148
- if (((_a = this.pointer) === null || _a === void 0 ? void 0 : _a.state) === 'panning') {
150
+ if (this.pointer?.state === 'panning') {
149
151
  const panEvent = event;
150
152
  panEvent.deltaX = this.pointer.pageX - event.pageX;
151
153
  panEvent.deltaY = this.pointer.pageY - event.pageY;
@@ -156,7 +158,7 @@ let DxGrid = class DxGrid extends LitElement {
156
158
  else if (shouldSelect(this.pointer, event)) {
157
159
  this.pointer = { state: 'selecting' };
158
160
  }
159
- else if (((_b = this.pointer) === null || _b === void 0 ? void 0 : _b.state) === 'selecting') {
161
+ else if (this.pointer?.state === 'selecting') {
160
162
  const cell = closestCell(event.target);
161
163
  if (cell &&
162
164
  cell.plane === this.selectionStart.plane &&
@@ -166,25 +168,23 @@ let DxGrid = class DxGrid extends LitElement {
166
168
  }
167
169
  };
168
170
  //
169
- // Resize & reposition handlers, observer, ref
171
+ // Resize & reposition handlers, observer, ref.
170
172
  //
171
173
  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 : {
174
+ const { inlineSize, blockSize } = entries?.[0]?.contentBoxSize?.[0] ?? {
174
175
  inlineSize: 0,
175
176
  blockSize: 0,
176
177
  };
177
- if (Math.abs(inlineSize - this.sizeInline) > resizeTolerance ||
178
- Math.abs(blockSize - this.sizeBlock) > resizeTolerance) {
178
+ if (Math.abs(inlineSize - this.frozenColsSize - this.sizeInline) > resizeTolerance ||
179
+ Math.abs(blockSize - this.frozenRowsSize - this.sizeBlock) > resizeTolerance) {
179
180
  // console.info('[updating bounds]', 'resize', [inlineSize - this.sizeInline, blockSize - this.sizeBlock]);
180
- this.sizeInline = inlineSize;
181
- this.sizeBlock = blockSize;
181
+ this.sizeInline = inlineSize - this.frozenColsSize;
182
+ this.sizeBlock = blockSize - this.frozenRowsSize;
182
183
  this.updateVis();
183
184
  queueMicrotask(() => this.updatePos());
184
185
  }
185
186
  });
186
187
  this.gridRef = createRef();
187
- this.viewportRef = createRef();
188
188
  this.maybeUpdateVisInline = () => {
189
189
  if (this.posInline < this.binInlineMin || this.posInline >= this.binInlineMax) {
190
190
  this.updateVisInline();
@@ -196,8 +196,7 @@ let DxGrid = class DxGrid extends LitElement {
196
196
  }
197
197
  };
198
198
  this.handleTopLevelWheel = (event) => {
199
- var _a;
200
- if (event.gridId === ((_a = this.gridId) !== null && _a !== void 0 ? _a : 'never')) {
199
+ if (event.gridId === (this.gridId ?? 'never')) {
201
200
  if (this.overscroll === 'trap' ||
202
201
  (this.overscroll === 'inline' && event.overscrollInline === 0) ||
203
202
  (this.overscroll === 'block' && event.overscrollBlock === 0)) {
@@ -229,12 +228,12 @@ let DxGrid = class DxGrid extends LitElement {
229
228
  event.gridId = this.gridId;
230
229
  }
231
230
  };
232
- // Wheel, top-level and element-level
233
- (_a = document.defaultView) === null || _a === void 0 ? void 0 : _a.addEventListener('wheel', this.handleTopLevelWheel, { passive: false });
231
+ // Wheel, top-level and element-level.
232
+ document.defaultView?.addEventListener('wheel', this.handleTopLevelWheel, { passive: false });
234
233
  this.addEventListener('wheel', this.handleWheel);
235
- // Custom event(s)
234
+ // Custom event(s).
236
235
  this.addEventListener('dx-axis-resize-internal', this.handleAxisResizeInternal);
237
- // Standard events
236
+ // Standard events.
238
237
  this.addEventListener('pointerdown', this.handlePointerDown);
239
238
  this.addEventListener('pointermove', this.handlePointerMove);
240
239
  this.addEventListener('pointerup', this.handlePointerUp);
@@ -314,32 +313,27 @@ let DxGrid = class DxGrid extends LitElement {
314
313
  }
315
314
  }
316
315
  moveFocusBetweenPlanes(event, plane) {
317
- var _a, _b, _c, _d;
318
- const planeElement = (_a = this.gridRef.value) === null || _a === void 0 ? void 0 : _a.querySelector(`[data-dx-grid-plane="${plane}"]`);
316
+ const planeElement = this.gridRef.value?.querySelector(`[data-dx-grid-plane="${plane}"]`);
319
317
  if (planeElement) {
320
318
  const axis = event.key === 'ArrowUp' || event.key === 'ArrowDown' ? 'col' : 'row';
321
319
  const delta = event.key === 'ArrowLeft' || event.key === 'ArrowUp' ? -1 : 1;
322
- const planeAxis = planeElement === null || planeElement === void 0 ? void 0 : planeElement.getAttribute(`data-dx-grid-plane-${axis}`);
323
- 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);
324
- (_d = adjacentPlanes[(adjacentPlanes.length + adjacentPlanes.indexOf(planeElement) + delta) % adjacentPlanes.length]) === null || _d === void 0 ? void 0 : _d.focus({ preventScroll: true });
320
+ const planeAxis = planeElement?.getAttribute(`data-dx-grid-plane-${axis}`);
321
+ const adjacentPlanes = Array.from(this.gridRef.value?.querySelectorAll(`[data-dx-grid-plane-${axis}="${planeAxis}"]`) ?? [planeElement]).filter((el) => !!el);
322
+ adjacentPlanes[(adjacentPlanes.length + adjacentPlanes.indexOf(planeElement) + delta) % adjacentPlanes.length]?.focus({ preventScroll: true });
325
323
  }
326
324
  }
327
325
  moveFocusIntoPlane(plane) {
328
- var _a;
329
- if (this.focusedCell.plane !== plane) {
330
- const colPlane = resolveColPlane(plane);
331
- const rowPlane = resolveRowPlane(plane);
332
- this.focusedCell = {
333
- plane,
334
- col: colPlane === 'grid' ? this.visColMin : 0,
335
- row: rowPlane === 'grid' ? this.visRowMin : 0,
336
- };
337
- }
338
- (_a = this.focusedCellElement()) === null || _a === void 0 ? void 0 : _a.focus({ preventScroll: true });
326
+ const colPlane = resolveColPlane(plane);
327
+ const rowPlane = resolveRowPlane(plane);
328
+ this.focusedCell = {
329
+ plane,
330
+ col: colPlane === 'grid' ? this.visColMin : 0,
331
+ row: rowPlane === 'grid' ? this.visRowMin : 0,
332
+ };
333
+ this.focusedCellElement()?.focus({ preventScroll: true });
339
334
  }
340
335
  moveFocusToPlane() {
341
- var _a;
342
- (_a = this.focusedPlaneElement()) === null || _a === void 0 ? void 0 : _a.focus({ preventScroll: true });
336
+ this.focusedPlaneElement()?.focus({ preventScroll: true });
343
337
  }
344
338
  handleKeydown(event) {
345
339
  if (this.focusActive && this.mode === 'browse') {
@@ -390,6 +384,13 @@ let DxGrid = class DxGrid extends LitElement {
390
384
  event.preventDefault();
391
385
  this.dispatchEditRequest();
392
386
  break;
387
+ case 'Backspace':
388
+ case 'Delete':
389
+ if (!event.defaultPrevented) {
390
+ event.preventDefault();
391
+ this.dispatchEditRequest('');
392
+ }
393
+ break;
393
394
  default:
394
395
  if (event.key.length === 1 && event.key.match(/\P{Cc}/u) && !(event.metaKey || event.ctrlKey)) {
395
396
  this.dispatchEditRequest(event.key);
@@ -403,19 +404,16 @@ let DxGrid = class DxGrid extends LitElement {
403
404
  // Accessors
404
405
  //
405
406
  colSize(c, plane) {
406
- var _a, _b, _c, _d, _e;
407
407
  const resolvedPlane = resolveColPlane(plane);
408
- 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;
408
+ return this.colSizes?.[resolvedPlane]?.[c] ?? this.columnDefault[resolvedPlane]?.size ?? defaultColSize;
409
409
  }
410
410
  rowSize(r, plane) {
411
- var _a, _b, _c, _d, _e;
412
411
  const resolvedPlane = resolveRowPlane(plane);
413
- 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;
412
+ return this.rowSizes?.[resolvedPlane]?.[r] ?? this.rowDefault[resolvedPlane]?.size ?? defaultRowSize;
414
413
  }
415
414
  cell(c, r, plane) {
416
- var _a, _b, _c, _d, _e;
417
415
  const index = `${c}${separator}${r}`;
418
- 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];
416
+ return this.cells?.[plane]?.[index] ?? this.initialCells?.[plane]?.[index];
419
417
  }
420
418
  cellActive(c, r, plane) {
421
419
  return this.focusedCell.plane === plane && this.focusedCell.col === c && this.focusedCell.row === r;
@@ -476,11 +474,11 @@ let DxGrid = class DxGrid extends LitElement {
476
474
  return this.intrinsicBlockSize - this.sizeBlock;
477
475
  }
478
476
  updatePosInline(inline, maxInline = this.maxPosInline()) {
479
- this.posInline = Math.max(0, Math.min(maxInline, inline !== null && inline !== void 0 ? inline : this.posInline));
477
+ this.posInline = Math.max(0, Math.min(maxInline, inline ?? this.posInline));
480
478
  this.maybeUpdateVisInline();
481
479
  }
482
480
  updatePosBlock(block, maxBlock = this.maxPosBlock()) {
483
- this.posBlock = Math.max(0, Math.min(maxBlock, block !== null && block !== void 0 ? block : this.posBlock));
481
+ this.posBlock = Math.max(0, Math.min(maxBlock, block ?? this.posBlock));
484
482
  this.maybeUpdateVisBlock();
485
483
  }
486
484
  updatePos(inline, block, maxInline, maxBlock) {
@@ -488,8 +486,7 @@ let DxGrid = class DxGrid extends LitElement {
488
486
  this.updatePosBlock(block, maxBlock);
489
487
  }
490
488
  updateVisInline() {
491
- var _a, _b;
492
- // todo: avoid starting from zero
489
+ // todo: avoid starting from zero.
493
490
  let axisCursor = 0;
494
491
  let pxCursor = this.colSize(axisCursor, 'grid');
495
492
  while (pxCursor < this.posInline) {
@@ -518,16 +515,20 @@ let DxGrid = class DxGrid extends LitElement {
518
515
  this.templateGridColumns = [...Array(this.visColMax - this.visColMin)]
519
516
  .map((_, c0) => `${this.colSize(this.visColMin + c0, 'grid')}px`)
520
517
  .join(' ');
521
- this.templatefrozenColsStart = [...Array((_a = this.frozen.frozenColsStart) !== null && _a !== void 0 ? _a : 0)]
518
+ this.templatefrozenColsStart = [...Array(this.frozen.frozenColsStart ?? 0)]
522
519
  .map((_, c0) => `${this.colSize(c0, 'frozenColsStart')}px`)
523
520
  .join(' ');
524
- this.templatefrozenColsEnd = [...Array((_b = this.frozen.frozenColsEnd) !== null && _b !== void 0 ? _b : 0)]
521
+ this.templatefrozenColsEnd = [...Array(this.frozen.frozenColsEnd ?? 0)]
525
522
  .map((_, c0) => `${this.colSize(c0, 'frozenColsEnd')}px`)
526
523
  .join(' ');
524
+ this.frozenColsSize =
525
+ [...Array(this.frozen.frozenColsStart ?? 0)].reduce((sum, _, c0) => sum + this.colSize(c0, 'frozenColsStart'), 0) +
526
+ gap * Math.max(0, this.frozen.frozenColsStart ?? 0 - 1) +
527
+ [...Array(this.frozen.frozenColsEnd ?? 0)].reduce((sum, _, c0) => sum + this.colSize(c0, 'frozenColsEnd'), 0) +
528
+ gap * Math.max(0, this.frozen.frozenColsEnd ?? 0 - 1);
527
529
  }
528
530
  updateVisBlock() {
529
- var _a, _b;
530
- // todo: avoid starting from zero
531
+ // todo: avoid starting from zero.
531
532
  let axisCursor = 0;
532
533
  let pxCursor = this.rowSize(axisCursor, 'grid');
533
534
  while (pxCursor < this.posBlock) {
@@ -556,19 +557,23 @@ let DxGrid = class DxGrid extends LitElement {
556
557
  this.templateGridRows = [...Array(this.visRowMax - this.visRowMin)]
557
558
  .map((_, r0) => `${this.rowSize(this.visRowMin + r0, 'grid')}px`)
558
559
  .join(' ');
559
- this.templatefrozenRowsStart = [...Array((_a = this.frozen.frozenRowsStart) !== null && _a !== void 0 ? _a : 0)]
560
+ this.templatefrozenRowsStart = [...Array(this.frozen.frozenRowsStart ?? 0)]
560
561
  .map((_, r0) => `${this.rowSize(r0, 'frozenRowsStart')}px`)
561
562
  .join(' ');
562
- this.templatefrozenRowsEnd = [...Array((_b = this.frozen.frozenRowsEnd) !== null && _b !== void 0 ? _b : 0)]
563
+ this.templatefrozenRowsEnd = [...Array(this.frozen.frozenRowsEnd ?? 0)]
563
564
  .map((_, r0) => `${this.rowSize(r0, 'frozenRowsEnd')}px`)
564
565
  .join(' ');
566
+ this.frozenRowsSize =
567
+ [...Array(this.frozen.frozenRowsStart ?? 0)].reduce((sum, _, r0) => sum + this.rowSize(r0, 'frozenRowsStart'), 0) +
568
+ gap * Math.max(0, this.frozen.frozenRowsStart ?? 0 - 1) +
569
+ [...Array(this.frozen.frozenRowsEnd ?? 0)].reduce((sum, _, r0) => sum + this.rowSize(r0, 'frozenRowsEnd'), 0) +
570
+ gap * Math.max(0, this.frozen.frozenRowsEnd ?? 0 - 1);
565
571
  }
566
572
  updateVis() {
567
573
  this.updateVisInline();
568
574
  this.updateVisBlock();
569
575
  }
570
576
  updateCells(includeFixed) {
571
- var _a, _b, _c, _d, _e, _f, _g, _h;
572
577
  this.cells.grid = this.getCells({
573
578
  start: { col: this.visColMin, row: this.visRowMin },
574
579
  end: { col: this.visColMax, row: this.visRowMax },
@@ -587,25 +592,25 @@ let DxGrid = class DxGrid extends LitElement {
587
592
  }, plane);
588
593
  });
589
594
  if (includeFixed) {
590
- if (((_a = this.frozen.frozenColsStart) !== null && _a !== void 0 ? _a : 0) > 0 && ((_b = this.frozen.frozenRowsStart) !== null && _b !== void 0 ? _b : 0) > 0) {
595
+ if ((this.frozen.frozenColsStart ?? 0) > 0 && (this.frozen.frozenRowsStart ?? 0) > 0) {
591
596
  this.cells.fixedStartStart = this.getCells({
592
597
  start: { col: 0, row: 0 },
593
598
  end: { col: this.frozen.frozenColsStart, row: this.frozen.frozenRowsStart },
594
599
  }, 'fixedStartStart');
595
600
  }
596
- if (((_c = this.frozen.frozenColsEnd) !== null && _c !== void 0 ? _c : 0) > 0 && ((_d = this.frozen.frozenRowsStart) !== null && _d !== void 0 ? _d : 0) > 0) {
601
+ if ((this.frozen.frozenColsEnd ?? 0) > 0 && (this.frozen.frozenRowsStart ?? 0) > 0) {
597
602
  this.cells.fixedStartEnd = this.getCells({
598
603
  start: { col: 0, row: 0 },
599
604
  end: { col: this.frozen.frozenColsEnd, row: this.frozen.frozenRowsStart },
600
605
  }, 'fixedStartEnd');
601
606
  }
602
- if (((_e = this.frozen.frozenColsStart) !== null && _e !== void 0 ? _e : 0) > 0 && ((_f = this.frozen.frozenRowsEnd) !== null && _f !== void 0 ? _f : 0) > 0) {
607
+ if ((this.frozen.frozenColsStart ?? 0) > 0 && (this.frozen.frozenRowsEnd ?? 0) > 0) {
603
608
  this.cells.fixedEndStart = this.getCells({
604
609
  start: { col: 0, row: 0 },
605
610
  end: { col: this.frozen.frozenColsStart, row: this.frozen.frozenRowsEnd },
606
611
  }, 'fixedEndStart');
607
612
  }
608
- if (((_g = this.frozen.frozenColsEnd) !== null && _g !== void 0 ? _g : 0) > 0 && ((_h = this.frozen.frozenRowsEnd) !== null && _h !== void 0 ? _h : 0) > 0) {
613
+ if ((this.frozen.frozenColsEnd ?? 0) > 0 && (this.frozen.frozenRowsEnd ?? 0) > 0) {
609
614
  this.cells.fixedEndEnd = this.getCells({
610
615
  start: { col: 0, row: 0 },
611
616
  end: { col: this.frozen.frozenColsEnd, row: this.frozen.frozenRowsEnd },
@@ -643,12 +648,10 @@ let DxGrid = class DxGrid extends LitElement {
643
648
  return `[data-dx-grid-plane=${this.focusedCell.plane}]`;
644
649
  }
645
650
  focusedCellElement() {
646
- var _a;
647
- return (_a = this.gridRef.value) === null || _a === void 0 ? void 0 : _a.querySelector(this.focusedCellQuery());
651
+ return this.gridRef.value?.querySelector(this.focusedCellQuery());
648
652
  }
649
653
  focusedPlaneElement() {
650
- var _a;
651
- return (_a = this.gridRef.value) === null || _a === void 0 ? void 0 : _a.querySelector(this.focusedPlaneQuery());
654
+ return this.gridRef.value?.querySelector(this.focusedPlaneQuery());
652
655
  }
653
656
  //
654
657
  // `outOfVis` returns by how many rows/cols the focused cell is outside of the `vis` range for an axis, inset by a
@@ -746,7 +749,7 @@ let DxGrid = class DxGrid extends LitElement {
746
749
  }, 0);
747
750
  }
748
751
  /**
749
- * Updates `pos` so that a cell in focus is fully within the viewport
752
+ * Updates `pos` so that a cell in focus is fully within the viewport.
750
753
  */
751
754
  snapPosToFocusedCell() {
752
755
  const outOfVis = this.focusedCellOutOfVis();
@@ -807,22 +810,37 @@ let DxGrid = class DxGrid extends LitElement {
807
810
  // Resize handlers
808
811
  //
809
812
  axisResizeable(plane, axis, index) {
810
- var _a, _b, _c, _d, _e, _f, _g, _h;
811
813
  return axis === 'col'
812
- ? !!((_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)
813
- : !!((_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);
814
+ ? !!(this.columns[plane]?.[index]?.resizeable ?? this.columnDefault[plane]?.resizeable)
815
+ : !!(this.rows[plane]?.[index]?.resizeable ?? this.rowDefault[plane]?.resizeable);
816
+ }
817
+ clampAxisSize(plane, axis, index, requestedSize) {
818
+ const minSize = axis === 'col'
819
+ ? (this.columns[plane]?.[index]?.minSize ??
820
+ this.columnDefault[plane]?.minSize ??
821
+ sizeColMin)
822
+ : (this.rows[plane]?.[index]?.minSize ??
823
+ this.rowDefault[plane]?.minSize ??
824
+ sizeRowMin);
825
+ const maxSize = axis === 'col'
826
+ ? (this.columns[plane]?.[index]?.maxSize ??
827
+ this.columnDefault[plane]?.maxSize ??
828
+ sizeColMax)
829
+ : (this.rows[plane]?.[index]?.maxSize ??
830
+ this.rowDefault[plane]?.maxSize ??
831
+ sizeRowMax);
832
+ return Math.max(minSize, Math.min(maxSize, requestedSize));
814
833
  }
815
834
  handleAxisResizeInternal(event) {
816
835
  event.stopPropagation();
817
836
  const { plane, axis, delta, size, index, state } = event;
837
+ const nextSize = this.clampAxisSize(plane, axis, index, size + delta);
818
838
  if (axis === 'col') {
819
- const nextSize = Math.max(sizeColMin, Math.min(sizeColMax, size + delta));
820
839
  this.colSizes = { ...this.colSizes, [plane]: { ...this.colSizes[plane], [index]: nextSize } };
821
840
  this.updateVisInline();
822
841
  this.updateIntrinsicInlineSize();
823
842
  }
824
843
  else {
825
- const nextSize = Math.max(sizeRowMin, Math.min(sizeRowMax, size + delta));
826
844
  this.rowSizes = { ...this.colSizes, [plane]: { ...this.rowSizes[plane], [index]: nextSize } };
827
845
  this.updateVisBlock();
828
846
  this.updateIntrinsicBlockSize();
@@ -837,11 +855,10 @@ let DxGrid = class DxGrid extends LitElement {
837
855
  }
838
856
  }
839
857
  //
840
- // Render and other lifecycle methods
858
+ // Render and other lifecycle methods.
841
859
  //
842
860
  // TODO(thure): This is for rendering presentational objects superimposed onto the canonical grid (e.g. DnD drop line for #8108).
843
861
  renderPresentationLayer(offsetInline, offsetBlock) {
844
- var _a, _b, _c, _d, _e, _f;
845
862
  const visibleCols = this.visColMax - this.visColMin;
846
863
  const visibleRows = this.visRowMax - this.visRowMin;
847
864
  return html `<div
@@ -849,32 +866,29 @@ let DxGrid = class DxGrid extends LitElement {
849
866
  class="dx-grid-layer--presentation"
850
867
  style=${styleMap({
851
868
  gridTemplateColumns: [
852
- ...[...Array((_a = this.frozen.frozenColsStart) !== null && _a !== void 0 ? _a : 0)].map((_, c0) => `${this.colSize(c0, 'frozenColsStart')}px`),
869
+ ...[...Array(this.frozen.frozenColsStart ?? 0)].map((_, c0) => `${this.colSize(c0, 'frozenColsStart')}px`),
853
870
  ...[...Array(visibleCols)].map((_, c0) => c0 === visibleCols - 1
854
871
  ? '1fr'
855
872
  : `${this.colSize(this.visColMin + c0, 'grid') + (c0 === 0 ? offsetInline : 0)}px`),
856
- ...[...Array((_b = this.frozen.frozenColsEnd) !== null && _b !== void 0 ? _b : 0)].map((_, c0) => `${this.colSize(c0, 'frozenColsEnd')}px`),
873
+ ...[...Array(this.frozen.frozenColsEnd ?? 0)].map((_, c0) => `${this.colSize(c0, 'frozenColsEnd')}px`),
857
874
  ].join(' '),
858
875
  gridTemplateRows: [
859
- ...[...Array((_c = this.frozen.frozenRowsStart) !== null && _c !== void 0 ? _c : 0)].map((_, r0) => `${this.rowSize(r0, 'frozenRowsStart')}px`),
876
+ ...[...Array(this.frozen.frozenRowsStart ?? 0)].map((_, r0) => `${this.rowSize(r0, 'frozenRowsStart')}px`),
860
877
  ...[...Array(visibleRows)].map((_, r0) => r0 === visibleRows - 1
861
878
  ? '1fr'
862
879
  : `${this.rowSize(this.visRowMin + r0, 'grid') + (r0 === 0 ? offsetBlock : 0)}px`),
863
- ...[...Array((_d = this.frozen.frozenRowsEnd) !== null && _d !== void 0 ? _d : 0)].map((_, r0) => `${this.rowSize(r0, 'frozenRowsEnd')}px`),
880
+ ...[...Array(this.frozen.frozenRowsEnd ?? 0)].map((_, r0) => `${this.rowSize(r0, 'frozenRowsEnd')}px`),
864
881
  ].join(' '),
865
882
  })}
866
883
  >
867
884
  ${
868
885
  /* TODO(thure): These are debug cells, remove when rendering actual overlay content. */ [
869
- ...Array(((_e = this.frozen.frozenRowsStart) !== null && _e !== void 0 ? _e : 0) + visibleRows + ((_f = this.frozen.frozenRowsEnd) !== null && _f !== void 0 ? _f : 0)),
870
- ].map((_, r0) => {
871
- var _a, _b;
872
- 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
886
+ ...Array((this.frozen.frozenRowsStart ?? 0) + visibleRows + (this.frozen.frozenRowsEnd ?? 0)),
887
+ ].map((_, r0) => [...Array((this.frozen.frozenColsStart ?? 0) + visibleCols + (this.frozen.frozenColsEnd ?? 0))].map((_, c0) => html `<div
873
888
  role="none"
874
889
  class="dx-grid-layer--presentation__cell"
875
890
  style="grid-column:${c0 + 1};grid-row:${r0 + 1}"
876
- ></div>`);
877
- })}
891
+ ></div>`))}
878
892
  </div>`;
879
893
  }
880
894
  renderFixed(plane, selection) {
@@ -882,7 +896,7 @@ let DxGrid = class DxGrid extends LitElement {
882
896
  const rowPlane = resolveRowPlane(plane);
883
897
  const cols = this.frozen[colPlane];
884
898
  const rows = this.frozen[rowPlane];
885
- return (cols !== null && cols !== void 0 ? cols : 0) > 0 && (rows !== null && rows !== void 0 ? rows : 0) > 0
899
+ return (cols ?? 0) > 0 && (rows ?? 0) > 0
886
900
  ? html `<div
887
901
  role="none"
888
902
  tabindex="0"
@@ -906,7 +920,7 @@ let DxGrid = class DxGrid extends LitElement {
906
920
  renderFrozenRows(plane, visibleCols, offsetInline, selection) {
907
921
  const rowPlane = resolveRowPlane(plane);
908
922
  const rows = this.frozen[rowPlane];
909
- return (rows !== null && rows !== void 0 ? rows : 0) > 0
923
+ return (rows ?? 0) > 0 && this.limitColumns > 0
910
924
  ? html `<div
911
925
  role="none"
912
926
  class="dx-grid__plane--frozen-row"
@@ -934,7 +948,7 @@ let DxGrid = class DxGrid extends LitElement {
934
948
  renderFrozenColumns(plane, visibleRows, offsetBlock, selection) {
935
949
  const colPlane = resolveColPlane(plane);
936
950
  const cols = this.frozen[colPlane];
937
- return (cols !== null && cols !== void 0 ? cols : 0) > 0
951
+ return (cols ?? 0) > 0 && this.limitRows > 0
938
952
  ? html `<div
939
953
  role="none"
940
954
  class="dx-grid__plane--frozen-col"
@@ -959,47 +973,84 @@ let DxGrid = class DxGrid extends LitElement {
959
973
  </div>`
960
974
  : null;
961
975
  }
976
+ renderMainGrid(visibleCols, visibleRows, offsetInline, offsetBlock, selection) {
977
+ return this.limitRows > 0 && this.limitColumns > 0
978
+ ? html `<div
979
+ role="grid"
980
+ class="dx-grid__plane--grid"
981
+ tabindex="0"
982
+ data-dx-grid-plane="grid"
983
+ data-dx-grid-plane-row="1"
984
+ data-dx-grid-plane-col="1"
985
+ >
986
+ <div
987
+ role="none"
988
+ class="dx-grid__plane--grid__content"
989
+ style="transform:translate3d(${offsetInline}px,${offsetBlock}px,0);grid-template-columns:${this
990
+ .templateGridColumns};grid-template-rows:${this.templateGridRows};"
991
+ >
992
+ ${[...Array(visibleRows)].map((_, r0) => {
993
+ return [...Array(visibleCols)].map((_, c0) => {
994
+ const c = c0 + this.visColMin;
995
+ const r = r0 + this.visRowMin;
996
+ return this.renderCell(c, r, 'grid', cellSelected(c, r, 'grid', selection), c0, r0);
997
+ });
998
+ })}
999
+ </div>
1000
+ </div>`
1001
+ : null;
1002
+ }
962
1003
  cellReadonly(col, row, plane) {
963
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
964
1004
  const colPlane = resolveColPlane(plane);
965
1005
  const rowPlane = resolveRowPlane(plane);
966
1006
  // Check cell-specific setting first.
967
- const cellReadonly = (_a = this.cell(col, row, plane)) === null || _a === void 0 ? void 0 : _a.readonly;
1007
+ const cellReadonly = this.cell(col, row, plane)?.readonly;
968
1008
  if (cellReadonly !== undefined) {
969
1009
  return isReadonly(cellReadonly);
970
1010
  }
971
1011
  // Check column/row defaults.
972
- 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;
973
- 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;
1012
+ const colReadOnly = this.columns?.[colPlane]?.[col]?.readonly ?? this.columnDefault?.[colPlane]?.readonly;
1013
+ const rowReadOnly = this.rows?.[rowPlane]?.[row]?.readonly ?? this.rowDefault?.[rowPlane]?.readonly;
974
1014
  return isReadonly(colReadOnly) || isReadonly(rowReadOnly);
975
1015
  }
1016
+ cellFocusUnfurl(col, row, plane) {
1017
+ const colPlane = resolveColPlane(plane);
1018
+ const rowPlane = resolveRowPlane(plane);
1019
+ // Check cell-specific setting first.
1020
+ const cellUnfurl = this.cell(col, row, plane)?.focusUnfurl;
1021
+ if (cellUnfurl !== undefined) {
1022
+ return cellUnfurl;
1023
+ }
1024
+ // Check column/row defaults.
1025
+ const colUnfurl = this.columns?.[colPlane]?.[col]?.focusUnfurl ?? this.columnDefault?.[colPlane]?.focusUnfurl;
1026
+ const rowUnfurl = this.rows?.[rowPlane]?.[row]?.focusUnfurl ?? this.rowDefault?.[rowPlane]?.focusUnfurl;
1027
+ return colUnfurl ?? rowUnfurl ?? focusUnfurlDefault;
1028
+ }
976
1029
  /**
977
1030
  * Determines if the cell's text content should be selectable based on its readonly value.
978
1031
  * @returns true if the cells text content is selectable, false otherwise.
979
1032
  */
980
1033
  cellTextSelectable(col, row, plane) {
981
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
982
1034
  const colPlane = resolveColPlane(plane);
983
1035
  const rowPlane = resolveRowPlane(plane);
984
1036
  // Check cell-specific setting first.
985
- const cellReadonly = (_a = this.cell(col, row, plane)) === null || _a === void 0 ? void 0 : _a.readonly;
1037
+ const cellReadonly = this.cell(col, row, plane)?.readonly;
986
1038
  if (cellReadonly !== undefined) {
987
1039
  return cellReadonly === 'text-select';
988
1040
  }
989
1041
  // Check column/row defaults.
990
- 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;
991
- 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;
1042
+ const colReadonly = this.columns?.[colPlane]?.[col]?.readonly ?? this.columnDefault?.[colPlane]?.readonly;
1043
+ const rowReadonly = this.rows?.[rowPlane]?.[row]?.readonly ?? this.rowDefault?.[rowPlane]?.readonly;
992
1044
  return colReadonly === 'text-select' || rowReadonly === 'text-select';
993
1045
  }
994
1046
  getOverflowingCellModifiedDeltas(event) {
995
- var _a;
996
1047
  if (!event.target) {
997
1048
  return event;
998
1049
  }
999
1050
  const element = event.target;
1000
1051
  const activeCell = element.closest('[data-dx-active]');
1001
1052
  const contentEl = element.closest('.dx-grid__cell__content');
1002
- if (!activeCell || !contentEl || !((_a = document.activeElement) === null || _a === void 0 ? void 0 : _a.contains(element))) {
1053
+ if (!activeCell || !contentEl || !document.activeElement?.contains(element)) {
1003
1054
  return event;
1004
1055
  }
1005
1056
  // Commented-out code will let the event delta through unmodified if the cell can scroll but is scrolled to the end
@@ -1019,32 +1070,32 @@ let DxGrid = class DxGrid extends LitElement {
1019
1070
  return { deltaX, deltaY };
1020
1071
  }
1021
1072
  renderCell(col, row, plane, selected, visCol = col, visRow = row) {
1022
- var _a, _b;
1023
1073
  const cell = this.cell(col, row, plane);
1024
1074
  const active = this.cellActive(col, row, plane);
1025
1075
  const readonly = this.cellReadonly(col, row, plane);
1076
+ const focusUnfurl = this.cellFocusUnfurl(col, row, plane);
1026
1077
  const textSelectable = this.cellTextSelectable(col, row, plane);
1027
- const resizeIndex = (cell === null || cell === void 0 ? void 0 : cell.resizeHandle) ? (cell.resizeHandle === 'col' ? col : row) : undefined;
1028
- const resizePlane = (cell === null || cell === void 0 ? void 0 : cell.resizeHandle) ? resolveFrozenPlane(cell.resizeHandle, plane) : undefined;
1029
- const accessory = (cell === null || cell === void 0 ? void 0 : cell.accessoryHtml) ? staticHtml `${unsafeStatic(cell.accessoryHtml)}` : null;
1078
+ const resizeIndex = cell?.resizeHandle ? (cell.resizeHandle === 'col' ? col : row) : undefined;
1079
+ const resizePlane = cell?.resizeHandle ? resolveFrozenPlane(cell.resizeHandle, plane) : undefined;
1080
+ const accessory = cell?.accessoryHtml ? staticHtml `${unsafeStatic(cell.accessoryHtml)}` : null;
1030
1081
  return html `<div
1031
1082
  role="gridcell"
1032
1083
  tabindex="0"
1033
1084
  aria-selected=${selected ? 'true' : nothing}
1034
1085
  aria-readonly=${readonly ? 'true' : nothing}
1035
- class=${(_a = cell === null || cell === void 0 ? void 0 : cell.className) !== null && _a !== void 0 ? _a : nothing}
1036
- data-refs=${(_b = cell === null || cell === void 0 ? void 0 : cell.dataRefs) !== null && _b !== void 0 ? _b : nothing}
1086
+ class=${cell?.className ?? nothing}
1087
+ data-refs=${cell?.dataRefs ?? nothing}
1088
+ data-focus-unfurl=${focusUnfurl ? nothing : 'false'}
1037
1089
  ?data-dx-active=${active}
1038
1090
  data-text-selectable=${textSelectable ? 'true' : 'false'}
1039
1091
  data-dx-grid-action="cell"
1040
1092
  aria-colindex=${col}
1041
1093
  aria-rowindex=${row}
1094
+ data-testid=${`${plane}.${col}.${row}`}
1042
1095
  style="grid-column:${visCol + 1};grid-row:${visRow + 1}"
1043
1096
  >
1044
- <div role="none" class="dx-grid__cell__content">
1045
- ${this.mode !== 'browse' && active ? null : cell === null || cell === void 0 ? void 0 : cell.value}${this.mode !== 'browse' && active ? null : accessory}
1046
- </div>
1047
- ${(cell === null || cell === void 0 ? void 0 : cell.resizeHandle) &&
1097
+ <div role="none" class="dx-grid__cell__content">${cell?.value}${accessory}</div>
1098
+ ${cell?.resizeHandle &&
1048
1099
  this.mode === 'browse' &&
1049
1100
  this.axisResizeable(resizePlane, cell.resizeHandle, resizeIndex)
1050
1101
  ? html `<dx-grid-axis-resize-handle
@@ -1074,9 +1125,24 @@ let DxGrid = class DxGrid extends LitElement {
1074
1125
  <div
1075
1126
  role="none"
1076
1127
  class="dx-grid"
1128
+ data-arrow-keys="all"
1077
1129
  style=${styleMap({
1078
- 'grid-template-columns': `${this.templatefrozenColsStart ? 'min-content ' : ''}minmax(0, ${Number.isFinite(this.limitColumns) ? `${Math.max(0, this.intrinsicInlineSize)}px` : '1fr'})${this.templatefrozenColsEnd ? ' min-content' : ''}`,
1079
- 'grid-template-rows': `${this.templatefrozenRowsStart ? 'min-content ' : ''}minmax(0, ${Number.isFinite(this.limitRows) ? `${Math.max(0, this.intrinsicBlockSize)}px` : '1fr'})${this.templatefrozenRowsEnd ? ' min-content' : ''}`,
1130
+ 'grid-template-columns': [
1131
+ this.templatefrozenColsStart ? 'min-content' : false,
1132
+ this.limitColumns > 0 &&
1133
+ `minmax(0, ${Number.isFinite(this.limitColumns) ? `${Math.max(0, this.intrinsicInlineSize)}px` : '1fr'})`,
1134
+ this.templatefrozenColsEnd ? 'min-content' : false,
1135
+ ]
1136
+ .filter(Boolean)
1137
+ .join(' '),
1138
+ 'grid-template-rows': [
1139
+ this.templatefrozenRowsStart ? 'min-content' : false,
1140
+ this.limitRows > 0 &&
1141
+ `minmax(0, ${Number.isFinite(this.limitRows) ? `${Math.max(0, this.intrinsicBlockSize)}px` : '1fr'})`,
1142
+ this.templatefrozenRowsEnd ? ' min-content' : false,
1143
+ ]
1144
+ .filter(Boolean)
1145
+ .join(' '),
1080
1146
  '--dx-grid-content-inline-size': Number.isFinite(this.limitColumns)
1081
1147
  ? `${Math.max(0, this.totalIntrinsicInlineSize)}px`
1082
1148
  : 'max-content',
@@ -1086,74 +1152,39 @@ let DxGrid = class DxGrid extends LitElement {
1086
1152
  })}
1087
1153
  data-grid=${this.gridId}
1088
1154
  data-grid-mode=${this.mode}
1155
+ data-grid-focus-indicator-variant=${this.focusIndicatorVariant}
1089
1156
  ?data-grid-select=${selection.visible}
1090
1157
  ${ref(this.gridRef)}
1091
1158
  >
1092
1159
  ${this.renderFixed('fixedStartStart', selection)}${this.renderFrozenRows('frozenRowsStart', visibleCols, offsetInline, selection)}${this.renderFixed('fixedStartEnd', selection)}${this.renderFrozenColumns('frozenColsStart', visibleRows, offsetBlock, selection)}
1093
- <div
1094
- role="grid"
1095
- class="dx-grid__plane--grid"
1096
- tabindex="0"
1097
- data-dx-grid-plane="grid"
1098
- data-dx-grid-plane-row="1"
1099
- data-dx-grid-plane-col="1"
1100
- ${ref(this.viewportRef)}
1101
- >
1102
- <div
1103
- role="none"
1104
- class="dx-grid__plane--grid__content"
1105
- style="transform:translate3d(${offsetInline}px,${offsetBlock}px,0);grid-template-columns:${this
1106
- .templateGridColumns};grid-template-rows:${this.templateGridRows};"
1107
- >
1108
- ${[...Array(visibleRows)].map((_, r0) => {
1109
- return [...Array(visibleCols)].map((_, c0) => {
1110
- const c = c0 + this.visColMin;
1111
- const r = r0 + this.visRowMin;
1112
- return this.renderCell(c, r, 'grid', cellSelected(c, r, 'grid', selection), c0, r0);
1113
- });
1114
- })}
1115
- </div>
1116
- </div>
1160
+ ${this.renderMainGrid(visibleCols, visibleRows, offsetInline, offsetBlock, selection)}
1117
1161
  ${this.renderFrozenColumns('frozenColsEnd', visibleRows, offsetBlock, selection)}${this.renderFixed('fixedEndStart', selection)}${this.renderFrozenRows('frozenRowsEnd', visibleCols, offsetInline, selection)}${this.renderFixed('fixedEndEnd', selection)}
1118
1162
  </div>`;
1119
1163
  }
1120
1164
  updateIntrinsicInlineSize() {
1121
1165
  this.intrinsicInlineSize = Number.isFinite(this.limitColumns)
1122
1166
  ? [...Array(this.limitColumns)].reduce((acc, _, c0) => acc + this.colSize(c0, 'grid'), 0) +
1123
- gap * (this.limitColumns - 1)
1167
+ gap * Math.max(0, this.limitColumns - 1)
1124
1168
  : Infinity;
1125
1169
  this.totalIntrinsicInlineSize =
1126
- this.intrinsicInlineSize +
1127
- (Number.isFinite(this.frozen.frozenColsStart)
1128
- ? [...Array(this.frozen.frozenColsStart)].reduce((acc, _, c0) => acc + gap + this.colSize(c0, 'frozenColsStart'), 0)
1129
- : 0) +
1130
- (Number.isFinite(this.frozen.frozenColsEnd)
1131
- ? [...Array(this.frozen.frozenColsEnd)].reduce((acc, _, c0) => acc + gap + this.colSize(c0, 'frozenColsEnd'), 0)
1132
- : 0);
1170
+ this.limitColumns > 0 ? this.intrinsicInlineSize + this.frozenColsSize : this.frozenColsSize - gap;
1133
1171
  }
1134
1172
  updateIntrinsicBlockSize() {
1135
1173
  this.intrinsicBlockSize = Number.isFinite(this.limitRows)
1136
1174
  ? [...Array(this.limitRows)].reduce((acc, _, r0) => acc + this.rowSize(r0, 'grid'), 0) +
1137
- gap * (this.limitRows - 1)
1175
+ gap * Math.max(0, this.limitRows - 1)
1138
1176
  : Infinity;
1139
1177
  this.totalIntrinsicBlockSize =
1140
- this.intrinsicBlockSize +
1141
- (Number.isFinite(this.frozen.frozenRowsStart)
1142
- ? [...Array(this.frozen.frozenRowsStart)].reduce((acc, _, r0) => acc + gap + this.rowSize(r0, 'frozenRowsStart'), 0)
1143
- : 0) +
1144
- (Number.isFinite(this.frozen.frozenRowsEnd)
1145
- ? [...Array(this.frozen.frozenRowsEnd)].reduce((acc, _, r0) => acc + gap + this.rowSize(r0, 'frozenRowsEnd'), 0)
1146
- : 0);
1178
+ this.limitRows > 0 ? this.intrinsicBlockSize + this.frozenRowsSize : this.frozenRowsSize - gap;
1147
1179
  }
1148
1180
  updateIntrinsicSizes() {
1149
1181
  this.updateIntrinsicInlineSize();
1150
1182
  this.updateIntrinsicBlockSize();
1151
1183
  }
1152
1184
  computeColSizes() {
1153
- var _a;
1154
- this.colSizes = Object.entries((_a = this.columns) !== null && _a !== void 0 ? _a : {}).reduce((acc, [plane, planeColMeta]) => {
1185
+ this.colSizes = Object.entries(this.columns ?? {}).reduce((acc, [plane, planeColMeta]) => {
1155
1186
  acc[plane] = Object.entries(planeColMeta).reduce((planeAcc, [col, colMeta]) => {
1156
- if (colMeta === null || colMeta === void 0 ? void 0 : colMeta.size) {
1187
+ if (colMeta?.size) {
1157
1188
  planeAcc[col] = colMeta.size;
1158
1189
  }
1159
1190
  return planeAcc;
@@ -1162,10 +1193,9 @@ let DxGrid = class DxGrid extends LitElement {
1162
1193
  }, { grid: {} });
1163
1194
  }
1164
1195
  computeRowSizes() {
1165
- var _a;
1166
- this.rowSizes = Object.entries((_a = this.rows) !== null && _a !== void 0 ? _a : {}).reduce((acc, [plane, planeRowMeta]) => {
1196
+ this.rowSizes = Object.entries(this.rows ?? {}).reduce((acc, [plane, planeRowMeta]) => {
1167
1197
  acc[plane] = Object.entries(planeRowMeta).reduce((planeAcc, [row, rowMeta]) => {
1168
- if (rowMeta === null || rowMeta === void 0 ? void 0 : rowMeta.size) {
1198
+ if (rowMeta?.size) {
1169
1199
  planeAcc[row] = rowMeta.size;
1170
1200
  }
1171
1201
  return planeAcc;
@@ -1177,7 +1207,7 @@ let DxGrid = class DxGrid extends LitElement {
1177
1207
  if (this.getCells) {
1178
1208
  this.updateCells(true);
1179
1209
  }
1180
- this.observer.observe(this.viewportRef.value);
1210
+ this.observer.observe(this.gridRef.value);
1181
1211
  this.computeColSizes();
1182
1212
  this.computeRowSizes();
1183
1213
  this.updateIntrinsicSizes();
@@ -1228,20 +1258,20 @@ let DxGrid = class DxGrid extends LitElement {
1228
1258
  this.refocus();
1229
1259
  }
1230
1260
  }
1231
- updateIfWithinBounds({ col, row }) {
1261
+ updateIfWithinBounds({ col, row }, includeFixed) {
1232
1262
  if (col >= this.visColMin && col <= this.visColMax && row >= this.visRowMin && row <= this.visRowMax) {
1263
+ this.updateCells(includeFixed);
1233
1264
  this.requestUpdate();
1234
1265
  return true;
1235
1266
  }
1236
1267
  return false;
1237
1268
  }
1238
1269
  disconnectedCallback() {
1239
- var _a;
1240
1270
  super.disconnectedCallback();
1241
- if (this.viewportRef.value) {
1242
- this.observer.unobserve(this.viewportRef.value);
1271
+ if (this.gridRef.value) {
1272
+ this.observer.unobserve(this.gridRef.value);
1243
1273
  }
1244
- (_a = document.defaultView) === null || _a === void 0 ? void 0 : _a.removeEventListener('wheel', this.handleTopLevelWheel);
1274
+ document.defaultView?.removeEventListener('wheel', this.handleTopLevelWheel);
1245
1275
  }
1246
1276
  createRenderRoot() {
1247
1277
  return this;
@@ -1283,6 +1313,9 @@ __decorate([
1283
1313
  __decorate([
1284
1314
  property({ type: String })
1285
1315
  ], DxGrid.prototype, "activeRefs", void 0);
1316
+ __decorate([
1317
+ property({ type: String })
1318
+ ], DxGrid.prototype, "focusIndicatorVariant", void 0);
1286
1319
  __decorate([
1287
1320
  state()
1288
1321
  ], DxGrid.prototype, "cells", void 0);
@@ -1346,6 +1379,12 @@ __decorate([
1346
1379
  __decorate([
1347
1380
  state()
1348
1381
  ], DxGrid.prototype, "templatefrozenRowsEnd", void 0);
1382
+ __decorate([
1383
+ state()
1384
+ ], DxGrid.prototype, "frozenColsSize", void 0);
1385
+ __decorate([
1386
+ state()
1387
+ ], DxGrid.prototype, "frozenRowsSize", void 0);
1349
1388
  __decorate([
1350
1389
  state()
1351
1390
  ], DxGrid.prototype, "pointer", void 0);
@@ -1386,6 +1425,6 @@ DxGrid = __decorate([
1386
1425
  customElement('dx-grid')
1387
1426
  ], DxGrid);
1388
1427
  export { DxGrid };
1389
- export { rowToA1Notation, colToA1Notation, closestAction, closestCell, parseCellIndex, toPlaneCellIndex, cellQuery, } from './util';
1428
+ export { rowToA1Notation, colToA1Notation, closestAction, closestCell, parseCellIndex, toPlaneCellIndex, cellQuery, accessoryHandlesPointerdownAttrs, } from './util';
1390
1429
  export const commentedClassName = 'dx-grid__cell--commented';
1391
1430
  //# sourceMappingURL=dx-grid.js.map