@dxos/lit-grid 0.8.4-main.5acf9ea → 0.8.4-main.5ea62a8

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 +9 -5
  12. package/dist/src/dx-grid.d.ts.map +1 -1
  13. package/dist/src/dx-grid.js +173 -144
  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 +7 -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 +3 -3
  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 +14 -1
  34. package/src/dx-grid.ts +164 -90
  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 +7 -0
  38. 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 = {
@@ -82,6 +81,11 @@ let DxGrid = class DxGrid extends LitElement {
82
81
  this.templatefrozenRowsStart = '';
83
82
  this.templatefrozenRowsEnd = '';
84
83
  //
84
+ // `frozen…Size` is used to measure space available for the non-fixed planes
85
+ //
86
+ this.frozenColsSize = 0;
87
+ this.frozenRowsSize = 0;
88
+ //
85
89
  // Focus, selection, and resize states
86
90
  //
87
91
  this.pointer = null;
@@ -132,8 +136,7 @@ let DxGrid = class DxGrid extends LitElement {
132
136
  }
133
137
  };
134
138
  this.handlePointerUp = (event) => {
135
- var _a;
136
- if (((_a = this.pointer) === null || _a === void 0 ? void 0 : _a.state) === 'selecting') {
139
+ if (this.pointer?.state === 'selecting') {
137
140
  const cell = closestCell(event.target);
138
141
  if (cell) {
139
142
  this.setSelectionEnd(cell);
@@ -143,8 +146,7 @@ let DxGrid = class DxGrid extends LitElement {
143
146
  this.pointer = null;
144
147
  };
145
148
  this.handlePointerMove = (event) => {
146
- var _a, _b;
147
- if (((_a = this.pointer) === null || _a === void 0 ? void 0 : _a.state) === 'panning') {
149
+ if (this.pointer?.state === 'panning') {
148
150
  const panEvent = event;
149
151
  panEvent.deltaX = this.pointer.pageX - event.pageX;
150
152
  panEvent.deltaY = this.pointer.pageY - event.pageY;
@@ -155,7 +157,7 @@ let DxGrid = class DxGrid extends LitElement {
155
157
  else if (shouldSelect(this.pointer, event)) {
156
158
  this.pointer = { state: 'selecting' };
157
159
  }
158
- else if (((_b = this.pointer) === null || _b === void 0 ? void 0 : _b.state) === 'selecting') {
160
+ else if (this.pointer?.state === 'selecting') {
159
161
  const cell = closestCell(event.target);
160
162
  if (cell &&
161
163
  cell.plane === this.selectionStart.plane &&
@@ -168,22 +170,20 @@ let DxGrid = class DxGrid extends LitElement {
168
170
  // Resize & reposition handlers, observer, ref
169
171
  //
170
172
  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 : {
173
+ const { inlineSize, blockSize } = entries?.[0]?.contentBoxSize?.[0] ?? {
173
174
  inlineSize: 0,
174
175
  blockSize: 0,
175
176
  };
176
- if (Math.abs(inlineSize - this.sizeInline) > resizeTolerance ||
177
- Math.abs(blockSize - this.sizeBlock) > resizeTolerance) {
177
+ if (Math.abs(inlineSize - this.frozenColsSize - this.sizeInline) > resizeTolerance ||
178
+ Math.abs(blockSize - this.frozenRowsSize - this.sizeBlock) > resizeTolerance) {
178
179
  // console.info('[updating bounds]', 'resize', [inlineSize - this.sizeInline, blockSize - this.sizeBlock]);
179
- this.sizeInline = inlineSize;
180
- this.sizeBlock = blockSize;
180
+ this.sizeInline = inlineSize - this.frozenColsSize;
181
+ this.sizeBlock = blockSize - this.frozenRowsSize;
181
182
  this.updateVis();
182
183
  queueMicrotask(() => this.updatePos());
183
184
  }
184
185
  });
185
186
  this.gridRef = createRef();
186
- this.viewportRef = createRef();
187
187
  this.maybeUpdateVisInline = () => {
188
188
  if (this.posInline < this.binInlineMin || this.posInline >= this.binInlineMax) {
189
189
  this.updateVisInline();
@@ -195,8 +195,7 @@ let DxGrid = class DxGrid extends LitElement {
195
195
  }
196
196
  };
197
197
  this.handleTopLevelWheel = (event) => {
198
- var _a;
199
- if (event.gridId === ((_a = this.gridId) !== null && _a !== void 0 ? _a : 'never')) {
198
+ if (event.gridId === (this.gridId ?? 'never')) {
200
199
  if (this.overscroll === 'trap' ||
201
200
  (this.overscroll === 'inline' && event.overscrollInline === 0) ||
202
201
  (this.overscroll === 'block' && event.overscrollBlock === 0)) {
@@ -229,7 +228,7 @@ let DxGrid = class DxGrid extends LitElement {
229
228
  }
230
229
  };
231
230
  // Wheel, top-level and element-level
232
- (_a = document.defaultView) === null || _a === void 0 ? void 0 : _a.addEventListener('wheel', this.handleTopLevelWheel, { passive: false });
231
+ document.defaultView?.addEventListener('wheel', this.handleTopLevelWheel, { passive: false });
233
232
  this.addEventListener('wheel', this.handleWheel);
234
233
  // Custom event(s)
235
234
  this.addEventListener('dx-axis-resize-internal', this.handleAxisResizeInternal);
@@ -313,18 +312,16 @@ let DxGrid = class DxGrid extends LitElement {
313
312
  }
314
313
  }
315
314
  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}"]`);
315
+ const planeElement = this.gridRef.value?.querySelector(`[data-dx-grid-plane="${plane}"]`);
318
316
  if (planeElement) {
319
317
  const axis = event.key === 'ArrowUp' || event.key === 'ArrowDown' ? 'col' : 'row';
320
318
  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 });
319
+ const planeAxis = planeElement?.getAttribute(`data-dx-grid-plane-${axis}`);
320
+ const adjacentPlanes = Array.from(this.gridRef.value?.querySelectorAll(`[data-dx-grid-plane-${axis}="${planeAxis}"]`) ?? [planeElement]).filter((el) => !!el);
321
+ adjacentPlanes[(adjacentPlanes.length + adjacentPlanes.indexOf(planeElement) + delta) % adjacentPlanes.length]?.focus({ preventScroll: true });
324
322
  }
325
323
  }
326
324
  moveFocusIntoPlane(plane) {
327
- var _a;
328
325
  if (this.focusedCell.plane !== plane) {
329
326
  const colPlane = resolveColPlane(plane);
330
327
  const rowPlane = resolveRowPlane(plane);
@@ -334,11 +331,10 @@ let DxGrid = class DxGrid extends LitElement {
334
331
  row: rowPlane === 'grid' ? this.visRowMin : 0,
335
332
  };
336
333
  }
337
- (_a = this.focusedCellElement()) === null || _a === void 0 ? void 0 : _a.focus({ preventScroll: true });
334
+ this.focusedCellElement()?.focus({ preventScroll: true });
338
335
  }
339
336
  moveFocusToPlane() {
340
- var _a;
341
- (_a = this.focusedPlaneElement()) === null || _a === void 0 ? void 0 : _a.focus({ preventScroll: true });
337
+ this.focusedPlaneElement()?.focus({ preventScroll: true });
342
338
  }
343
339
  handleKeydown(event) {
344
340
  if (this.focusActive && this.mode === 'browse') {
@@ -409,19 +405,16 @@ let DxGrid = class DxGrid extends LitElement {
409
405
  // Accessors
410
406
  //
411
407
  colSize(c, plane) {
412
- var _a, _b, _c, _d, _e;
413
408
  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;
409
+ return this.colSizes?.[resolvedPlane]?.[c] ?? this.columnDefault[resolvedPlane]?.size ?? defaultColSize;
415
410
  }
416
411
  rowSize(r, plane) {
417
- var _a, _b, _c, _d, _e;
418
412
  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;
413
+ return this.rowSizes?.[resolvedPlane]?.[r] ?? this.rowDefault[resolvedPlane]?.size ?? defaultRowSize;
420
414
  }
421
415
  cell(c, r, plane) {
422
- var _a, _b, _c, _d, _e;
423
416
  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];
417
+ return this.cells?.[plane]?.[index] ?? this.initialCells?.[plane]?.[index];
425
418
  }
426
419
  cellActive(c, r, plane) {
427
420
  return this.focusedCell.plane === plane && this.focusedCell.col === c && this.focusedCell.row === r;
@@ -482,11 +475,11 @@ let DxGrid = class DxGrid extends LitElement {
482
475
  return this.intrinsicBlockSize - this.sizeBlock;
483
476
  }
484
477
  updatePosInline(inline, maxInline = this.maxPosInline()) {
485
- this.posInline = Math.max(0, Math.min(maxInline, inline !== null && inline !== void 0 ? inline : this.posInline));
478
+ this.posInline = Math.max(0, Math.min(maxInline, inline ?? this.posInline));
486
479
  this.maybeUpdateVisInline();
487
480
  }
488
481
  updatePosBlock(block, maxBlock = this.maxPosBlock()) {
489
- this.posBlock = Math.max(0, Math.min(maxBlock, block !== null && block !== void 0 ? block : this.posBlock));
482
+ this.posBlock = Math.max(0, Math.min(maxBlock, block ?? this.posBlock));
490
483
  this.maybeUpdateVisBlock();
491
484
  }
492
485
  updatePos(inline, block, maxInline, maxBlock) {
@@ -494,7 +487,6 @@ let DxGrid = class DxGrid extends LitElement {
494
487
  this.updatePosBlock(block, maxBlock);
495
488
  }
496
489
  updateVisInline() {
497
- var _a, _b;
498
490
  // todo: avoid starting from zero
499
491
  let axisCursor = 0;
500
492
  let pxCursor = this.colSize(axisCursor, 'grid');
@@ -524,15 +516,19 @@ let DxGrid = class DxGrid extends LitElement {
524
516
  this.templateGridColumns = [...Array(this.visColMax - this.visColMin)]
525
517
  .map((_, c0) => `${this.colSize(this.visColMin + c0, 'grid')}px`)
526
518
  .join(' ');
527
- this.templatefrozenColsStart = [...Array((_a = this.frozen.frozenColsStart) !== null && _a !== void 0 ? _a : 0)]
519
+ this.templatefrozenColsStart = [...Array(this.frozen.frozenColsStart ?? 0)]
528
520
  .map((_, c0) => `${this.colSize(c0, 'frozenColsStart')}px`)
529
521
  .join(' ');
530
- this.templatefrozenColsEnd = [...Array((_b = this.frozen.frozenColsEnd) !== null && _b !== void 0 ? _b : 0)]
522
+ this.templatefrozenColsEnd = [...Array(this.frozen.frozenColsEnd ?? 0)]
531
523
  .map((_, c0) => `${this.colSize(c0, 'frozenColsEnd')}px`)
532
524
  .join(' ');
525
+ this.frozenColsSize =
526
+ [...Array(this.frozen.frozenColsStart ?? 0)].reduce((sum, _, c0) => sum + this.colSize(c0, 'frozenColsStart'), 0) +
527
+ gap * Math.max(0, this.frozen.frozenColsStart ?? 0 - 1) +
528
+ [...Array(this.frozen.frozenColsEnd ?? 0)].reduce((sum, _, c0) => sum + this.colSize(c0, 'frozenColsEnd'), 0) +
529
+ gap * Math.max(0, this.frozen.frozenColsEnd ?? 0 - 1);
533
530
  }
534
531
  updateVisBlock() {
535
- var _a, _b;
536
532
  // todo: avoid starting from zero
537
533
  let axisCursor = 0;
538
534
  let pxCursor = this.rowSize(axisCursor, 'grid');
@@ -562,19 +558,23 @@ let DxGrid = class DxGrid extends LitElement {
562
558
  this.templateGridRows = [...Array(this.visRowMax - this.visRowMin)]
563
559
  .map((_, r0) => `${this.rowSize(this.visRowMin + r0, 'grid')}px`)
564
560
  .join(' ');
565
- this.templatefrozenRowsStart = [...Array((_a = this.frozen.frozenRowsStart) !== null && _a !== void 0 ? _a : 0)]
561
+ this.templatefrozenRowsStart = [...Array(this.frozen.frozenRowsStart ?? 0)]
566
562
  .map((_, r0) => `${this.rowSize(r0, 'frozenRowsStart')}px`)
567
563
  .join(' ');
568
- this.templatefrozenRowsEnd = [...Array((_b = this.frozen.frozenRowsEnd) !== null && _b !== void 0 ? _b : 0)]
564
+ this.templatefrozenRowsEnd = [...Array(this.frozen.frozenRowsEnd ?? 0)]
569
565
  .map((_, r0) => `${this.rowSize(r0, 'frozenRowsEnd')}px`)
570
566
  .join(' ');
567
+ this.frozenRowsSize =
568
+ [...Array(this.frozen.frozenRowsStart ?? 0)].reduce((sum, _, r0) => sum + this.rowSize(r0, 'frozenRowsStart'), 0) +
569
+ gap * Math.max(0, this.frozen.frozenRowsStart ?? 0 - 1) +
570
+ [...Array(this.frozen.frozenRowsEnd ?? 0)].reduce((sum, _, r0) => sum + this.rowSize(r0, 'frozenRowsEnd'), 0) +
571
+ gap * Math.max(0, this.frozen.frozenRowsEnd ?? 0 - 1);
571
572
  }
572
573
  updateVis() {
573
574
  this.updateVisInline();
574
575
  this.updateVisBlock();
575
576
  }
576
577
  updateCells(includeFixed) {
577
- var _a, _b, _c, _d, _e, _f, _g, _h;
578
578
  this.cells.grid = this.getCells({
579
579
  start: { col: this.visColMin, row: this.visRowMin },
580
580
  end: { col: this.visColMax, row: this.visRowMax },
@@ -593,25 +593,25 @@ let DxGrid = class DxGrid extends LitElement {
593
593
  }, plane);
594
594
  });
595
595
  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) {
596
+ if ((this.frozen.frozenColsStart ?? 0) > 0 && (this.frozen.frozenRowsStart ?? 0) > 0) {
597
597
  this.cells.fixedStartStart = this.getCells({
598
598
  start: { col: 0, row: 0 },
599
599
  end: { col: this.frozen.frozenColsStart, row: this.frozen.frozenRowsStart },
600
600
  }, 'fixedStartStart');
601
601
  }
602
- if (((_c = this.frozen.frozenColsEnd) !== null && _c !== void 0 ? _c : 0) > 0 && ((_d = this.frozen.frozenRowsStart) !== null && _d !== void 0 ? _d : 0) > 0) {
602
+ if ((this.frozen.frozenColsEnd ?? 0) > 0 && (this.frozen.frozenRowsStart ?? 0) > 0) {
603
603
  this.cells.fixedStartEnd = this.getCells({
604
604
  start: { col: 0, row: 0 },
605
605
  end: { col: this.frozen.frozenColsEnd, row: this.frozen.frozenRowsStart },
606
606
  }, 'fixedStartEnd');
607
607
  }
608
- if (((_e = this.frozen.frozenColsStart) !== null && _e !== void 0 ? _e : 0) > 0 && ((_f = this.frozen.frozenRowsEnd) !== null && _f !== void 0 ? _f : 0) > 0) {
608
+ if ((this.frozen.frozenColsStart ?? 0) > 0 && (this.frozen.frozenRowsEnd ?? 0) > 0) {
609
609
  this.cells.fixedEndStart = this.getCells({
610
610
  start: { col: 0, row: 0 },
611
611
  end: { col: this.frozen.frozenColsStart, row: this.frozen.frozenRowsEnd },
612
612
  }, 'fixedEndStart');
613
613
  }
614
- if (((_g = this.frozen.frozenColsEnd) !== null && _g !== void 0 ? _g : 0) > 0 && ((_h = this.frozen.frozenRowsEnd) !== null && _h !== void 0 ? _h : 0) > 0) {
614
+ if ((this.frozen.frozenColsEnd ?? 0) > 0 && (this.frozen.frozenRowsEnd ?? 0) > 0) {
615
615
  this.cells.fixedEndEnd = this.getCells({
616
616
  start: { col: 0, row: 0 },
617
617
  end: { col: this.frozen.frozenColsEnd, row: this.frozen.frozenRowsEnd },
@@ -649,12 +649,10 @@ let DxGrid = class DxGrid extends LitElement {
649
649
  return `[data-dx-grid-plane=${this.focusedCell.plane}]`;
650
650
  }
651
651
  focusedCellElement() {
652
- var _a;
653
- return (_a = this.gridRef.value) === null || _a === void 0 ? void 0 : _a.querySelector(this.focusedCellQuery());
652
+ return this.gridRef.value?.querySelector(this.focusedCellQuery());
654
653
  }
655
654
  focusedPlaneElement() {
656
- var _a;
657
- return (_a = this.gridRef.value) === null || _a === void 0 ? void 0 : _a.querySelector(this.focusedPlaneQuery());
655
+ return this.gridRef.value?.querySelector(this.focusedPlaneQuery());
658
656
  }
659
657
  //
660
658
  // `outOfVis` returns by how many rows/cols the focused cell is outside of the `vis` range for an axis, inset by a
@@ -813,22 +811,37 @@ let DxGrid = class DxGrid extends LitElement {
813
811
  // Resize handlers
814
812
  //
815
813
  axisResizeable(plane, axis, index) {
816
- var _a, _b, _c, _d, _e, _f, _g, _h;
817
814
  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);
815
+ ? !!(this.columns[plane]?.[index]?.resizeable ?? this.columnDefault[plane]?.resizeable)
816
+ : !!(this.rows[plane]?.[index]?.resizeable ?? this.rowDefault[plane]?.resizeable);
817
+ }
818
+ clampAxisSize(plane, axis, index, requestedSize) {
819
+ const minSize = axis === 'col'
820
+ ? (this.columns[plane]?.[index]?.minSize ??
821
+ this.columnDefault[plane]?.minSize ??
822
+ sizeColMin)
823
+ : (this.rows[plane]?.[index]?.minSize ??
824
+ this.rowDefault[plane]?.minSize ??
825
+ sizeRowMin);
826
+ const maxSize = axis === 'col'
827
+ ? (this.columns[plane]?.[index]?.maxSize ??
828
+ this.columnDefault[plane]?.maxSize ??
829
+ sizeColMax)
830
+ : (this.rows[plane]?.[index]?.maxSize ??
831
+ this.rowDefault[plane]?.maxSize ??
832
+ sizeRowMax);
833
+ return Math.max(minSize, Math.min(maxSize, requestedSize));
820
834
  }
821
835
  handleAxisResizeInternal(event) {
822
836
  event.stopPropagation();
823
837
  const { plane, axis, delta, size, index, state } = event;
838
+ const nextSize = this.clampAxisSize(plane, axis, index, size + delta);
824
839
  if (axis === 'col') {
825
- const nextSize = Math.max(sizeColMin, Math.min(sizeColMax, size + delta));
826
840
  this.colSizes = { ...this.colSizes, [plane]: { ...this.colSizes[plane], [index]: nextSize } };
827
841
  this.updateVisInline();
828
842
  this.updateIntrinsicInlineSize();
829
843
  }
830
844
  else {
831
- const nextSize = Math.max(sizeRowMin, Math.min(sizeRowMax, size + delta));
832
845
  this.rowSizes = { ...this.colSizes, [plane]: { ...this.rowSizes[plane], [index]: nextSize } };
833
846
  this.updateVisBlock();
834
847
  this.updateIntrinsicBlockSize();
@@ -847,7 +860,6 @@ let DxGrid = class DxGrid extends LitElement {
847
860
  //
848
861
  // TODO(thure): This is for rendering presentational objects superimposed onto the canonical grid (e.g. DnD drop line for #8108).
849
862
  renderPresentationLayer(offsetInline, offsetBlock) {
850
- var _a, _b, _c, _d, _e, _f;
851
863
  const visibleCols = this.visColMax - this.visColMin;
852
864
  const visibleRows = this.visRowMax - this.visRowMin;
853
865
  return html `<div
@@ -855,32 +867,29 @@ let DxGrid = class DxGrid extends LitElement {
855
867
  class="dx-grid-layer--presentation"
856
868
  style=${styleMap({
857
869
  gridTemplateColumns: [
858
- ...[...Array((_a = this.frozen.frozenColsStart) !== null && _a !== void 0 ? _a : 0)].map((_, c0) => `${this.colSize(c0, 'frozenColsStart')}px`),
870
+ ...[...Array(this.frozen.frozenColsStart ?? 0)].map((_, c0) => `${this.colSize(c0, 'frozenColsStart')}px`),
859
871
  ...[...Array(visibleCols)].map((_, c0) => c0 === visibleCols - 1
860
872
  ? '1fr'
861
873
  : `${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`),
874
+ ...[...Array(this.frozen.frozenColsEnd ?? 0)].map((_, c0) => `${this.colSize(c0, 'frozenColsEnd')}px`),
863
875
  ].join(' '),
864
876
  gridTemplateRows: [
865
- ...[...Array((_c = this.frozen.frozenRowsStart) !== null && _c !== void 0 ? _c : 0)].map((_, r0) => `${this.rowSize(r0, 'frozenRowsStart')}px`),
877
+ ...[...Array(this.frozen.frozenRowsStart ?? 0)].map((_, r0) => `${this.rowSize(r0, 'frozenRowsStart')}px`),
866
878
  ...[...Array(visibleRows)].map((_, r0) => r0 === visibleRows - 1
867
879
  ? '1fr'
868
880
  : `${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`),
881
+ ...[...Array(this.frozen.frozenRowsEnd ?? 0)].map((_, r0) => `${this.rowSize(r0, 'frozenRowsEnd')}px`),
870
882
  ].join(' '),
871
883
  })}
872
884
  >
873
885
  ${
874
886
  /* 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
887
+ ...Array((this.frozen.frozenRowsStart ?? 0) + visibleRows + (this.frozen.frozenRowsEnd ?? 0)),
888
+ ].map((_, r0) => [...Array((this.frozen.frozenColsStart ?? 0) + visibleCols + (this.frozen.frozenColsEnd ?? 0))].map((_, c0) => html `<div
879
889
  role="none"
880
890
  class="dx-grid-layer--presentation__cell"
881
891
  style="grid-column:${c0 + 1};grid-row:${r0 + 1}"
882
- ></div>`);
883
- })}
892
+ ></div>`))}
884
893
  </div>`;
885
894
  }
886
895
  renderFixed(plane, selection) {
@@ -888,7 +897,7 @@ let DxGrid = class DxGrid extends LitElement {
888
897
  const rowPlane = resolveRowPlane(plane);
889
898
  const cols = this.frozen[colPlane];
890
899
  const rows = this.frozen[rowPlane];
891
- return (cols !== null && cols !== void 0 ? cols : 0) > 0 && (rows !== null && rows !== void 0 ? rows : 0) > 0
900
+ return (cols ?? 0) > 0 && (rows ?? 0) > 0
892
901
  ? html `<div
893
902
  role="none"
894
903
  tabindex="0"
@@ -912,7 +921,7 @@ let DxGrid = class DxGrid extends LitElement {
912
921
  renderFrozenRows(plane, visibleCols, offsetInline, selection) {
913
922
  const rowPlane = resolveRowPlane(plane);
914
923
  const rows = this.frozen[rowPlane];
915
- return (rows !== null && rows !== void 0 ? rows : 0) > 0
924
+ return (rows ?? 0) > 0 && this.limitColumns > 0
916
925
  ? html `<div
917
926
  role="none"
918
927
  class="dx-grid__plane--frozen-row"
@@ -940,7 +949,7 @@ let DxGrid = class DxGrid extends LitElement {
940
949
  renderFrozenColumns(plane, visibleRows, offsetBlock, selection) {
941
950
  const colPlane = resolveColPlane(plane);
942
951
  const cols = this.frozen[colPlane];
943
- return (cols !== null && cols !== void 0 ? cols : 0) > 0
952
+ return (cols ?? 0) > 0 && this.limitRows > 0
944
953
  ? html `<div
945
954
  role="none"
946
955
  class="dx-grid__plane--frozen-col"
@@ -965,47 +974,84 @@ let DxGrid = class DxGrid extends LitElement {
965
974
  </div>`
966
975
  : null;
967
976
  }
977
+ renderMainGrid(visibleCols, visibleRows, offsetInline, offsetBlock, selection) {
978
+ return this.limitRows > 0 && this.limitColumns > 0
979
+ ? html `<div
980
+ role="grid"
981
+ class="dx-grid__plane--grid"
982
+ tabindex="0"
983
+ data-dx-grid-plane="grid"
984
+ data-dx-grid-plane-row="1"
985
+ data-dx-grid-plane-col="1"
986
+ >
987
+ <div
988
+ role="none"
989
+ class="dx-grid__plane--grid__content"
990
+ style="transform:translate3d(${offsetInline}px,${offsetBlock}px,0);grid-template-columns:${this
991
+ .templateGridColumns};grid-template-rows:${this.templateGridRows};"
992
+ >
993
+ ${[...Array(visibleRows)].map((_, r0) => {
994
+ return [...Array(visibleCols)].map((_, c0) => {
995
+ const c = c0 + this.visColMin;
996
+ const r = r0 + this.visRowMin;
997
+ return this.renderCell(c, r, 'grid', cellSelected(c, r, 'grid', selection), c0, r0);
998
+ });
999
+ })}
1000
+ </div>
1001
+ </div>`
1002
+ : null;
1003
+ }
968
1004
  cellReadonly(col, row, plane) {
969
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
970
1005
  const colPlane = resolveColPlane(plane);
971
1006
  const rowPlane = resolveRowPlane(plane);
972
1007
  // Check cell-specific setting first.
973
- const cellReadonly = (_a = this.cell(col, row, plane)) === null || _a === void 0 ? void 0 : _a.readonly;
1008
+ const cellReadonly = this.cell(col, row, plane)?.readonly;
974
1009
  if (cellReadonly !== undefined) {
975
1010
  return isReadonly(cellReadonly);
976
1011
  }
977
1012
  // 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;
1013
+ const colReadOnly = this.columns?.[colPlane]?.[col]?.readonly ?? this.columnDefault?.[colPlane]?.readonly;
1014
+ const rowReadOnly = this.rows?.[rowPlane]?.[row]?.readonly ?? this.rowDefault?.[rowPlane]?.readonly;
980
1015
  return isReadonly(colReadOnly) || isReadonly(rowReadOnly);
981
1016
  }
1017
+ cellFocusUnfurl(col, row, plane) {
1018
+ const colPlane = resolveColPlane(plane);
1019
+ const rowPlane = resolveRowPlane(plane);
1020
+ // Check cell-specific setting first.
1021
+ const cellUnfurl = this.cell(col, row, plane)?.focusUnfurl;
1022
+ if (cellUnfurl !== undefined) {
1023
+ return cellUnfurl;
1024
+ }
1025
+ // Check column/row defaults.
1026
+ const colUnfurl = this.columns?.[colPlane]?.[col]?.focusUnfurl ?? this.columnDefault?.[colPlane]?.focusUnfurl;
1027
+ const rowUnfurl = this.rows?.[rowPlane]?.[row]?.focusUnfurl ?? this.rowDefault?.[rowPlane]?.focusUnfurl;
1028
+ return colUnfurl ?? rowUnfurl ?? focusUnfurlDefault;
1029
+ }
982
1030
  /**
983
1031
  * Determines if the cell's text content should be selectable based on its readonly value.
984
1032
  * @returns true if the cells text content is selectable, false otherwise.
985
1033
  */
986
1034
  cellTextSelectable(col, row, plane) {
987
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
988
1035
  const colPlane = resolveColPlane(plane);
989
1036
  const rowPlane = resolveRowPlane(plane);
990
1037
  // Check cell-specific setting first.
991
- const cellReadonly = (_a = this.cell(col, row, plane)) === null || _a === void 0 ? void 0 : _a.readonly;
1038
+ const cellReadonly = this.cell(col, row, plane)?.readonly;
992
1039
  if (cellReadonly !== undefined) {
993
1040
  return cellReadonly === 'text-select';
994
1041
  }
995
1042
  // 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;
1043
+ const colReadonly = this.columns?.[colPlane]?.[col]?.readonly ?? this.columnDefault?.[colPlane]?.readonly;
1044
+ const rowReadonly = this.rows?.[rowPlane]?.[row]?.readonly ?? this.rowDefault?.[rowPlane]?.readonly;
998
1045
  return colReadonly === 'text-select' || rowReadonly === 'text-select';
999
1046
  }
1000
1047
  getOverflowingCellModifiedDeltas(event) {
1001
- var _a;
1002
1048
  if (!event.target) {
1003
1049
  return event;
1004
1050
  }
1005
1051
  const element = event.target;
1006
1052
  const activeCell = element.closest('[data-dx-active]');
1007
1053
  const contentEl = element.closest('.dx-grid__cell__content');
1008
- if (!activeCell || !contentEl || !((_a = document.activeElement) === null || _a === void 0 ? void 0 : _a.contains(element))) {
1054
+ if (!activeCell || !contentEl || !document.activeElement?.contains(element)) {
1009
1055
  return event;
1010
1056
  }
1011
1057
  // Commented-out code will let the event delta through unmodified if the cell can scroll but is scrolled to the end
@@ -1025,21 +1071,22 @@ let DxGrid = class DxGrid extends LitElement {
1025
1071
  return { deltaX, deltaY };
1026
1072
  }
1027
1073
  renderCell(col, row, plane, selected, visCol = col, visRow = row) {
1028
- var _a, _b;
1029
1074
  const cell = this.cell(col, row, plane);
1030
1075
  const active = this.cellActive(col, row, plane);
1031
1076
  const readonly = this.cellReadonly(col, row, plane);
1077
+ const focusUnfurl = this.cellFocusUnfurl(col, row, plane);
1032
1078
  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;
1079
+ const resizeIndex = cell?.resizeHandle ? (cell.resizeHandle === 'col' ? col : row) : undefined;
1080
+ const resizePlane = cell?.resizeHandle ? resolveFrozenPlane(cell.resizeHandle, plane) : undefined;
1081
+ const accessory = cell?.accessoryHtml ? staticHtml `${unsafeStatic(cell.accessoryHtml)}` : null;
1036
1082
  return html `<div
1037
1083
  role="gridcell"
1038
1084
  tabindex="0"
1039
1085
  aria-selected=${selected ? 'true' : nothing}
1040
1086
  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}
1087
+ class=${cell?.className ?? nothing}
1088
+ data-refs=${cell?.dataRefs ?? nothing}
1089
+ data-focus-unfurl=${focusUnfurl ? nothing : 'false'}
1043
1090
  ?data-dx-active=${active}
1044
1091
  data-text-selectable=${textSelectable ? 'true' : 'false'}
1045
1092
  data-dx-grid-action="cell"
@@ -1047,8 +1094,8 @@ let DxGrid = class DxGrid extends LitElement {
1047
1094
  aria-rowindex=${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
@@ -1079,8 +1126,22 @@ let DxGrid = class DxGrid extends LitElement {
1079
1126
  role="none"
1080
1127
  class="dx-grid"
1081
1128
  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' : ''}`,
1129
+ 'grid-template-columns': [
1130
+ this.templatefrozenColsStart ? 'min-content' : false,
1131
+ this.limitColumns > 0 &&
1132
+ `minmax(0, ${Number.isFinite(this.limitColumns) ? `${Math.max(0, this.intrinsicInlineSize)}px` : '1fr'})`,
1133
+ this.templatefrozenColsEnd ? 'min-content' : false,
1134
+ ]
1135
+ .filter(Boolean)
1136
+ .join(' '),
1137
+ 'grid-template-rows': [
1138
+ this.templatefrozenRowsStart ? 'min-content' : false,
1139
+ this.limitRows > 0 &&
1140
+ `minmax(0, ${Number.isFinite(this.limitRows) ? `${Math.max(0, this.intrinsicBlockSize)}px` : '1fr'})`,
1141
+ this.templatefrozenRowsEnd ? ' min-content' : false,
1142
+ ]
1143
+ .filter(Boolean)
1144
+ .join(' '),
1084
1145
  '--dx-grid-content-inline-size': Number.isFinite(this.limitColumns)
1085
1146
  ? `${Math.max(0, this.totalIntrinsicInlineSize)}px`
1086
1147
  : 'max-content',
@@ -1094,70 +1155,34 @@ let DxGrid = class DxGrid extends LitElement {
1094
1155
  ${ref(this.gridRef)}
1095
1156
  >
1096
1157
  ${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>
1158
+ ${this.renderMainGrid(visibleCols, visibleRows, offsetInline, offsetBlock, selection)}
1121
1159
  ${this.renderFrozenColumns('frozenColsEnd', visibleRows, offsetBlock, selection)}${this.renderFixed('fixedEndStart', selection)}${this.renderFrozenRows('frozenRowsEnd', visibleCols, offsetInline, selection)}${this.renderFixed('fixedEndEnd', selection)}
1122
1160
  </div>`;
1123
1161
  }
1124
1162
  updateIntrinsicInlineSize() {
1125
1163
  this.intrinsicInlineSize = Number.isFinite(this.limitColumns)
1126
1164
  ? [...Array(this.limitColumns)].reduce((acc, _, c0) => acc + this.colSize(c0, 'grid'), 0) +
1127
- gap * (this.limitColumns - 1)
1165
+ gap * Math.max(0, this.limitColumns - 1)
1128
1166
  : Infinity;
1129
1167
  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);
1168
+ this.limitColumns > 0 ? this.intrinsicInlineSize + this.frozenColsSize : this.frozenColsSize - gap;
1137
1169
  }
1138
1170
  updateIntrinsicBlockSize() {
1139
1171
  this.intrinsicBlockSize = Number.isFinite(this.limitRows)
1140
1172
  ? [...Array(this.limitRows)].reduce((acc, _, r0) => acc + this.rowSize(r0, 'grid'), 0) +
1141
- gap * (this.limitRows - 1)
1173
+ gap * Math.max(0, this.limitRows - 1)
1142
1174
  : Infinity;
1143
1175
  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);
1176
+ this.limitRows > 0 ? this.intrinsicBlockSize + this.frozenRowsSize : this.frozenRowsSize - gap;
1151
1177
  }
1152
1178
  updateIntrinsicSizes() {
1153
1179
  this.updateIntrinsicInlineSize();
1154
1180
  this.updateIntrinsicBlockSize();
1155
1181
  }
1156
1182
  computeColSizes() {
1157
- var _a;
1158
- this.colSizes = Object.entries((_a = this.columns) !== null && _a !== void 0 ? _a : {}).reduce((acc, [plane, planeColMeta]) => {
1183
+ this.colSizes = Object.entries(this.columns ?? {}).reduce((acc, [plane, planeColMeta]) => {
1159
1184
  acc[plane] = Object.entries(planeColMeta).reduce((planeAcc, [col, colMeta]) => {
1160
- if (colMeta === null || colMeta === void 0 ? void 0 : colMeta.size) {
1185
+ if (colMeta?.size) {
1161
1186
  planeAcc[col] = colMeta.size;
1162
1187
  }
1163
1188
  return planeAcc;
@@ -1166,10 +1191,9 @@ let DxGrid = class DxGrid extends LitElement {
1166
1191
  }, { grid: {} });
1167
1192
  }
1168
1193
  computeRowSizes() {
1169
- var _a;
1170
- this.rowSizes = Object.entries((_a = this.rows) !== null && _a !== void 0 ? _a : {}).reduce((acc, [plane, planeRowMeta]) => {
1194
+ this.rowSizes = Object.entries(this.rows ?? {}).reduce((acc, [plane, planeRowMeta]) => {
1171
1195
  acc[plane] = Object.entries(planeRowMeta).reduce((planeAcc, [row, rowMeta]) => {
1172
- if (rowMeta === null || rowMeta === void 0 ? void 0 : rowMeta.size) {
1196
+ if (rowMeta?.size) {
1173
1197
  planeAcc[row] = rowMeta.size;
1174
1198
  }
1175
1199
  return planeAcc;
@@ -1181,7 +1205,7 @@ let DxGrid = class DxGrid extends LitElement {
1181
1205
  if (this.getCells) {
1182
1206
  this.updateCells(true);
1183
1207
  }
1184
- this.observer.observe(this.viewportRef.value);
1208
+ this.observer.observe(this.gridRef.value);
1185
1209
  this.computeColSizes();
1186
1210
  this.computeRowSizes();
1187
1211
  this.updateIntrinsicSizes();
@@ -1241,12 +1265,11 @@ let DxGrid = class DxGrid extends LitElement {
1241
1265
  return false;
1242
1266
  }
1243
1267
  disconnectedCallback() {
1244
- var _a;
1245
1268
  super.disconnectedCallback();
1246
- if (this.viewportRef.value) {
1247
- this.observer.unobserve(this.viewportRef.value);
1269
+ if (this.gridRef.value) {
1270
+ this.observer.unobserve(this.gridRef.value);
1248
1271
  }
1249
- (_a = document.defaultView) === null || _a === void 0 ? void 0 : _a.removeEventListener('wheel', this.handleTopLevelWheel);
1272
+ document.defaultView?.removeEventListener('wheel', this.handleTopLevelWheel);
1250
1273
  }
1251
1274
  createRenderRoot() {
1252
1275
  return this;
@@ -1351,6 +1374,12 @@ __decorate([
1351
1374
  __decorate([
1352
1375
  state()
1353
1376
  ], DxGrid.prototype, "templatefrozenRowsEnd", void 0);
1377
+ __decorate([
1378
+ state()
1379
+ ], DxGrid.prototype, "frozenColsSize", void 0);
1380
+ __decorate([
1381
+ state()
1382
+ ], DxGrid.prototype, "frozenRowsSize", void 0);
1354
1383
  __decorate([
1355
1384
  state()
1356
1385
  ], DxGrid.prototype, "pointer", void 0);
@@ -1391,6 +1420,6 @@ DxGrid = __decorate([
1391
1420
  customElement('dx-grid')
1392
1421
  ], DxGrid);
1393
1422
  export { DxGrid };
1394
- export { rowToA1Notation, colToA1Notation, closestAction, closestCell, parseCellIndex, toPlaneCellIndex, cellQuery, } from './util';
1423
+ export { rowToA1Notation, colToA1Notation, closestAction, closestCell, parseCellIndex, toPlaneCellIndex, cellQuery, accessoryHandlesPointerdownAttrs, } from './util';
1395
1424
  export const commentedClassName = 'dx-grid__cell--commented';
1396
1425
  //# sourceMappingURL=dx-grid.js.map