@dxos/lit-grid 0.8.4-main.67995b8 → 0.8.4-main.69d29f4

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