@dxos/lit-grid 0.6.13 → 0.6.14-main.1366248

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 (70) hide show
  1. package/dist/src/dx-grid-axis-resize-handle.d.ts +16 -0
  2. package/dist/src/dx-grid-axis-resize-handle.d.ts.map +1 -0
  3. package/dist/src/dx-grid-axis-resize-handle.js +96 -0
  4. package/dist/src/dx-grid-axis-resize-handle.js.map +1 -0
  5. package/dist/src/dx-grid-multiselect-cell.d.ts +13 -0
  6. package/dist/src/dx-grid-multiselect-cell.d.ts.map +1 -0
  7. package/dist/src/dx-grid-multiselect-cell.js +56 -0
  8. package/dist/src/dx-grid-multiselect-cell.js.map +1 -0
  9. package/dist/src/dx-grid.d.ts +147 -0
  10. package/dist/src/dx-grid.d.ts.map +1 -0
  11. package/dist/src/dx-grid.js +1375 -0
  12. package/dist/src/dx-grid.js.map +1 -0
  13. package/dist/src/dx-grid.lit-stories.d.ts +43 -0
  14. package/dist/src/dx-grid.lit-stories.d.ts.map +1 -0
  15. package/dist/src/dx-grid.lit-stories.js +176 -0
  16. package/dist/src/dx-grid.lit-stories.js.map +1 -0
  17. package/dist/src/index.d.ts +4 -0
  18. package/dist/src/index.d.ts.map +1 -0
  19. package/dist/src/index.js +7 -0
  20. package/dist/src/index.js.map +1 -0
  21. package/dist/src/types.d.ts +123 -0
  22. package/dist/src/types.d.ts.map +1 -0
  23. package/dist/src/types.js +44 -0
  24. package/dist/src/types.js.map +1 -0
  25. package/dist/src/util.d.ts +9 -0
  26. package/dist/src/util.d.ts.map +1 -0
  27. package/dist/src/util.js +19 -0
  28. package/dist/src/util.js.map +1 -0
  29. package/dist/types/src/dx-grid-axis-resize-handle.d.ts +16 -0
  30. package/dist/types/src/dx-grid-axis-resize-handle.d.ts.map +1 -0
  31. package/dist/types/src/dx-grid-axis-resize-handle.js +96 -0
  32. package/dist/types/src/dx-grid-axis-resize-handle.js.map +1 -0
  33. package/dist/types/src/dx-grid-multiselect-cell.d.ts +13 -0
  34. package/dist/types/src/dx-grid-multiselect-cell.d.ts.map +1 -0
  35. package/dist/types/src/dx-grid-multiselect-cell.js +56 -0
  36. package/dist/types/src/dx-grid-multiselect-cell.js.map +1 -0
  37. package/dist/types/src/dx-grid.d.ts +121 -57
  38. package/dist/types/src/dx-grid.d.ts.map +1 -1
  39. package/dist/types/src/dx-grid.js +1375 -0
  40. package/dist/types/src/dx-grid.js.map +1 -0
  41. package/dist/types/src/dx-grid.lit-stories.d.ts +28 -2
  42. package/dist/types/src/dx-grid.lit-stories.d.ts.map +1 -1
  43. package/dist/types/src/dx-grid.lit-stories.js +176 -0
  44. package/dist/types/src/dx-grid.lit-stories.js.map +1 -0
  45. package/dist/types/src/index.d.ts +1 -0
  46. package/dist/types/src/index.d.ts.map +1 -1
  47. package/dist/types/src/index.js +7 -0
  48. package/dist/types/src/index.js.map +1 -0
  49. package/dist/types/src/types.d.ts +115 -1
  50. package/dist/types/src/types.d.ts.map +1 -1
  51. package/dist/types/src/types.js +44 -0
  52. package/dist/types/src/types.js.map +1 -0
  53. package/dist/types/src/util.d.ts +9 -0
  54. package/dist/types/src/util.d.ts.map +1 -0
  55. package/dist/types/src/util.js +19 -0
  56. package/dist/types/src/util.js.map +1 -0
  57. package/package.json +7 -7
  58. package/src/dx-grid-axis-resize-handle.pcss +23 -0
  59. package/src/dx-grid-axis-resize-handle.ts +87 -0
  60. package/src/dx-grid-multiselect-cell.pcss +32 -0
  61. package/src/dx-grid-multiselect-cell.ts +46 -0
  62. package/src/dx-grid.lit-stories.ts +159 -21
  63. package/src/dx-grid.pcss +70 -71
  64. package/src/dx-grid.ts +1307 -363
  65. package/src/index.ts +1 -0
  66. package/src/types.ts +165 -1
  67. package/src/util.ts +28 -0
  68. package/dist/lib/browser/index.mjs +0 -578
  69. package/dist/lib/browser/index.mjs.map +0 -7
  70. package/dist/lib/browser/meta.json +0 -1
@@ -0,0 +1,1375 @@
1
+ //
2
+ // Copyright 2024 DXOS.org
3
+ //
4
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
5
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
6
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
7
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
8
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
9
+ };
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';
13
+ import { styleMap } from 'lit/directives/style-map.js';
14
+ import { unsafeStatic, html as staticHtml } from 'lit/static-html.js';
15
+ // eslint-disable-next-line unused-imports/no-unused-imports
16
+ import './dx-grid-axis-resize-handle';
17
+ import { DxAxisResize, DxEditRequest, DxGridCellsSelect, } from './types';
18
+ import { separator, toCellIndex } from './util';
19
+ /**
20
+ * The size in pixels of the gap between cells
21
+ */
22
+ const gap = 1;
23
+ /**
24
+ * ResizeObserver notices even subpixel changes, only respond to changes of at least 1px.
25
+ */
26
+ const resizeTolerance = 1;
27
+ /**
28
+ * The amount of pixels the primary pointer has to move after PointerDown to engage in selection.
29
+ */
30
+ const selectTolerance = 4;
31
+ //
32
+ // `defaultSize`, the final fallbacks
33
+ //
34
+ const defaultSizeRow = 32;
35
+ const defaultSizeCol = 180;
36
+ //
37
+ // `size`, when suffixed with ‘row’ or ‘col’, are limits on size applied when resizing
38
+ //
39
+ const sizeColMin = 32;
40
+ const sizeColMax = 1024;
41
+ const sizeRowMin = 32;
42
+ const sizeRowMax = 1024;
43
+ const shouldSelect = (pointer, { pageX, pageY }) => {
44
+ if ((pointer === null || pointer === void 0 ? void 0 : pointer.state) === 'maybeSelecting') {
45
+ return Math.hypot(Math.abs(pointer.pageX - pageX), Math.abs(pointer.pageY - pageY)) >= selectTolerance;
46
+ }
47
+ else {
48
+ return false;
49
+ }
50
+ };
51
+ const selectionProps = (selectionStart, selectionEnd) => {
52
+ const colMin = Math.min(selectionStart.col, selectionEnd.col);
53
+ const colMax = Math.max(selectionStart.col, selectionEnd.col);
54
+ const rowMin = Math.min(selectionStart.row, selectionEnd.row);
55
+ const rowMax = Math.max(selectionStart.row, selectionEnd.row);
56
+ const plane = selectionStart.plane;
57
+ const visible = colMin !== colMax || rowMin !== rowMax;
58
+ return { colMin, colMax, rowMin, rowMax, plane, visible };
59
+ };
60
+ const cellSelected = (col, row, plane, selection) => {
61
+ return (plane === selection.plane &&
62
+ col >= selection.colMin &&
63
+ col <= selection.colMax &&
64
+ row >= selection.rowMin &&
65
+ row <= selection.rowMax);
66
+ };
67
+ const closestAction = (target) => {
68
+ var _a, _b;
69
+ const actionEl = (_a = target === null || target === void 0 ? void 0 : target.closest('[data-dx-grid-action]')) !== null && _a !== void 0 ? _a : null;
70
+ return { actionEl, action: (_b = actionEl === null || actionEl === void 0 ? void 0 : actionEl.getAttribute('data-dx-grid-action')) !== null && _b !== void 0 ? _b : null };
71
+ };
72
+ export const closestCell = (target, actionEl) => {
73
+ var _a, _b, _c, _d;
74
+ let cellElement = actionEl;
75
+ if (!cellElement) {
76
+ const { action, actionEl } = closestAction(target);
77
+ if (action === 'cell') {
78
+ cellElement = actionEl;
79
+ }
80
+ }
81
+ if (cellElement) {
82
+ const col = parseInt((_a = cellElement.getAttribute('aria-colindex')) !== null && _a !== void 0 ? _a : 'never');
83
+ const row = parseInt((_b = cellElement.getAttribute('aria-rowindex')) !== null && _b !== void 0 ? _b : 'never');
84
+ const plane = ((_d = (_c = cellElement.closest('[data-dx-grid-plane]')) === null || _c === void 0 ? void 0 : _c.getAttribute('data-dx-grid-plane')) !== null && _d !== void 0 ? _d : 'grid');
85
+ return { plane, col, row };
86
+ }
87
+ else {
88
+ return null;
89
+ }
90
+ };
91
+ const targetIsPlane = (target) => {
92
+ var _a;
93
+ return (_a = target === null || target === void 0 ? void 0 : target.getAttribute('data-dx-grid-plane')) !== null && _a !== void 0 ? _a : null;
94
+ };
95
+ const resolveRowPlane = (plane) => {
96
+ switch (plane) {
97
+ case 'fixedStartStart':
98
+ case 'fixedStartEnd':
99
+ case 'frozenRowsStart':
100
+ return 'frozenRowsStart';
101
+ case 'fixedEndStart':
102
+ case 'fixedEndEnd':
103
+ case 'frozenRowsEnd':
104
+ return 'frozenRowsEnd';
105
+ default:
106
+ return 'grid';
107
+ }
108
+ };
109
+ const resolveColPlane = (plane) => {
110
+ switch (plane) {
111
+ case 'fixedStartStart':
112
+ case 'fixedEndStart':
113
+ case 'frozenColsStart':
114
+ return 'frozenColsStart';
115
+ case 'fixedStartEnd':
116
+ case 'fixedEndEnd':
117
+ case 'frozenColsEnd':
118
+ return 'frozenColsEnd';
119
+ default:
120
+ return 'grid';
121
+ }
122
+ };
123
+ const resolveFrozenPlane = (axis, cellPlane) => {
124
+ switch (cellPlane) {
125
+ case 'fixedStartStart':
126
+ return axis === 'col' ? 'frozenColsStart' : 'frozenRowsStart';
127
+ case 'fixedStartEnd':
128
+ return axis === 'col' ? 'frozenColsEnd' : 'frozenRowsStart';
129
+ case 'fixedEndStart':
130
+ return axis === 'col' ? 'frozenColsStart' : 'frozenRowsEnd';
131
+ case 'fixedEndEnd':
132
+ return axis === 'col' ? 'frozenColsEnd' : 'frozenRowsEnd';
133
+ case 'frozenColsStart':
134
+ case 'frozenColsEnd':
135
+ return axis === 'col' ? cellPlane : 'grid';
136
+ case 'frozenRowsStart':
137
+ case 'frozenRowsEnd':
138
+ return axis === 'row' ? cellPlane : 'grid';
139
+ default:
140
+ return cellPlane;
141
+ }
142
+ };
143
+ const isSameCell = (a, b) => a &&
144
+ b &&
145
+ a.plane === b.plane &&
146
+ Number.isFinite(a.col) &&
147
+ Number.isFinite(a.row) &&
148
+ a.col === b.col &&
149
+ a.row === b.row;
150
+ let DxGrid = class DxGrid extends LitElement {
151
+ constructor() {
152
+ var _a;
153
+ super();
154
+ this.gridId = 'default-grid-id';
155
+ this.rowDefault = {
156
+ grid: { size: defaultSizeRow },
157
+ };
158
+ this.columnDefault = {
159
+ grid: { size: defaultSizeCol },
160
+ };
161
+ this.rows = { grid: {} };
162
+ this.columns = { grid: {} };
163
+ this.initialCells = { grid: {} };
164
+ this.mode = 'browse';
165
+ this.limitColumns = Infinity;
166
+ this.limitRows = Infinity;
167
+ this.frozen = {};
168
+ this.overscroll = undefined;
169
+ this.activeRefs = '';
170
+ /**
171
+ * When this function is defined, it is used first to try to get a value for a cell, and otherwise will fall back
172
+ * to `cells`.
173
+ */
174
+ this.getCells = null;
175
+ this.cells = { grid: {} };
176
+ //
177
+ // `pos`, short for ‘position’, is the position in pixels of the viewport from the origin.
178
+ //
179
+ this.posInline = 0;
180
+ this.posBlock = 0;
181
+ //
182
+ // `size` (when not suffixed with ‘row’ or ‘col’, see above) is the size in pixels of the viewport.
183
+ //
184
+ this.sizeInline = 0;
185
+ this.sizeBlock = 0;
186
+ //
187
+ // `overscan` is the amount in pixels to offset the grid content due to the number of overscanned columns or rows.
188
+ //
189
+ this.visColMinStart = 0;
190
+ this.visRowMinStart = 0;
191
+ //
192
+ // `bin`, not short for anything, is the range in pixels within which virtualization does not need to reassess.
193
+ //
194
+ this.binInlineMin = 0;
195
+ this.binInlineMax = defaultSizeCol;
196
+ this.binBlockMin = 0;
197
+ this.binBlockMax = defaultSizeRow;
198
+ //
199
+ // `vis`, short for ‘visible’, is the range in numeric index of the columns or rows which should be rendered within
200
+ // the viewport. These start with naïve values that are updated before first contentful render.
201
+ //
202
+ this.visColMin = 0;
203
+ this.visColMax = 1;
204
+ this.visRowMin = 0;
205
+ this.visRowMax = 1;
206
+ //
207
+ // `template` is the rendered value of `grid-{axis}-template`.
208
+ //
209
+ this.templateGridColumns = '0';
210
+ this.templatefrozenColsStart = '';
211
+ this.templatefrozenColsEnd = '';
212
+ this.templateGridRows = '0';
213
+ this.templatefrozenRowsStart = '';
214
+ this.templatefrozenRowsEnd = '';
215
+ //
216
+ // Focus, selection, and resize states
217
+ //
218
+ this.pointer = null;
219
+ this.colSizes = { grid: {} };
220
+ this.rowSizes = { grid: {} };
221
+ this.focusActive = false;
222
+ this.focusedCell = { plane: 'grid', col: 0, row: 0 };
223
+ this.selectionStart = { plane: 'grid', col: 0, row: 0 };
224
+ this.selectionEnd = { plane: 'grid', col: 0, row: 0 };
225
+ //
226
+ // Limits
227
+ //
228
+ this.intrinsicInlineSize = Infinity;
229
+ this.intrinsicBlockSize = Infinity;
230
+ this.handlePointerDown = (event) => {
231
+ if (event.isPrimary) {
232
+ const { action, actionEl } = closestAction(event.target);
233
+ if (action && action === 'cell') {
234
+ if (event.shiftKey) {
235
+ // Prevent focus moving so the pointerup handler can move selectionEnd.
236
+ event.preventDefault();
237
+ this.pointer = { state: 'selecting' };
238
+ }
239
+ else {
240
+ const cellCoords = closestCell(event.target, actionEl);
241
+ if (cellCoords &&
242
+ this.mode !== 'edit' &&
243
+ !this.cellReadonly(cellCoords.col, cellCoords.row, cellCoords.plane)) {
244
+ this.pointer = { state: 'maybeSelecting', pageX: event.pageX, pageY: event.pageY };
245
+ this.selectionStart = cellCoords;
246
+ this.selectionEnd = cellCoords;
247
+ this.dispatchSelectionChange();
248
+ }
249
+ if (this.mode === 'edit-select') {
250
+ // Prevent focus moving when editing while selection is possible
251
+ event.preventDefault();
252
+ }
253
+ else {
254
+ if (this.focusActive && isSameCell(this.focusedCell, cellCoords)) {
255
+ this.dispatchEditRequest();
256
+ }
257
+ }
258
+ }
259
+ }
260
+ }
261
+ };
262
+ this.handlePointerUp = (event) => {
263
+ var _a;
264
+ const cell = closestCell(event.target);
265
+ if (cell && ((_a = this.pointer) === null || _a === void 0 ? void 0 : _a.state) === 'selecting') {
266
+ this.setSelectionEnd(cell);
267
+ }
268
+ this.pointer = null;
269
+ };
270
+ this.handlePointerMove = (event) => {
271
+ var _a;
272
+ if (shouldSelect(this.pointer, event)) {
273
+ this.pointer = { state: 'selecting' };
274
+ }
275
+ else if (((_a = this.pointer) === null || _a === void 0 ? void 0 : _a.state) === 'selecting') {
276
+ const cell = closestCell(event.target);
277
+ if (cell &&
278
+ cell.plane === this.selectionStart.plane &&
279
+ (cell.col !== this.selectionEnd.col || cell.row !== this.selectionEnd.row)) {
280
+ this.setSelectionEnd(cell);
281
+ }
282
+ }
283
+ };
284
+ //
285
+ // Resize & reposition handlers, observer, ref
286
+ //
287
+ this.observer = new ResizeObserver((entries) => {
288
+ var _a, _b, _c;
289
+ 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 : {
290
+ inlineSize: 0,
291
+ blockSize: 0,
292
+ };
293
+ if (Math.abs(inlineSize - this.sizeInline) > resizeTolerance ||
294
+ Math.abs(blockSize - this.sizeBlock) > resizeTolerance) {
295
+ // console.info('[updating bounds]', 'resize', [inlineSize - this.sizeInline, blockSize - this.sizeBlock]);
296
+ this.sizeInline = inlineSize;
297
+ this.sizeBlock = blockSize;
298
+ this.updateVis();
299
+ queueMicrotask(() => this.updatePos());
300
+ }
301
+ });
302
+ this.gridRef = createRef();
303
+ this.viewportRef = createRef();
304
+ this.maybeUpdateVisInline = () => {
305
+ if (this.posInline < this.binInlineMin || this.posInline >= this.binInlineMax) {
306
+ this.updateVisInline();
307
+ }
308
+ };
309
+ this.maybeUpdateVisBlock = () => {
310
+ if (this.posBlock < this.binBlockMin || this.posBlock >= this.binBlockMax) {
311
+ this.updateVisBlock();
312
+ }
313
+ };
314
+ this.handleTopLevelWheel = (event) => {
315
+ if ((Number.isFinite(event.overscrollInline) && this.overscroll === 'inline' && event.overscrollInline === 0) ||
316
+ (Number.isFinite(event.overscrollBlock) && this.overscroll === 'block' && event.overscrollBlock === 0)) {
317
+ event.preventDefault();
318
+ event.stopPropagation();
319
+ }
320
+ };
321
+ this.handleWheel = (event) => {
322
+ if (this.mode === 'browse') {
323
+ const nextPosInline = this.posInline + event.deltaX;
324
+ const nextPosBlock = this.posBlock + event.deltaY;
325
+ const maxPosInline = this.maxPosInline();
326
+ const maxPosBlock = this.maxPosBlock();
327
+ this.updatePos(nextPosInline, nextPosBlock, maxPosInline, maxPosBlock);
328
+ event.overscrollInline =
329
+ nextPosInline <= 0 ? nextPosInline : nextPosInline > maxPosInline ? nextPosInline - maxPosInline : 0;
330
+ event.overscrollBlock =
331
+ nextPosBlock <= 0 ? nextPosBlock : nextPosBlock > maxPosBlock ? nextPosBlock - maxPosBlock : 0;
332
+ }
333
+ };
334
+ // Wheel, top-level and element-level
335
+ (_a = document.defaultView) === null || _a === void 0 ? void 0 : _a.addEventListener('wheel', this.handleTopLevelWheel, { passive: false });
336
+ this.addEventListener('wheel', this.handleWheel);
337
+ // Custom event(s)
338
+ this.addEventListener('dx-axis-resize-internal', this.handleAxisResizeInternal);
339
+ // Standard events
340
+ this.addEventListener('pointerdown', this.handlePointerDown);
341
+ this.addEventListener('pointermove', this.handlePointerMove);
342
+ this.addEventListener('pointerup', this.handlePointerUp);
343
+ this.addEventListener('pointerleave', this.handlePointerUp);
344
+ this.addEventListener('focus', this.handleFocus, { capture: true });
345
+ this.addEventListener('blur', this.handleBlur, { capture: true });
346
+ this.addEventListener('keydown', this.handleKeydown);
347
+ }
348
+ //
349
+ // Primary pointer and keyboard handlers
350
+ //
351
+ dispatchEditRequest(initialContent) {
352
+ this.snapPosToFocusedCell();
353
+ if (!this.cellReadonly(this.focusedCell.col, this.focusedCell.row, this.focusedCell.plane)) {
354
+ // Without deferring, the event dispatches before `focusedCellBox` can get updated bounds of the cell, hence:
355
+ queueMicrotask(() => this.dispatchEvent(new DxEditRequest({
356
+ cellIndex: toCellIndex(this.focusedCell),
357
+ cellBox: this.focusedCellBox(),
358
+ initialContent,
359
+ })));
360
+ }
361
+ }
362
+ dispatchSelectionChange() {
363
+ return this.dispatchEvent(new DxGridCellsSelect({
364
+ start: this.selectionStart,
365
+ end: this.selectionEnd,
366
+ }));
367
+ }
368
+ /**
369
+ * Increments focus among all theoretically possible cells in a plane, cycling as tab would but accounting for the
370
+ * theoretical bounds of the grid plane (handling infinite planes heuristically).
371
+ */
372
+ incrementFocusWithinPlane(event) {
373
+ const reverse = event.shiftKey;
374
+ const colPlane = resolveColPlane(this.focusedCell.plane);
375
+ const rowPlane = resolveRowPlane(this.focusedCell.plane);
376
+ const colMax = (colPlane === 'grid' ? this.limitColumns : this.frozen[colPlane]) - 1;
377
+ const rowMax = (rowPlane === 'grid' ? this.limitRows : this.frozen[rowPlane]) - 1;
378
+ if (reverse ? this.focusedCell.col - 1 < 0 : this.focusedCell.col + 1 > colMax) {
379
+ if (reverse ? this.focusedCell.row - 1 < 0 : this.focusedCell.row + 1 > rowMax) {
380
+ this.setFocusedCell({
381
+ plane: this.focusedCell.plane,
382
+ row: reverse && Number.isFinite(rowMax) ? rowMax : 0,
383
+ col: reverse && Number.isFinite(colMax) ? colMax : 0,
384
+ });
385
+ }
386
+ else {
387
+ this.setFocusedCell({
388
+ plane: this.focusedCell.plane,
389
+ row: this.focusedCell.row + (reverse ? -1 : 1),
390
+ col: reverse && Number.isFinite(colMax) ? colMax : 0,
391
+ });
392
+ }
393
+ }
394
+ else {
395
+ this.setFocusedCell({ ...this.focusedCell, col: this.focusedCell.col + (reverse ? -1 : 1) });
396
+ }
397
+ }
398
+ /**
399
+ * Increments focus in a specific direction without cycling.
400
+ */
401
+ moveFocusOrSelectionEndWithinPlane(event) {
402
+ const current = event.shiftKey ? this.selectionEnd : this.focusedCell;
403
+ const deltaCol = event.key === 'ArrowLeft' ? -1 : event.key === 'ArrowRight' ? 1 : 0;
404
+ const deltaRow = event.key === 'ArrowUp' ? -1 : event.key === 'ArrowDown' ? 1 : 0;
405
+ const colPlane = resolveColPlane(current.plane);
406
+ const colMax = (colPlane === 'grid' ? this.limitColumns : this.frozen[colPlane]) - 1;
407
+ const nextCol = Math.max(0, Math.min(colMax, current.col + deltaCol));
408
+ const rowPlane = resolveRowPlane(current.plane);
409
+ const rowMax = (rowPlane === 'grid' ? this.limitRows : this.frozen[rowPlane]) - 1;
410
+ const nextRow = Math.max(0, Math.min(rowMax, current.row + deltaRow));
411
+ if (event.shiftKey) {
412
+ this.setSelectionEnd({ ...this.selectionEnd, col: nextCol, row: nextRow });
413
+ }
414
+ else {
415
+ this.setFocusedCell({ ...this.focusedCell, row: nextRow, col: nextCol });
416
+ }
417
+ }
418
+ moveFocusBetweenPlanes(event, plane) {
419
+ var _a, _b, _c, _d;
420
+ const planeElement = (_a = this.gridRef.value) === null || _a === void 0 ? void 0 : _a.querySelector(`[data-dx-grid-plane="${plane}"]`);
421
+ if (planeElement) {
422
+ const axis = event.key === 'ArrowUp' || event.key === 'ArrowDown' ? 'col' : 'row';
423
+ const delta = event.key === 'ArrowLeft' || event.key === 'ArrowUp' ? -1 : 1;
424
+ const planeAxis = planeElement === null || planeElement === void 0 ? void 0 : planeElement.getAttribute(`data-dx-grid-plane-${axis}`);
425
+ 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);
426
+ (_d = adjacentPlanes[(adjacentPlanes.length + adjacentPlanes.indexOf(planeElement) + delta) % adjacentPlanes.length]) === null || _d === void 0 ? void 0 : _d.focus({ preventScroll: true });
427
+ }
428
+ }
429
+ moveFocusIntoPlane(plane) {
430
+ var _a;
431
+ if (this.focusedCell.plane !== plane) {
432
+ const colPlane = resolveColPlane(plane);
433
+ const rowPlane = resolveRowPlane(plane);
434
+ this.focusedCell = {
435
+ plane,
436
+ col: colPlane === 'grid' ? this.visColMin : 0,
437
+ row: rowPlane === 'grid' ? this.visRowMin : 0,
438
+ };
439
+ }
440
+ (_a = this.focusedCellElement()) === null || _a === void 0 ? void 0 : _a.focus({ preventScroll: true });
441
+ }
442
+ moveFocusToPlane() {
443
+ var _a;
444
+ (_a = this.focusedPlaneElement()) === null || _a === void 0 ? void 0 : _a.focus({ preventScroll: true });
445
+ }
446
+ handleKeydown(event) {
447
+ if (this.focusActive && this.mode === 'browse') {
448
+ const plane = targetIsPlane(event.target);
449
+ if (plane) {
450
+ switch (event.key) {
451
+ case 'ArrowDown':
452
+ case 'ArrowUp':
453
+ case 'ArrowRight':
454
+ case 'ArrowLeft':
455
+ event.preventDefault();
456
+ this.moveFocusBetweenPlanes(event, plane);
457
+ break;
458
+ case 'Enter':
459
+ event.preventDefault();
460
+ this.moveFocusIntoPlane(plane);
461
+ break;
462
+ }
463
+ }
464
+ else {
465
+ // Adjust cell-scope state
466
+ switch (event.key) {
467
+ case 'ArrowDown':
468
+ case 'ArrowUp':
469
+ case 'ArrowRight':
470
+ case 'ArrowLeft':
471
+ event.preventDefault();
472
+ this.moveFocusOrSelectionEndWithinPlane(event);
473
+ break;
474
+ case 'Tab':
475
+ event.preventDefault();
476
+ this.incrementFocusWithinPlane(event);
477
+ break;
478
+ case 'Escape':
479
+ // Handle escape if selection is a superset of the focused cell.
480
+ event.preventDefault();
481
+ if (this.selectionStart.col !== this.selectionEnd.col ||
482
+ this.selectionStart.row !== this.selectionEnd.row) {
483
+ this.selectionStart = this.focusedCell;
484
+ this.selectionEnd = this.focusedCell;
485
+ this.dispatchSelectionChange();
486
+ }
487
+ else {
488
+ this.moveFocusToPlane();
489
+ }
490
+ break;
491
+ case 'Enter':
492
+ event.preventDefault();
493
+ this.dispatchEditRequest();
494
+ break;
495
+ default:
496
+ if (event.key.length === 1 && event.key.match(/\P{Cc}/u) && !(event.metaKey || event.ctrlKey)) {
497
+ this.dispatchEditRequest(event.key);
498
+ }
499
+ break;
500
+ }
501
+ }
502
+ }
503
+ }
504
+ //
505
+ // Accessors
506
+ //
507
+ colSize(c, plane) {
508
+ var _a, _b, _c, _d, _e;
509
+ const resolvedPlane = resolveColPlane(plane);
510
+ 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 : defaultSizeCol;
511
+ }
512
+ rowSize(r, plane) {
513
+ var _a, _b, _c, _d, _e;
514
+ const resolvedPlane = resolveRowPlane(plane);
515
+ 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 : defaultSizeRow;
516
+ }
517
+ cell(c, r, plane) {
518
+ var _a, _b, _c, _d, _e;
519
+ const index = `${c}${separator}${r}`;
520
+ 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];
521
+ }
522
+ cellActive(c, r, plane) {
523
+ return this.focusedCell.plane === plane && this.focusedCell.col === c && this.focusedCell.row === r;
524
+ }
525
+ setFocusedCell(nextCoords) {
526
+ if (this.focusedCell.plane !== nextCoords.plane ||
527
+ this.focusedCell.col !== nextCoords.col ||
528
+ this.focusedCell.row !== nextCoords.row) {
529
+ this.focusedCell = nextCoords;
530
+ this.selectionStart = nextCoords;
531
+ this.selectionEnd = nextCoords;
532
+ this.snapPosToFocusedCell();
533
+ this.dispatchSelectionChange();
534
+ }
535
+ }
536
+ // Internal utility for setting selection end.
537
+ setSelectionEnd(nextCoords) {
538
+ if (this.selectionEnd.plane !== nextCoords.plane ||
539
+ this.selectionEnd.col !== nextCoords.col ||
540
+ this.selectionEnd.row !== nextCoords.row) {
541
+ this.selectionEnd = nextCoords;
542
+ this.dispatchSelectionChange();
543
+ }
544
+ }
545
+ // Selection setter for consumers
546
+ setSelection(range) {
547
+ if (this.mode !== 'edit') {
548
+ this.selectionStart = range.start;
549
+ this.selectionEnd = range.end;
550
+ this.dispatchSelectionChange();
551
+ }
552
+ }
553
+ focusedCellBox() {
554
+ const cellElement = this.focusedCellElement();
555
+ const cellSize = {
556
+ inlineSize: this.colSize(this.focusedCell.col, this.focusedCell.plane),
557
+ blockSize: this.rowSize(this.focusedCell.row, this.focusedCell.plane),
558
+ };
559
+ if (!cellElement) {
560
+ return { insetInlineStart: NaN, insetBlockStart: NaN, ...cellSize };
561
+ }
562
+ const contentElement = cellElement.offsetParent;
563
+ // Note that storing `offset` in state causes performance issues, so instead the transform is parsed here.
564
+ const [_translate3d, inlineStr, blockStr] = contentElement.style.transform.split(/[()]|px,?\s?/);
565
+ const contentOffsetInline = parseFloat(inlineStr);
566
+ const contentOffsetBlock = parseFloat(blockStr);
567
+ const offsetParent = contentElement.offsetParent;
568
+ return {
569
+ insetInlineStart: cellElement.offsetLeft + contentOffsetInline + offsetParent.offsetLeft,
570
+ insetBlockStart: cellElement.offsetTop + contentOffsetBlock + offsetParent.offsetTop,
571
+ ...cellSize,
572
+ };
573
+ }
574
+ maxPosInline() {
575
+ return this.intrinsicInlineSize - this.sizeInline;
576
+ }
577
+ maxPosBlock() {
578
+ return this.intrinsicBlockSize - this.sizeBlock;
579
+ }
580
+ updatePosInline(inline, maxInline = this.maxPosInline()) {
581
+ this.posInline = Math.max(0, Math.min(maxInline, inline !== null && inline !== void 0 ? inline : this.posInline));
582
+ this.maybeUpdateVisInline();
583
+ }
584
+ updatePosBlock(block, maxBlock = this.maxPosBlock()) {
585
+ this.posBlock = Math.max(0, Math.min(maxBlock, block !== null && block !== void 0 ? block : this.posBlock));
586
+ this.maybeUpdateVisBlock();
587
+ }
588
+ updatePos(inline, block, maxInline, maxBlock) {
589
+ this.updatePosInline(inline, maxInline);
590
+ this.updatePosBlock(block, maxBlock);
591
+ }
592
+ updateVisInline() {
593
+ var _a, _b;
594
+ // todo: avoid starting from zero
595
+ let axisCursor = 0;
596
+ let pxCursor = this.colSize(axisCursor, 'grid');
597
+ while (pxCursor < this.posInline) {
598
+ axisCursor += 1;
599
+ pxCursor += this.colSize(axisCursor, 'grid') + gap;
600
+ }
601
+ this.visColMin = axisCursor;
602
+ this.visColMinStart = pxCursor - this.colSize(axisCursor, 'grid') - gap;
603
+ const visColMinEnd = pxCursor;
604
+ while (pxCursor < this.posInline + this.sizeInline) {
605
+ axisCursor += 1;
606
+ pxCursor += this.colSize(axisCursor, 'grid') + gap;
607
+ }
608
+ this.visColMax = Math.min(this.limitColumns, axisCursor + 1);
609
+ const visColMaxStart = pxCursor - this.colSize(axisCursor, 'grid') - gap;
610
+ const visColMaxEnd = pxCursor;
611
+ const bifurcateStart = visColMaxStart - this.sizeInline;
612
+ const bifurcateEnd = visColMaxEnd - this.sizeInline;
613
+ const bounds = [this.visColMinStart, visColMinEnd, bifurcateStart, bifurcateEnd].sort((a, b) => a - b);
614
+ let boundsCursor = 1;
615
+ while (bounds[boundsCursor] < this.posInline && boundsCursor < 3) {
616
+ boundsCursor += 1;
617
+ }
618
+ this.binInlineMin = bounds[boundsCursor - 1];
619
+ this.binInlineMax = bounds[boundsCursor];
620
+ this.templateGridColumns = [...Array(this.visColMax - this.visColMin)]
621
+ .map((_, c0) => `${this.colSize(this.visColMin + c0, 'grid')}px`)
622
+ .join(' ');
623
+ this.templatefrozenColsStart = [...Array((_a = this.frozen.frozenColsStart) !== null && _a !== void 0 ? _a : 0)]
624
+ .map((_, c0) => `${this.colSize(c0, 'frozenColsStart')}px`)
625
+ .join(' ');
626
+ this.templatefrozenColsEnd = [...Array((_b = this.frozen.frozenColsEnd) !== null && _b !== void 0 ? _b : 0)]
627
+ .map((_, c0) => `${this.colSize(c0, 'frozenColsEnd')}px`)
628
+ .join(' ');
629
+ }
630
+ updateVisBlock() {
631
+ var _a, _b;
632
+ // todo: avoid starting from zero
633
+ let axisCursor = 0;
634
+ let pxCursor = this.rowSize(axisCursor, 'grid');
635
+ while (pxCursor < this.posBlock) {
636
+ axisCursor += 1;
637
+ pxCursor += this.rowSize(axisCursor, 'grid') + gap;
638
+ }
639
+ this.visRowMin = axisCursor;
640
+ this.visRowMinStart = pxCursor - this.rowSize(axisCursor, 'grid') - gap;
641
+ const visRowMinEnd = pxCursor;
642
+ while (pxCursor < this.posBlock + this.sizeBlock) {
643
+ axisCursor += 1;
644
+ pxCursor += this.rowSize(axisCursor, 'grid') + gap;
645
+ }
646
+ this.visRowMax = Math.min(this.limitRows, axisCursor + 1);
647
+ const visRowMaxStart = pxCursor - this.rowSize(axisCursor, 'grid') - gap;
648
+ const visRowMaxEnd = pxCursor;
649
+ const bifurcateStart = visRowMaxStart - this.sizeBlock;
650
+ const bifurcateEnd = visRowMaxEnd - this.sizeBlock;
651
+ const bounds = [this.visRowMinStart, visRowMinEnd, bifurcateStart, bifurcateEnd].sort((a, b) => a - b);
652
+ let boundsCursor = 1;
653
+ while (bounds[boundsCursor] < this.posBlock && boundsCursor < 3) {
654
+ boundsCursor += 1;
655
+ }
656
+ this.binBlockMin = bounds[boundsCursor - 1];
657
+ this.binBlockMax = bounds[boundsCursor];
658
+ this.templateGridRows = [...Array(this.visRowMax - this.visRowMin)]
659
+ .map((_, r0) => `${this.rowSize(this.visRowMin + r0, 'grid')}px`)
660
+ .join(' ');
661
+ this.templatefrozenRowsStart = [...Array((_a = this.frozen.frozenRowsStart) !== null && _a !== void 0 ? _a : 0)]
662
+ .map((_, r0) => `${this.rowSize(r0, 'frozenRowsStart')}px`)
663
+ .join(' ');
664
+ this.templatefrozenRowsEnd = [...Array((_b = this.frozen.frozenRowsEnd) !== null && _b !== void 0 ? _b : 0)]
665
+ .map((_, r0) => `${this.rowSize(r0, 'frozenRowsEnd')}px`)
666
+ .join(' ');
667
+ }
668
+ updateVis() {
669
+ this.updateVisInline();
670
+ this.updateVisBlock();
671
+ }
672
+ updateCells(includeFixed) {
673
+ var _a, _b, _c, _d, _e, _f, _g, _h;
674
+ this.cells.grid = this.getCells({
675
+ start: { col: this.visColMin, row: this.visRowMin },
676
+ end: { col: this.visColMax, row: this.visRowMax },
677
+ }, 'grid');
678
+ Object.entries(this.frozen)
679
+ .filter(([_, limit]) => limit && limit > 0)
680
+ .forEach(([plane, limit]) => {
681
+ this.cells[plane] = this.getCells(plane.startsWith('frozenRows')
682
+ ? {
683
+ start: { col: this.visColMin, row: 0 },
684
+ end: { col: this.visColMax, row: limit },
685
+ }
686
+ : {
687
+ start: { col: 0, row: this.visRowMin },
688
+ end: { col: limit, row: this.visRowMax },
689
+ }, plane);
690
+ });
691
+ if (includeFixed) {
692
+ if (((_a = this.frozen.frozenColsStart) !== null && _a !== void 0 ? _a : 0) > 0 && ((_b = this.frozen.frozenRowsStart) !== null && _b !== void 0 ? _b : 0) > 0) {
693
+ this.cells.fixedStartStart = this.getCells({
694
+ start: { col: 0, row: 0 },
695
+ end: { col: this.frozen.frozenColsStart, row: this.frozen.frozenRowsStart },
696
+ }, 'fixedStartStart');
697
+ }
698
+ if (((_c = this.frozen.frozenColsEnd) !== null && _c !== void 0 ? _c : 0) > 0 && ((_d = this.frozen.frozenRowsStart) !== null && _d !== void 0 ? _d : 0) > 0) {
699
+ this.cells.fixedStartEnd = this.getCells({
700
+ start: { col: 0, row: 0 },
701
+ end: { col: this.frozen.frozenColsEnd, row: this.frozen.frozenRowsStart },
702
+ }, 'fixedStartEnd');
703
+ }
704
+ if (((_e = this.frozen.frozenColsStart) !== null && _e !== void 0 ? _e : 0) > 0 && ((_f = this.frozen.frozenRowsEnd) !== null && _f !== void 0 ? _f : 0) > 0) {
705
+ this.cells.fixedEndStart = this.getCells({
706
+ start: { col: 0, row: 0 },
707
+ end: { col: this.frozen.frozenColsStart, row: this.frozen.frozenRowsEnd },
708
+ }, 'fixedEndStart');
709
+ }
710
+ if (((_g = this.frozen.frozenColsEnd) !== null && _g !== void 0 ? _g : 0) > 0 && ((_h = this.frozen.frozenRowsEnd) !== null && _h !== void 0 ? _h : 0) > 0) {
711
+ this.cells.fixedEndEnd = this.getCells({
712
+ start: { col: 0, row: 0 },
713
+ end: { col: this.frozen.frozenColsEnd, row: this.frozen.frozenRowsEnd },
714
+ }, 'fixedEndEnd');
715
+ }
716
+ }
717
+ }
718
+ // Focus handlers
719
+ setFocus(coords, snap = true) {
720
+ this.setFocusedCell(coords);
721
+ this.focusActive = true;
722
+ if (snap) {
723
+ this.snapPosToFocusedCell();
724
+ }
725
+ }
726
+ handleFocus(event) {
727
+ const cellCoords = closestCell(event.target);
728
+ if (cellCoords) {
729
+ this.focusActive = true;
730
+ this.setFocusedCell(cellCoords);
731
+ }
732
+ }
733
+ handleBlur(event) {
734
+ // Only unset `focusActive` if focus is moving to an element outside the grid.
735
+ if (event.relatedTarget && !event.relatedTarget.closest(`[data-grid="${this.gridId}"]`)) {
736
+ this.focusActive = false;
737
+ }
738
+ }
739
+ focusedCellQuery() {
740
+ return `[data-dx-grid-plane=${this.focusedCell.plane}] [aria-colindex="${this.focusedCell.col}"][aria-rowindex="${this.focusedCell.row}"]`;
741
+ }
742
+ focusedPlaneQuery() {
743
+ return `[data-dx-grid-plane=${this.focusedCell.plane}]`;
744
+ }
745
+ focusedCellElement() {
746
+ var _a;
747
+ return (_a = this.gridRef.value) === null || _a === void 0 ? void 0 : _a.querySelector(this.focusedCellQuery());
748
+ }
749
+ focusedPlaneElement() {
750
+ var _a;
751
+ return (_a = this.gridRef.value) === null || _a === void 0 ? void 0 : _a.querySelector(this.focusedPlaneQuery());
752
+ }
753
+ //
754
+ // `outOfVis` returns by how many rows/cols the focused cell is outside of the `vis` range for an axis, inset by a
755
+ // `delta`, otherwise zero if it is within that range.
756
+ //
757
+ focusedCellRowOutOfVis() {
758
+ return this.focusedCell.row <= this.visRowMin
759
+ ? this.focusedCell.row - this.visRowMin - 1
760
+ : this.focusedCell.row >= this.visRowMax - 1
761
+ ? this.focusedCell.row + 2 - this.visRowMax
762
+ : 0;
763
+ }
764
+ focusedCellColOutOfVis() {
765
+ return this.focusedCell.col <= this.visColMin
766
+ ? this.focusedCell.col - this.visColMin - 1
767
+ : this.focusedCell.col >= this.visColMax - 1
768
+ ? this.focusedCell.col + 2 - this.visColMax
769
+ : 0;
770
+ }
771
+ focusedCellOutOfVis() {
772
+ switch (this.focusedCell.plane) {
773
+ case 'grid':
774
+ return { row: this.focusedCellRowOutOfVis(), col: this.focusedCellColOutOfVis() };
775
+ case 'frozenRowsStart':
776
+ case 'frozenRowsEnd':
777
+ return { col: this.focusedCellColOutOfVis(), row: 0 };
778
+ case 'frozenColsStart':
779
+ case 'frozenColsEnd':
780
+ return { col: 0, row: this.focusedCellRowOutOfVis() };
781
+ default:
782
+ return { col: 0, row: 0 };
783
+ }
784
+ }
785
+ focusPlaneElement() { }
786
+ /**
787
+ * Moves focus to the cell with actual focus, otherwise moves focus to the viewport.
788
+ */
789
+ refocus(increment, delta = 1) {
790
+ if (increment) {
791
+ switch (increment) {
792
+ case 'col': {
793
+ this.focusedCell.col += delta;
794
+ break;
795
+ }
796
+ case 'row': {
797
+ this.focusedCell.row += delta;
798
+ break;
799
+ }
800
+ }
801
+ this.snapPosToFocusedCell();
802
+ }
803
+ queueMicrotask(() => {
804
+ const cellElement = this.focusedCellElement();
805
+ if (cellElement) {
806
+ if (cellElement !== document.activeElement) {
807
+ cellElement.focus({ preventScroll: true });
808
+ }
809
+ }
810
+ else {
811
+ this.moveFocusToPlane();
812
+ }
813
+ });
814
+ }
815
+ clampPosInline(nextPos) {
816
+ return Math.max(0, Math.min(this.intrinsicInlineSize - this.sizeInline, nextPos));
817
+ }
818
+ clampPosBlock(nextPos) {
819
+ return Math.max(0, Math.min(this.intrinsicBlockSize - this.sizeBlock, nextPos));
820
+ }
821
+ /**
822
+ * Updates `pos` so that a cell in focus is fully within the viewport
823
+ */
824
+ snapPosToFocusedCell() {
825
+ const outOfVis = this.focusedCellOutOfVis();
826
+ if (outOfVis.col < 0) {
827
+ // align viewport start edge with focused cell start edge
828
+ this.posInline = this.clampPosInline([...Array(this.focusedCell.col)].reduce((acc, _, c0) => {
829
+ return acc + this.colSize(c0, 'grid') + gap;
830
+ }, 0));
831
+ this.updateVisInline();
832
+ }
833
+ else if (outOfVis.col > 0) {
834
+ // align viewport end edge with focused cell end edge
835
+ this.posInline = this.clampPosInline([...Array(this.focusedCell.col + 1)].reduce((acc, _, c0) => {
836
+ return acc + this.colSize(c0, 'grid') + gap;
837
+ }, -this.sizeInline) - gap);
838
+ this.updateVisInline();
839
+ }
840
+ if (outOfVis.row < 0) {
841
+ // align viewport start edge with focused cell start edge
842
+ this.posBlock = this.clampPosBlock([...Array(this.focusedCell.row)].reduce((acc, _, r0) => {
843
+ return acc + this.rowSize(r0, 'grid') + gap;
844
+ }, 0));
845
+ this.updateVisBlock();
846
+ }
847
+ else if (outOfVis.row > 0) {
848
+ // align viewport end edge with focused cell end edge
849
+ this.posBlock = this.clampPosBlock([...Array(this.focusedCell.row + 1)].reduce((acc, _, r0) => {
850
+ return acc + this.rowSize(r0, 'grid') + gap;
851
+ }, -this.sizeBlock) - gap);
852
+ this.updateVisBlock();
853
+ }
854
+ }
855
+ //
856
+ // Map scroll DOM methods to virtualized value.
857
+ //
858
+ get scrollLeft() {
859
+ return this.posInline;
860
+ }
861
+ set scrollLeft(nextValue) {
862
+ this.posInline = nextValue;
863
+ this.maybeUpdateVisInline();
864
+ }
865
+ get scrollTop() {
866
+ return this.posBlock;
867
+ }
868
+ set scrollTop(nextValue) {
869
+ this.posBlock = nextValue;
870
+ this.maybeUpdateVisBlock();
871
+ }
872
+ //
873
+ // Resize handlers
874
+ //
875
+ axisResizeable(plane, axis, index) {
876
+ var _a, _b, _c, _d, _e, _f, _g, _h;
877
+ return axis === 'col'
878
+ ? !!((_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)
879
+ : !!((_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);
880
+ }
881
+ handleAxisResizeInternal(event) {
882
+ event.stopPropagation();
883
+ const { plane, axis, delta, size, index, state } = event;
884
+ if (axis === 'col') {
885
+ const nextSize = Math.max(sizeColMin, Math.min(sizeColMax, size + delta));
886
+ this.colSizes = { ...this.colSizes, [plane]: { ...this.colSizes[plane], [index]: nextSize } };
887
+ this.updateVisInline();
888
+ this.updateIntrinsicInlineSize();
889
+ }
890
+ else {
891
+ const nextSize = Math.max(sizeRowMin, Math.min(sizeRowMax, size + delta));
892
+ this.rowSizes = { ...this.colSizes, [plane]: { ...this.rowSizes[plane], [index]: nextSize } };
893
+ this.updateVisBlock();
894
+ this.updateIntrinsicBlockSize();
895
+ }
896
+ if (state === 'dropped') {
897
+ this.dispatchEvent(new DxAxisResize({
898
+ plane,
899
+ axis,
900
+ index,
901
+ size: this[`${axis}Size`](index, plane),
902
+ }));
903
+ }
904
+ }
905
+ //
906
+ // Render and other lifecycle methods
907
+ //
908
+ // TODO(thure): This is for rendering presentational objects superimposed onto the canonical grid (e.g. DnD drop line for #8108).
909
+ renderPresentationLayer(offsetInline, offsetBlock) {
910
+ var _a, _b, _c, _d, _e, _f;
911
+ const visibleCols = this.visColMax - this.visColMin;
912
+ const visibleRows = this.visRowMax - this.visRowMin;
913
+ return html `<div
914
+ role="none"
915
+ class="dx-grid-layer--presentation"
916
+ style=${styleMap({
917
+ gridTemplateColumns: [
918
+ ...[...Array((_a = this.frozen.frozenColsStart) !== null && _a !== void 0 ? _a : 0)].map((_, c0) => `${this.colSize(c0, 'frozenColsStart')}px`),
919
+ ...[...Array(visibleCols)].map((_, c0) => c0 === visibleCols - 1
920
+ ? '1fr'
921
+ : `${this.colSize(this.visColMin + c0, 'grid') + (c0 === 0 ? offsetInline : 0)}px`),
922
+ ...[...Array((_b = this.frozen.frozenColsEnd) !== null && _b !== void 0 ? _b : 0)].map((_, c0) => `${this.colSize(c0, 'frozenColsEnd')}px`),
923
+ ].join(' '),
924
+ gridTemplateRows: [
925
+ ...[...Array((_c = this.frozen.frozenRowsStart) !== null && _c !== void 0 ? _c : 0)].map((_, r0) => `${this.rowSize(r0, 'frozenRowsStart')}px`),
926
+ ...[...Array(visibleRows)].map((_, r0) => r0 === visibleRows - 1
927
+ ? '1fr'
928
+ : `${this.rowSize(this.visRowMin + r0, 'grid') + (r0 === 0 ? offsetBlock : 0)}px`),
929
+ ...[...Array((_d = this.frozen.frozenRowsEnd) !== null && _d !== void 0 ? _d : 0)].map((_, r0) => `${this.rowSize(r0, 'frozenRowsEnd')}px`),
930
+ ].join(' '),
931
+ })}
932
+ >
933
+ ${
934
+ /* TODO(thure): These are debug cells, remove when rendering actual overlay content. */ [
935
+ ...Array(((_e = this.frozen.frozenRowsStart) !== null && _e !== void 0 ? _e : 0) + visibleRows + ((_f = this.frozen.frozenRowsEnd) !== null && _f !== void 0 ? _f : 0)),
936
+ ].map((_, r0) => {
937
+ var _a, _b;
938
+ 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
939
+ role="none"
940
+ class="dx-grid-layer--presentation__cell"
941
+ style="grid-column:${c0 + 1};grid-row:${r0 + 1}"
942
+ ></div>`);
943
+ })}
944
+ </div>`;
945
+ }
946
+ renderFixed(plane, selection) {
947
+ const colPlane = resolveColPlane(plane);
948
+ const rowPlane = resolveRowPlane(plane);
949
+ const cols = this.frozen[colPlane];
950
+ const rows = this.frozen[rowPlane];
951
+ return (cols !== null && cols !== void 0 ? cols : 0) > 0 && (rows !== null && rows !== void 0 ? rows : 0) > 0
952
+ ? html `<div
953
+ role="none"
954
+ tabindex="0"
955
+ data-dx-grid-plane=${plane}
956
+ data-dx-grid-plane-row=${plane === 'fixedStartStart' || plane === 'fixedStartEnd' ? 0 : 2}
957
+ data-dx-grid-plane-col=${plane === 'fixedStartStart' || plane === 'fixedEndStart' ? 0 : 2}
958
+ class="dx-grid__plane--fixed"
959
+ style=${styleMap({
960
+ 'grid-template-columns': this[`template${colPlane}`],
961
+ 'grid-template-rows': this[`template${rowPlane}`],
962
+ })}
963
+ >
964
+ ${[...Array(rows)].map((_, r) => {
965
+ return [...Array(cols)].map((_, c) => {
966
+ return this.renderCell(c, r, plane, cellSelected(c, r, plane, selection));
967
+ });
968
+ })}
969
+ </div>`
970
+ : null;
971
+ }
972
+ renderFrozenRows(plane, visibleCols, offsetInline, selection) {
973
+ const rowPlane = resolveRowPlane(plane);
974
+ const rows = this.frozen[rowPlane];
975
+ return (rows !== null && rows !== void 0 ? rows : 0) > 0
976
+ ? html `<div
977
+ role="none"
978
+ class="dx-grid__plane--frozen-row"
979
+ tabindex="0"
980
+ data-dx-grid-plane=${plane}
981
+ data-dx-grid-plane-row=${plane === 'frozenRowsStart' ? 0 : 2}
982
+ data-dx-grid-plane-col="1"
983
+ >
984
+ <div
985
+ role="none"
986
+ class="dx-grid__plane--frozen-row__content"
987
+ style="transform:translate3d(${offsetInline}px,0,0);grid-template-columns:${this
988
+ .templateGridColumns};grid-template-rows:${this[`template${rowPlane}`]}"
989
+ >
990
+ ${[...Array(rows)].map((_, r) => {
991
+ return [...Array(visibleCols)].map((_, c0) => {
992
+ const c = this.visColMin + c0;
993
+ return this.renderCell(c, r, plane, cellSelected(c, r, plane, selection), c0, r);
994
+ });
995
+ })}
996
+ </div>
997
+ </div>`
998
+ : null;
999
+ }
1000
+ renderFrozenColumns(plane, visibleRows, offsetBlock, selection) {
1001
+ const colPlane = resolveColPlane(plane);
1002
+ const cols = this.frozen[colPlane];
1003
+ return (cols !== null && cols !== void 0 ? cols : 0) > 0
1004
+ ? html `<div
1005
+ role="none"
1006
+ class="dx-grid__plane--frozen-col"
1007
+ tabindex="0"
1008
+ data-dx-grid-plane=${plane}
1009
+ data-dx-grid-plane-col=${plane === 'frozenColsStart' ? 0 : 2}
1010
+ data-dx-grid-plane-row="1"
1011
+ >
1012
+ <div
1013
+ role="none"
1014
+ class="dx-grid__plane--frozen-col__content"
1015
+ style="transform:translate3d(0,${offsetBlock}px,0);grid-template-rows:${this
1016
+ .templateGridRows};grid-template-columns:${this[`template${colPlane}`]}"
1017
+ >
1018
+ ${[...Array(visibleRows)].map((_, r0) => {
1019
+ return [...Array(cols)].map((_, c) => {
1020
+ const r = this.visRowMin + r0;
1021
+ return this.renderCell(c, r, plane, cellSelected(c, r, plane, selection), c, r0);
1022
+ });
1023
+ })}
1024
+ </div>
1025
+ </div>`
1026
+ : null;
1027
+ }
1028
+ cellReadonly(col, row, plane) {
1029
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
1030
+ const colPlane = resolveColPlane(plane);
1031
+ const rowPlane = resolveRowPlane(plane);
1032
+ const cellReadonly = (_a = this.cell(col, row, plane)) === null || _a === void 0 ? void 0 : _a.readonly;
1033
+ if (cellReadonly !== undefined) {
1034
+ return cellReadonly;
1035
+ }
1036
+ return (((_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) ||
1037
+ ((_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));
1038
+ }
1039
+ renderCell(col, row, plane, selected, visCol = col, visRow = row) {
1040
+ var _a, _b;
1041
+ const cell = this.cell(col, row, plane);
1042
+ const active = this.cellActive(col, row, plane);
1043
+ const readonly = this.cellReadonly(col, row, plane);
1044
+ const resizeIndex = (cell === null || cell === void 0 ? void 0 : cell.resizeHandle) ? (cell.resizeHandle === 'col' ? col : row) : undefined;
1045
+ const resizePlane = (cell === null || cell === void 0 ? void 0 : cell.resizeHandle) ? resolveFrozenPlane(cell.resizeHandle, plane) : undefined;
1046
+ const accessory = (cell === null || cell === void 0 ? void 0 : cell.accessoryHtml) ? staticHtml `${unsafeStatic(cell.accessoryHtml)}` : null;
1047
+ return html `<div
1048
+ role="gridcell"
1049
+ tabindex="0"
1050
+ aria-selected=${selected ? 'true' : nothing}
1051
+ aria-readonly=${readonly ? 'true' : nothing}
1052
+ class=${(_a = cell === null || cell === void 0 ? void 0 : cell.className) !== null && _a !== void 0 ? _a : nothing}
1053
+ data-refs=${(_b = cell === null || cell === void 0 ? void 0 : cell.dataRefs) !== null && _b !== void 0 ? _b : nothing}
1054
+ ?data-dx-active=${active}
1055
+ data-dx-grid-action="cell"
1056
+ aria-colindex=${col}
1057
+ aria-rowindex=${row}
1058
+ style="grid-column:${visCol + 1};grid-row:${visRow + 1}"
1059
+ >
1060
+ ${this.mode !== 'browse' && active ? null : cell === null || cell === void 0 ? void 0 : cell.value}${this.mode !== 'browse' && active
1061
+ ? null
1062
+ : accessory}${(cell === null || cell === void 0 ? void 0 : cell.resizeHandle) &&
1063
+ this.mode === 'browse' &&
1064
+ this.axisResizeable(resizePlane, cell.resizeHandle, resizeIndex)
1065
+ ? html `<dx-grid-axis-resize-handle
1066
+ axis=${cell.resizeHandle}
1067
+ plane=${resizePlane}
1068
+ index=${resizeIndex}
1069
+ size=${this[`${cell.resizeHandle}Size`](resizeIndex, plane)}
1070
+ ></dx-grid-axis-resize-handle>`
1071
+ : null}
1072
+ </div>`;
1073
+ }
1074
+ render() {
1075
+ const visibleCols = this.visColMax - this.visColMin;
1076
+ const visibleRows = this.visRowMax - this.visRowMin;
1077
+ const offsetInline = this.visColMinStart - this.posInline + gap;
1078
+ const offsetBlock = this.visRowMinStart - this.posBlock + gap;
1079
+ const selection = selectionProps(this.selectionStart, this.selectionEnd);
1080
+ return html `<style>
1081
+ ${this.activeRefs
1082
+ .split(' ')
1083
+ .filter((value) => value)
1084
+ .map((activeRef) => `[data-refs~="${activeRef}"] { background: var(--dx-grid-commented-active, var(--dx-gridCommentedActive)) !important; }`)
1085
+ .join('\n')}
1086
+ </style>
1087
+ <div
1088
+ role="none"
1089
+ class="dx-grid"
1090
+ style=${styleMap({
1091
+ 'grid-template-columns': `${this.templatefrozenColsStart ? 'min-content ' : ''}minmax(0, ${Number.isFinite(this.limitColumns) ? `${this.intrinsicInlineSize}px` : '1fr'})${this.templatefrozenColsEnd ? ' min-content' : ''}`,
1092
+ 'grid-template-rows': `${this.templatefrozenRowsStart ? 'min-content ' : ''}minmax(0, ${Number.isFinite(this.limitRows) ? `${this.intrinsicBlockSize}px` : '1fr'})${this.templatefrozenRowsEnd ? ' min-content' : ''}`,
1093
+ })}
1094
+ data-grid=${this.gridId}
1095
+ data-grid-mode=${this.mode}
1096
+ ?data-grid-select=${selection.visible}
1097
+ ${ref(this.gridRef)}
1098
+ >
1099
+ ${this.renderFixed('fixedStartStart', selection)}${this.renderFrozenRows('frozenRowsStart', visibleCols, offsetInline, selection)}${this.renderFixed('fixedStartEnd', selection)}${this.renderFrozenColumns('frozenColsStart', visibleRows, offsetBlock, selection)}
1100
+ <div
1101
+ role="grid"
1102
+ class="dx-grid__plane--grid"
1103
+ tabindex="0"
1104
+ data-dx-grid-plane="grid"
1105
+ data-dx-grid-plane-row="1"
1106
+ data-dx-grid-plane-col="1"
1107
+ ${ref(this.viewportRef)}
1108
+ >
1109
+ <div
1110
+ role="none"
1111
+ class="dx-grid__plane--grid__content"
1112
+ style="transform:translate3d(${offsetInline}px,${offsetBlock}px,0);grid-template-columns:${this
1113
+ .templateGridColumns};grid-template-rows:${this.templateGridRows};"
1114
+ >
1115
+ ${[...Array(visibleRows)].map((_, r0) => {
1116
+ return [...Array(visibleCols)].map((_, c0) => {
1117
+ const c = c0 + this.visColMin;
1118
+ const r = r0 + this.visRowMin;
1119
+ return this.renderCell(c, r, 'grid', cellSelected(c, r, 'grid', selection), c0, r0);
1120
+ });
1121
+ })}
1122
+ </div>
1123
+ </div>
1124
+ ${this.renderFrozenColumns('frozenColsEnd', visibleRows, offsetBlock, selection)}${this.renderFixed('fixedEndStart', selection)}${this.renderFrozenRows('frozenRowsEnd', visibleCols, offsetInline, selection)}${this.renderFixed('fixedEndEnd', selection)}
1125
+ </div>`;
1126
+ }
1127
+ updateIntrinsicInlineSize() {
1128
+ this.intrinsicInlineSize = Number.isFinite(this.limitColumns)
1129
+ ? [...Array(this.limitColumns)].reduce((acc, _, c0) => acc + this.colSize(c0, 'grid'), 0) +
1130
+ gap * (this.limitColumns - 1)
1131
+ : Infinity;
1132
+ }
1133
+ updateIntrinsicBlockSize() {
1134
+ this.intrinsicBlockSize = Number.isFinite(this.limitRows)
1135
+ ? [...Array(this.limitRows)].reduce((acc, _, r0) => acc + this.rowSize(r0, 'grid'), 0) +
1136
+ gap * (this.limitRows - 1)
1137
+ : Infinity;
1138
+ }
1139
+ updateIntrinsicSizes() {
1140
+ this.updateIntrinsicInlineSize();
1141
+ this.updateIntrinsicBlockSize();
1142
+ }
1143
+ computeColSizes() {
1144
+ var _a;
1145
+ this.colSizes = Object.entries((_a = this.columns) !== null && _a !== void 0 ? _a : {}).reduce((acc, [plane, planeColMeta]) => {
1146
+ acc[plane] = Object.entries(planeColMeta).reduce((planeAcc, [col, colMeta]) => {
1147
+ if (colMeta === null || colMeta === void 0 ? void 0 : colMeta.size) {
1148
+ planeAcc[col] = colMeta.size;
1149
+ }
1150
+ return planeAcc;
1151
+ }, {});
1152
+ return acc;
1153
+ }, { grid: {} });
1154
+ }
1155
+ computeRowSizes() {
1156
+ var _a;
1157
+ this.rowSizes = Object.entries((_a = this.rows) !== null && _a !== void 0 ? _a : {}).reduce((acc, [plane, planeRowMeta]) => {
1158
+ acc[plane] = Object.entries(planeRowMeta).reduce((planeAcc, [row, rowMeta]) => {
1159
+ if (rowMeta === null || rowMeta === void 0 ? void 0 : rowMeta.size) {
1160
+ planeAcc[row] = rowMeta.size;
1161
+ }
1162
+ return planeAcc;
1163
+ }, {});
1164
+ return acc;
1165
+ }, { grid: {} });
1166
+ }
1167
+ firstUpdated() {
1168
+ if (this.getCells) {
1169
+ this.updateCells(true);
1170
+ }
1171
+ this.observer.observe(this.viewportRef.value);
1172
+ this.computeColSizes();
1173
+ this.computeRowSizes();
1174
+ this.updateIntrinsicSizes();
1175
+ }
1176
+ willUpdate(changedProperties) {
1177
+ if (this.getCells &&
1178
+ (changedProperties.has('initialCells') ||
1179
+ changedProperties.has('visColMin') ||
1180
+ changedProperties.has('visColMax') ||
1181
+ changedProperties.has('visRowMin') ||
1182
+ changedProperties.has('visRowMax') ||
1183
+ changedProperties.has('columns') ||
1184
+ changedProperties.has('rows') ||
1185
+ changedProperties.has('limitColumns') ||
1186
+ changedProperties.has('limitRows'))) {
1187
+ this.updateCells(true);
1188
+ }
1189
+ if (changedProperties.has('rowDefault') || changedProperties.has('rows') || changedProperties.has('limitRows')) {
1190
+ this.updateIntrinsicBlockSize();
1191
+ this.updatePosBlock();
1192
+ this.updateVisBlock();
1193
+ }
1194
+ if (changedProperties.has('colDefault') ||
1195
+ changedProperties.has('columns') ||
1196
+ changedProperties.has('limitColumns')) {
1197
+ this.updateIntrinsicInlineSize();
1198
+ this.updatePosInline();
1199
+ this.updateVisInline();
1200
+ }
1201
+ if (changedProperties.has('columns')) {
1202
+ this.computeColSizes();
1203
+ this.updateIntrinsicInlineSize();
1204
+ }
1205
+ if (changedProperties.has('rows')) {
1206
+ this.computeRowSizes();
1207
+ this.updateIntrinsicBlockSize();
1208
+ }
1209
+ }
1210
+ updated(changedProperties) {
1211
+ // Update the focused element if there is a change in bounds (otherwise Lit keeps focus on the relative element).
1212
+ if (this.focusActive &&
1213
+ (changedProperties.has('visColMin') ||
1214
+ changedProperties.has('visColMax') ||
1215
+ changedProperties.has('visRowMin') ||
1216
+ changedProperties.has('visRowMax') ||
1217
+ changedProperties.has('focusedCell'))) {
1218
+ this.refocus();
1219
+ }
1220
+ }
1221
+ updateIfWithinBounds({ col, row }) {
1222
+ if (col >= this.visColMin && col <= this.visColMax && row >= this.visRowMin && row <= this.visRowMax) {
1223
+ this.requestUpdate();
1224
+ return true;
1225
+ }
1226
+ return false;
1227
+ }
1228
+ disconnectedCallback() {
1229
+ var _a;
1230
+ super.disconnectedCallback();
1231
+ if (this.viewportRef.value) {
1232
+ this.observer.unobserve(this.viewportRef.value);
1233
+ }
1234
+ (_a = document.defaultView) === null || _a === void 0 ? void 0 : _a.removeEventListener('wheel', this.handleTopLevelWheel);
1235
+ }
1236
+ createRenderRoot() {
1237
+ return this;
1238
+ }
1239
+ };
1240
+ __decorate([
1241
+ property({ type: String })
1242
+ ], DxGrid.prototype, "gridId", void 0);
1243
+ __decorate([
1244
+ property({ type: Object })
1245
+ ], DxGrid.prototype, "rowDefault", void 0);
1246
+ __decorate([
1247
+ property({ type: Object })
1248
+ ], DxGrid.prototype, "columnDefault", void 0);
1249
+ __decorate([
1250
+ property({ type: Object })
1251
+ ], DxGrid.prototype, "rows", void 0);
1252
+ __decorate([
1253
+ property({ type: Object })
1254
+ ], DxGrid.prototype, "columns", void 0);
1255
+ __decorate([
1256
+ property({ type: Object })
1257
+ ], DxGrid.prototype, "initialCells", void 0);
1258
+ __decorate([
1259
+ property({ type: String })
1260
+ ], DxGrid.prototype, "mode", void 0);
1261
+ __decorate([
1262
+ property({ type: Number })
1263
+ ], DxGrid.prototype, "limitColumns", void 0);
1264
+ __decorate([
1265
+ property({ type: Number })
1266
+ ], DxGrid.prototype, "limitRows", void 0);
1267
+ __decorate([
1268
+ property({ type: Object })
1269
+ ], DxGrid.prototype, "frozen", void 0);
1270
+ __decorate([
1271
+ property({ type: String })
1272
+ ], DxGrid.prototype, "overscroll", void 0);
1273
+ __decorate([
1274
+ property({ type: String })
1275
+ ], DxGrid.prototype, "activeRefs", void 0);
1276
+ __decorate([
1277
+ state()
1278
+ ], DxGrid.prototype, "cells", void 0);
1279
+ __decorate([
1280
+ state()
1281
+ ], DxGrid.prototype, "posInline", void 0);
1282
+ __decorate([
1283
+ state()
1284
+ ], DxGrid.prototype, "posBlock", void 0);
1285
+ __decorate([
1286
+ state()
1287
+ ], DxGrid.prototype, "sizeInline", void 0);
1288
+ __decorate([
1289
+ state()
1290
+ ], DxGrid.prototype, "sizeBlock", void 0);
1291
+ __decorate([
1292
+ state()
1293
+ ], DxGrid.prototype, "visColMinStart", void 0);
1294
+ __decorate([
1295
+ state()
1296
+ ], DxGrid.prototype, "visRowMinStart", void 0);
1297
+ __decorate([
1298
+ state()
1299
+ ], DxGrid.prototype, "binInlineMin", void 0);
1300
+ __decorate([
1301
+ state()
1302
+ ], DxGrid.prototype, "binInlineMax", void 0);
1303
+ __decorate([
1304
+ state()
1305
+ ], DxGrid.prototype, "binBlockMin", void 0);
1306
+ __decorate([
1307
+ state()
1308
+ ], DxGrid.prototype, "binBlockMax", void 0);
1309
+ __decorate([
1310
+ state()
1311
+ ], DxGrid.prototype, "visColMin", void 0);
1312
+ __decorate([
1313
+ state()
1314
+ ], DxGrid.prototype, "visColMax", void 0);
1315
+ __decorate([
1316
+ state()
1317
+ ], DxGrid.prototype, "visRowMin", void 0);
1318
+ __decorate([
1319
+ state()
1320
+ ], DxGrid.prototype, "visRowMax", void 0);
1321
+ __decorate([
1322
+ state()
1323
+ ], DxGrid.prototype, "templateGridColumns", void 0);
1324
+ __decorate([
1325
+ state()
1326
+ ], DxGrid.prototype, "templatefrozenColsStart", void 0);
1327
+ __decorate([
1328
+ state()
1329
+ ], DxGrid.prototype, "templatefrozenColsEnd", void 0);
1330
+ __decorate([
1331
+ state()
1332
+ ], DxGrid.prototype, "templateGridRows", void 0);
1333
+ __decorate([
1334
+ state()
1335
+ ], DxGrid.prototype, "templatefrozenRowsStart", void 0);
1336
+ __decorate([
1337
+ state()
1338
+ ], DxGrid.prototype, "templatefrozenRowsEnd", void 0);
1339
+ __decorate([
1340
+ state()
1341
+ ], DxGrid.prototype, "pointer", void 0);
1342
+ __decorate([
1343
+ state()
1344
+ ], DxGrid.prototype, "colSizes", void 0);
1345
+ __decorate([
1346
+ state()
1347
+ ], DxGrid.prototype, "rowSizes", void 0);
1348
+ __decorate([
1349
+ state()
1350
+ ], DxGrid.prototype, "focusActive", void 0);
1351
+ __decorate([
1352
+ state()
1353
+ ], DxGrid.prototype, "focusedCell", void 0);
1354
+ __decorate([
1355
+ state()
1356
+ ], DxGrid.prototype, "selectionStart", void 0);
1357
+ __decorate([
1358
+ state()
1359
+ ], DxGrid.prototype, "selectionEnd", void 0);
1360
+ __decorate([
1361
+ state()
1362
+ ], DxGrid.prototype, "intrinsicInlineSize", void 0);
1363
+ __decorate([
1364
+ state()
1365
+ ], DxGrid.prototype, "intrinsicBlockSize", void 0);
1366
+ __decorate([
1367
+ state()
1368
+ ], DxGrid.prototype, "observer", void 0);
1369
+ DxGrid = __decorate([
1370
+ customElement('dx-grid')
1371
+ ], DxGrid);
1372
+ export { DxGrid };
1373
+ export { rowToA1Notation, colToA1Notation } from './util';
1374
+ export const commentedClassName = 'dx-grid__cell--commented';
1375
+ //# sourceMappingURL=dx-grid.js.map