@dxos/lit-grid 0.6.12-main.5a87ad5 → 0.6.12-main.5cc132e

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.
@@ -1,19 +1,7 @@
1
1
  // packages/ui/lit-grid/src/dx-grid.ts
2
- import { LitElement as LitElement2, html as html2, nothing } from "lit";
3
- import { customElement as customElement2, state, property as property2, eventOptions } from "lit/decorators.js";
4
- import { ref as ref2, createRef } from "lit/directives/ref.js";
5
-
6
- // packages/ui/lit-grid/src/dx-grid-axis-resize-handle.ts
7
- import { draggable } from "@atlaskit/pragmatic-drag-and-drop/element/adapter";
8
- import { disableNativeDragPreview } from "@atlaskit/pragmatic-drag-and-drop/element/disable-native-drag-preview";
9
- import { preventUnhandled } from "@atlaskit/pragmatic-drag-and-drop/prevent-unhandled";
10
- import { html, LitElement } from "lit";
11
- import { customElement, property } from "lit/decorators.js";
12
- import { ref } from "lit/directives/ref.js";
13
-
14
- // packages/ui/lit-grid/src/util.ts
15
- var separator = ",";
16
- var toCellIndex = (cellCoords) => `${cellCoords.col}${separator}${cellCoords.row}`;
2
+ import { LitElement, html } from "lit";
3
+ import { customElement, state, property, eventOptions } from "lit/decorators.js";
4
+ import { ref, createRef } from "lit/directives/ref.js";
17
5
 
18
6
  // packages/ui/lit-grid/src/types.ts
19
7
  var DxAxisResize = class extends Event {
@@ -24,124 +12,16 @@ var DxAxisResize = class extends Event {
24
12
  this.size = props.size;
25
13
  }
26
14
  };
27
- var DxAxisResizeInternal = class extends Event {
28
- constructor(props) {
29
- super("dx-axis-resize-internal", {
30
- composed: true,
31
- bubbles: true
32
- });
33
- this.axis = props.axis;
34
- this.index = props.index;
35
- this.size = props.size;
36
- this.delta = props.delta;
37
- this.state = props.state;
38
- }
39
- };
40
15
  var DxEditRequest = class extends Event {
41
16
  constructor(props) {
42
17
  super("dx-edit-request");
43
18
  this.cellIndex = props.cellIndex;
44
19
  this.cellBox = props.cellBox;
45
- this.initialContent = props.initialContent;
46
- }
47
- };
48
- var DxGridCellsSelect = class extends Event {
49
- constructor({ start, end }) {
50
- super("dx-grid-cells-select");
51
- this.start = toCellIndex(start);
52
- this.end = toCellIndex(end);
53
- this.minCol = Math.min(start.col, end.col);
54
- this.maxCol = Math.max(start.col, end.col);
55
- this.minRow = Math.min(start.row, end.row);
56
- this.maxRow = Math.max(start.row, end.row);
57
20
  }
58
21
  };
59
22
 
60
- // packages/ui/lit-grid/src/dx-grid-axis-resize-handle.ts
61
- function _ts_decorate(decorators, target, key, desc) {
62
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
63
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
64
- 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;
65
- return c > 3 && r && Object.defineProperty(target, key, r), r;
66
- }
67
- var DxGridAxisResizeHandle = class extends LitElement {
68
- constructor() {
69
- super(...arguments);
70
- this.axis = "row";
71
- this.index = "-1";
72
- this.size = 128;
73
- this.dragStartSize = 128;
74
- this.cleanup = null;
75
- }
76
- render() {
77
- return html`<button class="dx-grid__resize-handle" ${ref(this.mount)}>
78
- <span class="sr-only">Resize</span>
79
- </button>`;
80
- }
81
- dispatchResize(location, state2) {
82
- const client = this.axis === "row" ? "clientY" : "clientX";
83
- const event = new DxAxisResizeInternal({
84
- axis: this.axis,
85
- size: this.dragStartSize,
86
- index: this.index,
87
- delta: location.current.input[client] - location.initial.input[client],
88
- state: state2
89
- });
90
- this.dispatchEvent(event);
91
- }
92
- mount(element) {
93
- this.cleanup?.();
94
- const host = this;
95
- if (element) {
96
- this.cleanup = draggable({
97
- element,
98
- onGenerateDragPreview: ({ nativeSetDragImage }) => {
99
- disableNativeDragPreview({
100
- nativeSetDragImage
101
- });
102
- preventUnhandled.start();
103
- },
104
- onDragStart() {
105
- host.dragStartSize = host.size;
106
- },
107
- onDrag({ location }) {
108
- host.dispatchResize(location, "dragging");
109
- },
110
- onDrop({ location }) {
111
- host.dispatchResize(location, "dropped");
112
- }
113
- });
114
- }
115
- }
116
- disconnectedCallback() {
117
- super.disconnectedCallback();
118
- this.cleanup?.();
119
- }
120
- createRenderRoot() {
121
- return this;
122
- }
123
- };
124
- _ts_decorate([
125
- property({
126
- type: String
127
- })
128
- ], DxGridAxisResizeHandle.prototype, "axis", void 0);
129
- _ts_decorate([
130
- property({
131
- type: String
132
- })
133
- ], DxGridAxisResizeHandle.prototype, "index", void 0);
134
- _ts_decorate([
135
- property({
136
- type: Number
137
- })
138
- ], DxGridAxisResizeHandle.prototype, "size", void 0);
139
- DxGridAxisResizeHandle = _ts_decorate([
140
- customElement("dx-grid-axis-resize-handle")
141
- ], DxGridAxisResizeHandle);
142
-
143
23
  // packages/ui/lit-grid/src/dx-grid.ts
144
- function _ts_decorate2(decorators, target, key, desc) {
24
+ function _ts_decorate(decorators, target, key, desc) {
145
25
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
146
26
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
147
27
  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;
@@ -155,6 +35,7 @@ var sizeColMin = 32;
155
35
  var sizeColMax = 1024;
156
36
  var sizeRowMin = 16;
157
37
  var sizeRowMax = 1024;
38
+ var separator = ",";
158
39
  var colToA1Notation = (col) => {
159
40
  return (col >= 26 ? String.fromCharCode("A".charCodeAt(0) + Math.floor(col / 26) - 1) : "") + String.fromCharCode("A".charCodeAt(0) + col % 26);
160
41
  };
@@ -188,13 +69,13 @@ var closestCell = (target, actionEl) => {
188
69
  }
189
70
  };
190
71
  var isSameCell = (a, b) => a && b && Number.isFinite(a.col) && Number.isFinite(a.row) && a.col === b.col && a.row === b.row;
72
+ var toCellIndex = (cellCoords) => `${cellCoords.col}${separator}${cellCoords.row}`;
191
73
  var localChId = (c0) => `ch--${c0}`;
192
74
  var localRhId = (r0) => `rh--${r0}`;
193
75
  var getPage = (axis, event) => axis === "col" ? event.pageX : event.pageY;
194
- var DxGrid = class extends LitElement2 {
76
+ var DxGrid = class extends LitElement {
195
77
  constructor() {
196
- super();
197
- this.gridId = "default-grid-id";
78
+ super(...arguments);
198
79
  this.rowDefault = {
199
80
  size: 32
200
81
  };
@@ -203,14 +84,8 @@ var DxGrid = class extends LitElement2 {
203
84
  };
204
85
  this.rows = {};
205
86
  this.columns = {};
206
- this.initialCells = {};
207
- this.mode = "browse";
208
- /**
209
- * When this function is defined, it is used first to try to get a value for a cell, and otherwise will fall back
210
- * to `cells`.
211
- */
212
- this.getCells = null;
213
87
  this.cells = {};
88
+ this.mode = "browse";
214
89
  //
215
90
  // `pos`, short for ‘position’, is the position in pixels of the viewport from the origin.
216
91
  //
@@ -247,76 +122,65 @@ var DxGrid = class extends LitElement2 {
247
122
  this.templateColumns = `${this.colSize(0)}px`;
248
123
  this.templateRows = `${this.rowSize(0)}px`;
249
124
  //
250
- // Focus, selection, and resize states
125
+ // Resize state
251
126
  //
252
- this.pointer = null;
253
127
  this.colSizes = {};
254
128
  this.rowSizes = {};
255
- this.focusActive = false;
256
- this.focusedCell = {
257
- col: 0,
258
- row: 0
259
- };
260
- this.selectionStart = {
261
- col: 0,
262
- row: 0
263
- };
264
- this.selectionEnd = {
265
- col: 0,
266
- row: 0
267
- };
129
+ this.resizing = null;
130
+ //
131
+ // Primary pointer and keyboard handlers
132
+ //
268
133
  this.handlePointerDown = (event) => {
269
- if (event.isPrimary) {
270
- const { action, actionEl } = closestAction(event.target);
271
- if (action) {
272
- if (action.startsWith("resize") && this.mode === "browse") {
273
- const [resize, index] = action.split(",");
274
- const [_, axis] = resize.split("-");
275
- this.pointer = {
276
- state: "resizing",
277
- axis,
278
- size: axis === "col" ? this.colSize(index) : this.rowSize(index),
279
- page: getPage(axis, event),
280
- index
281
- };
282
- } else if (action === "cell") {
283
- const cellCoords = closestCell(event.target, actionEl);
284
- if (cellCoords) {
285
- this.pointer = {
286
- state: "selecting"
287
- };
288
- this.selectionStart = cellCoords;
289
- }
290
- if (this.mode === "edit") {
291
- event.preventDefault();
292
- } else {
293
- if (this.focusActive && isSameCell(this.focusedCell, cellCoords)) {
294
- this.dispatchEditRequest();
295
- }
296
- }
134
+ const { action, actionEl } = closestAction(event.target);
135
+ if (action) {
136
+ if (action.startsWith("resize") && this.mode === "browse") {
137
+ const [resize, index] = action.split(",");
138
+ const [_, axis] = resize.split("-");
139
+ this.resizing = {
140
+ axis,
141
+ size: axis === "col" ? this.colSize(index) : this.rowSize(index),
142
+ page: getPage(axis, event),
143
+ index
144
+ };
145
+ } else if (action === "cell") {
146
+ const cellCoords = closestCell(event.target, actionEl);
147
+ if (this.focusActive && isSameCell(this.focusedCell, cellCoords)) {
148
+ this.dispatchEvent(new DxEditRequest({
149
+ cellIndex: toCellIndex(cellCoords),
150
+ cellBox: this.focusedCellBox()
151
+ }));
297
152
  }
298
153
  }
299
154
  }
300
155
  };
301
- this.handlePointerUp = (event) => {
302
- if (this.pointer?.state === "resizing") {
303
- } else {
304
- const cell = closestCell(event.target);
305
- if (cell) {
306
- this.selectionEnd = cell;
307
- this.dispatchEvent(new DxGridCellsSelect({
308
- start: this.selectionStart,
309
- end: this.selectionEnd
310
- }));
311
- }
156
+ this.handlePointerUp = (_event) => {
157
+ if (this.resizing) {
158
+ const resizeEvent = new DxAxisResize({
159
+ axis: this.resizing.axis,
160
+ index: this.resizing.index,
161
+ size: this[this.resizing.axis === "col" ? "colSize" : "rowSize"](this.resizing.index)
162
+ });
163
+ this.dispatchEvent(resizeEvent);
164
+ this.resizing = null;
312
165
  }
313
- this.pointer = null;
314
166
  };
315
167
  this.handlePointerMove = (event) => {
316
- if (this.pointer?.state === "selecting") {
317
- const cell = closestCell(event.target);
318
- if (cell && (cell.col !== this.selectionEnd.col || cell.row !== this.selectionEnd.row)) {
319
- this.selectionEnd = cell;
168
+ if (this.resizing) {
169
+ const delta = getPage(this.resizing.axis, event) - this.resizing.page;
170
+ if (this.resizing.axis === "col") {
171
+ const nextSize = Math.max(sizeColMin, Math.min(sizeColMax, this.resizing.size + delta));
172
+ this.colSizes = {
173
+ ...this.colSizes,
174
+ [this.resizing.index]: nextSize
175
+ };
176
+ this.updateVisInline();
177
+ } else {
178
+ const nextSize = Math.max(sizeRowMin, Math.min(sizeRowMax, this.resizing.size + delta));
179
+ this.rowSizes = {
180
+ ...this.rowSizes,
181
+ [this.resizing.index]: nextSize
182
+ };
183
+ this.updateVisBlock();
320
184
  }
321
185
  }
322
186
  };
@@ -335,43 +199,22 @@ var DxGrid = class extends LitElement2 {
335
199
  }
336
200
  });
337
201
  this.viewportRef = createRef();
338
- this.maybeUpdateVis = () => {
339
- if (this.posInline >= this.binInlineMin && this.posInline < this.binInlineMax && this.posBlock >= this.binBlockMin && this.posBlock < this.binBlockMax) {
340
- } else {
341
- this.updateVis();
342
- }
343
- };
344
202
  this.handleWheel = ({ deltaX, deltaY }) => {
345
203
  if (this.mode === "browse") {
346
204
  this.posInline = Math.max(0, this.posInline + deltaX);
347
205
  this.posBlock = Math.max(0, this.posBlock + deltaY);
348
- this.maybeUpdateVis();
206
+ if (this.posInline >= this.binInlineMin && this.posInline < this.binInlineMax && this.posBlock >= this.binBlockMin && this.posBlock < this.binBlockMax) {
207
+ } else {
208
+ this.updateVis();
209
+ }
349
210
  }
350
211
  };
351
- this.addEventListener("dx-axis-resize-internal", this.handleAxisResizeInternal);
352
- this.addEventListener("wheel", this.handleWheel);
353
- this.addEventListener("pointerdown", this.handlePointerDown);
354
- this.addEventListener("pointermove", this.handlePointerMove);
355
- this.addEventListener("pointerup", this.handlePointerUp);
356
- this.addEventListener("pointerleave", this.handlePointerUp);
357
- this.addEventListener("focus", this.handleFocus, {
358
- capture: true
359
- });
360
- this.addEventListener("blur", this.handleBlur, {
361
- capture: true
362
- });
363
- this.addEventListener("keydown", this.handleKeydown);
364
- }
365
- //
366
- // Primary pointer and keyboard handlers
367
- //
368
- dispatchEditRequest(initialContent) {
369
- this.snapPosToFocusedCell();
370
- queueMicrotask(() => this.dispatchEvent(new DxEditRequest({
371
- cellIndex: toCellIndex(this.focusedCell),
372
- cellBox: this.focusedCellBox(),
373
- initialContent
374
- })));
212
+ // Focus handlers
213
+ this.focusedCell = {
214
+ col: 0,
215
+ row: 0
216
+ };
217
+ this.focusActive = false;
375
218
  }
376
219
  handleKeydown(event) {
377
220
  if (this.focusActive && this.mode === "browse") {
@@ -403,12 +246,10 @@ var DxGrid = class extends LitElement2 {
403
246
  }
404
247
  switch (event.key) {
405
248
  case "Enter":
406
- this.dispatchEditRequest();
407
- break;
408
- default:
409
- if (event.key.length === 1 && event.key.match(/\P{Cc}/u)) {
410
- this.dispatchEditRequest(event.key);
411
- }
249
+ this.dispatchEvent(new DxEditRequest({
250
+ cellIndex: toCellIndex(this.focusedCell),
251
+ cellBox: this.focusedCellBox()
252
+ }));
412
253
  break;
413
254
  }
414
255
  switch (event.key) {
@@ -432,8 +273,7 @@ var DxGrid = class extends LitElement2 {
432
273
  return this.rowSizes?.[r] ?? this.rowDefault.size;
433
274
  }
434
275
  cell(c, r) {
435
- const index = `${c}${separator}${r}`;
436
- return this.cells[index] ?? this.initialCells[index];
276
+ return this.cells[`${c}${separator}${r}`];
437
277
  }
438
278
  focusedCellBox() {
439
279
  const cellElement = this.focusedCellElement();
@@ -513,7 +353,6 @@ var DxGrid = class extends LitElement2 {
513
353
  this.updateVisInline();
514
354
  this.updateVisBlock();
515
355
  }
516
- // Focus handlers
517
356
  handleFocus(event) {
518
357
  const cellCoords = closestCell(event.target);
519
358
  if (cellCoords) {
@@ -522,7 +361,7 @@ var DxGrid = class extends LitElement2 {
522
361
  }
523
362
  }
524
363
  handleBlur(event) {
525
- if (!event.relatedTarget || !event.relatedTarget.closest(`[data-grid="${this.gridId}"]`)) {
364
+ if (!event.relatedTarget || event.relatedTarget.closest(".dx-grid__viewport") !== this.viewportRef.value) {
526
365
  this.focusActive = false;
527
366
  }
528
367
  }
@@ -532,26 +371,23 @@ var DxGrid = class extends LitElement2 {
532
371
  /**
533
372
  * Moves focus to the cell with actual focus, otherwise moves focus to the viewport.
534
373
  */
535
- refocus(increment, delta = 1) {
374
+ refocus(increment) {
536
375
  switch (increment) {
537
- case "row":
376
+ case "down":
538
377
  this.focusedCell = {
539
378
  ...this.focusedCell,
540
- row: this.focusedCell.row + delta
379
+ row: this.focusedCell.row + 1
541
380
  };
542
381
  break;
543
- case "col":
382
+ case "right":
544
383
  this.focusedCell = {
545
384
  ...this.focusedCell,
546
- col: this.focusedCell.col + delta
385
+ col: this.focusedCell.col + 1
547
386
  };
548
387
  }
549
388
  (this.focusedCell.row < this.visRowMin || this.focusedCell.row > this.visRowMax || this.focusedCell.col < this.visColMin || this.focusedCell.col > this.visColMax ? this.viewportRef.value : this.focusedCellElement())?.focus({
550
389
  preventScroll: true
551
390
  });
552
- if (increment) {
553
- this.snapPosToFocusedCell();
554
- }
555
391
  }
556
392
  /**
557
393
  * Updates `pos` so that a cell in focus is fully within the viewport
@@ -570,7 +406,7 @@ var DxGrid = class extends LitElement2 {
570
406
  acc += this.colSize(this.visColMin + overscanCol + c0) + gap;
571
407
  return acc;
572
408
  }, 0);
573
- this.posInline = Math.max(0, this.binInlineMin + sizeSumCol + gap * 2 - this.sizeInline);
409
+ this.posInline = this.binInlineMin + sizeSumCol + gap * 2 - this.sizeInline;
574
410
  this.updateVisInline();
575
411
  }
576
412
  if (this.focusedCell.row <= this.visRowMin + overscanRow) {
@@ -583,76 +419,28 @@ var DxGrid = class extends LitElement2 {
583
419
  acc += this.rowSize(this.visRowMin + overscanRow + r0) + gap;
584
420
  return acc;
585
421
  }, 0);
586
- this.posBlock = Math.max(0, this.binBlockMin + sizeSumRow + gap * 2 - this.sizeBlock);
422
+ this.posBlock = this.binBlockMin + sizeSumRow + gap * 2 - this.sizeBlock;
587
423
  this.updateVisBlock();
588
424
  }
589
425
  }
590
426
  }
591
427
  //
592
- // Map scroll DOM methods to virtualized value.
593
- //
594
- get scrollLeft() {
595
- return this.posInline;
596
- }
597
- set scrollLeft(nextValue) {
598
- this.posInline = nextValue;
599
- this.maybeUpdateVis();
600
- }
601
- get scrollTop() {
602
- return this.posBlock;
603
- }
604
- set scrollTop(nextValue) {
605
- this.posBlock = nextValue;
606
- this.maybeUpdateVis();
607
- }
608
- //
609
- // Resize handlers
610
- //
611
- handleAxisResizeInternal(event) {
612
- event.stopPropagation();
613
- const { axis, delta, size, index, type } = event;
614
- if (axis === "col") {
615
- const nextSize = Math.max(sizeColMin, Math.min(sizeColMax, size + delta));
616
- this.colSizes = {
617
- ...this.colSizes,
618
- [index]: nextSize
619
- };
620
- this.updateVisInline();
621
- } else {
622
- const nextSize = Math.max(sizeRowMin, Math.min(sizeRowMax, size + delta));
623
- this.rowSizes = {
624
- ...this.rowSizes,
625
- [index]: nextSize
626
- };
627
- this.updateVisBlock();
628
- }
629
- if (type === "dropped") {
630
- this.dispatchEvent(new DxAxisResize({
631
- axis,
632
- index,
633
- size: this[axis === "col" ? "colSize" : "rowSize"](index)
634
- }));
635
- }
636
- }
637
- //
638
428
  // Render and other lifecycle methods
639
429
  //
640
430
  render() {
641
431
  const visibleCols = this.visColMax - this.visColMin;
642
432
  const visibleRows = this.visRowMax - this.visRowMin;
643
- const offsetInline = this.binInlineMin - this.posInline - this.overscanInline;
644
- const offsetBlock = this.binBlockMin - this.posBlock - this.overscanBlock;
645
- const selectColMin = Math.min(this.selectionStart.col, this.selectionEnd.col);
646
- const selectColMax = Math.max(this.selectionStart.col, this.selectionEnd.col);
647
- const selectRowMin = Math.min(this.selectionStart.row, this.selectionEnd.row);
648
- const selectRowMax = Math.max(this.selectionStart.row, this.selectionEnd.row);
649
- const selectVisible = selectColMin !== selectColMax || selectRowMin !== selectRowMax;
650
- return html2`<div
433
+ const offsetInline = gap + this.binInlineMin - this.posInline - this.overscanInline;
434
+ const offsetBlock = gap + this.binBlockMin - this.posBlock - this.overscanBlock;
435
+ return html`<div
651
436
  role="none"
652
437
  class="dx-grid"
653
- data-grid=${this.gridId}
654
- data-grid-mode=${this.mode}
655
- ?data-grid-select=${selectVisible}
438
+ @pointerdown=${this.handlePointerDown}
439
+ @pointerup=${this.handlePointerUp}
440
+ @pointermove=${this.handlePointerMove}
441
+ @focus=${this.handleFocus}
442
+ @blur=${this.handleBlur}
443
+ @keydown=${this.handleKeydown}
656
444
  >
657
445
  <div role="none" class="dx-grid__corner"></div>
658
446
  <div role="none" class="dx-grid__columnheader">
@@ -665,18 +453,15 @@ var DxGrid = class extends LitElement2 {
665
453
  ...Array(visibleCols)
666
454
  ].map((_, c0) => {
667
455
  const c = this.visColMin + c0;
668
- return html2`<div
456
+ return html`<div
669
457
  role="columnheader"
670
458
  ?inert=${c < 0}
671
459
  style="block-size:${this.rowDefault.size}px;grid-column:${c0 + 1}/${c0 + 2};"
672
460
  >
673
461
  <span id=${localChId(c0)}>${colToA1Notation(c)}</span>
674
- ${(this.columns[c]?.resizeable ?? this.columnDefault.resizeable) && html2`<dx-grid-axis-resize-handle
675
- axis="col"
676
- index=${c}
677
- size=${this.colSize(c)}
678
- @dxaxisresizeinternal=${this.handleAxisResizeInternal}
679
- ></dx-grid-axis-resize-handle>`}
462
+ ${(this.columns[c]?.resizeable ?? this.columnDefault.resizeable) && html`<button class="dx-grid__resize-handle" data-dx-grid-action=${`resize-col,${c}`}>
463
+ <span class="sr-only">Resize</span>
464
+ </button>`}
680
465
  </div>`;
681
466
  })}
682
467
  </div>
@@ -692,18 +477,16 @@ var DxGrid = class extends LitElement2 {
692
477
  ...Array(visibleRows)
693
478
  ].map((_, r0) => {
694
479
  const r = this.visRowMin + r0;
695
- return html2`<div role="rowheader" ?inert=${r < 0} style="grid-row:${r0 + 1}/${r0 + 2}">
480
+ return html`<div role="rowheader" ?inert=${r < 0} style="grid-row:${r0 + 1}/${r0 + 2}">
696
481
  <span id=${localRhId(r0)}>${rowToA1Notation(r)}</span>
697
- ${(this.rows[r]?.resizeable ?? this.rowDefault.resizeable) && html2`<dx-grid-axis-resize-handle
698
- axis="row"
699
- index=${r}
700
- size=${this.rowSize(r)}
701
- ></dx-grid-axis-resize-handle>`}
482
+ ${(this.rows[r]?.resizeable ?? this.rowDefault.resizeable) && html`<button class="dx-grid__resize-handle" data-dx-grid-action=${`resize-row,${r}`}>
483
+ <span class="sr-only">Resize</span>
484
+ </button>`}
702
485
  </div>`;
703
486
  })}
704
487
  </div>
705
488
  </div>
706
- <div role="grid" class="dx-grid__viewport" tabindex="0" @wheel=${this.handleWheel} ${ref2(this.viewportRef)}>
489
+ <div role="grid" class="dx-grid__viewport" tabindex="0" @wheel=${this.handleWheel} ${ref(this.viewportRef)}>
707
490
  <div
708
491
  role="none"
709
492
  class="dx-grid__content"
@@ -718,14 +501,10 @@ var DxGrid = class extends LitElement2 {
718
501
  const c = c0 + this.visColMin;
719
502
  const r = r0 + this.visRowMin;
720
503
  const cell = this.cell(c, r);
721
- const active = this.focusActive && this.focusedCell.col === c && this.focusedCell.row === r;
722
- const selected = c >= selectColMin && c <= selectColMax && r >= selectRowMin && r <= selectRowMax;
723
- return html2`<div
504
+ return html`<div
724
505
  role="gridcell"
725
506
  tabindex="0"
726
507
  ?inert=${c < 0 || r < 0}
727
- ?aria-selected=${selected}
728
- class=${cell || active ? (cell?.className ? cell.className + " " : "") + (active ? "dx-grid__cell--active" : "") : nothing}
729
508
  aria-rowindex=${r}
730
509
  aria-colindex=${c}
731
510
  data-dx-grid-action="cell"
@@ -748,18 +527,6 @@ var DxGrid = class extends LitElement2 {
748
527
  </div>`;
749
528
  }
750
529
  firstUpdated() {
751
- if (this.getCells) {
752
- this.cells = this.getCells({
753
- start: {
754
- col: this.visColMin,
755
- row: this.visRowMin
756
- },
757
- end: {
758
- col: this.visColMax,
759
- row: this.visRowMax
760
- }
761
- });
762
- }
763
530
  this.observer.observe(this.viewportRef.value);
764
531
  this.colSizes = Object.entries(this.columns).reduce((acc, [colId, colMeta]) => {
765
532
  if (colMeta?.size) {
@@ -774,20 +541,6 @@ var DxGrid = class extends LitElement2 {
774
541
  return acc;
775
542
  }, {});
776
543
  }
777
- willUpdate(changedProperties) {
778
- if (this.getCells && (changedProperties.has("initialCells") || changedProperties.has("visColMin") || changedProperties.has("visColMax") || changedProperties.has("visRowMin") || changedProperties.has("visRowMax"))) {
779
- this.cells = this.getCells({
780
- start: {
781
- col: this.visColMin,
782
- row: this.visRowMin
783
- },
784
- end: {
785
- col: this.visColMax,
786
- row: this.visRowMax
787
- }
788
- });
789
- }
790
- }
791
544
  updated(changedProperties) {
792
545
  if (this.focusActive && (changedProperties.has("visRowMin") || changedProperties.has("visColMin") || changedProperties.has("focusedCell"))) {
793
546
  this.refocus();
@@ -803,134 +556,118 @@ var DxGrid = class extends LitElement2 {
803
556
  return this;
804
557
  }
805
558
  };
806
- _ts_decorate2([
807
- property2({
808
- type: String
809
- })
810
- ], DxGrid.prototype, "gridId", void 0);
811
- _ts_decorate2([
812
- property2({
559
+ _ts_decorate([
560
+ property({
813
561
  type: Object
814
562
  })
815
563
  ], DxGrid.prototype, "rowDefault", void 0);
816
- _ts_decorate2([
817
- property2({
564
+ _ts_decorate([
565
+ property({
818
566
  type: Object
819
567
  })
820
568
  ], DxGrid.prototype, "columnDefault", void 0);
821
- _ts_decorate2([
822
- property2({
569
+ _ts_decorate([
570
+ property({
823
571
  type: Object
824
572
  })
825
573
  ], DxGrid.prototype, "rows", void 0);
826
- _ts_decorate2([
827
- property2({
574
+ _ts_decorate([
575
+ property({
828
576
  type: Object
829
577
  })
830
578
  ], DxGrid.prototype, "columns", void 0);
831
- _ts_decorate2([
832
- property2({
579
+ _ts_decorate([
580
+ property({
833
581
  type: Object
834
582
  })
835
- ], DxGrid.prototype, "initialCells", void 0);
836
- _ts_decorate2([
837
- property2({
583
+ ], DxGrid.prototype, "cells", void 0);
584
+ _ts_decorate([
585
+ property({
838
586
  type: String
839
587
  })
840
588
  ], DxGrid.prototype, "mode", void 0);
841
- _ts_decorate2([
842
- state()
843
- ], DxGrid.prototype, "cells", void 0);
844
- _ts_decorate2([
589
+ _ts_decorate([
845
590
  state()
846
591
  ], DxGrid.prototype, "posInline", void 0);
847
- _ts_decorate2([
592
+ _ts_decorate([
848
593
  state()
849
594
  ], DxGrid.prototype, "posBlock", void 0);
850
- _ts_decorate2([
595
+ _ts_decorate([
851
596
  state()
852
597
  ], DxGrid.prototype, "sizeInline", void 0);
853
- _ts_decorate2([
598
+ _ts_decorate([
854
599
  state()
855
600
  ], DxGrid.prototype, "sizeBlock", void 0);
856
- _ts_decorate2([
601
+ _ts_decorate([
857
602
  state()
858
603
  ], DxGrid.prototype, "overscanInline", void 0);
859
- _ts_decorate2([
604
+ _ts_decorate([
860
605
  state()
861
606
  ], DxGrid.prototype, "overscanBlock", void 0);
862
- _ts_decorate2([
607
+ _ts_decorate([
863
608
  state()
864
609
  ], DxGrid.prototype, "binInlineMin", void 0);
865
- _ts_decorate2([
610
+ _ts_decorate([
866
611
  state()
867
612
  ], DxGrid.prototype, "binInlineMax", void 0);
868
- _ts_decorate2([
613
+ _ts_decorate([
869
614
  state()
870
615
  ], DxGrid.prototype, "binBlockMin", void 0);
871
- _ts_decorate2([
616
+ _ts_decorate([
872
617
  state()
873
618
  ], DxGrid.prototype, "binBlockMax", void 0);
874
- _ts_decorate2([
619
+ _ts_decorate([
875
620
  state()
876
621
  ], DxGrid.prototype, "visColMin", void 0);
877
- _ts_decorate2([
622
+ _ts_decorate([
878
623
  state()
879
624
  ], DxGrid.prototype, "visColMax", void 0);
880
- _ts_decorate2([
625
+ _ts_decorate([
881
626
  state()
882
627
  ], DxGrid.prototype, "visRowMin", void 0);
883
- _ts_decorate2([
628
+ _ts_decorate([
884
629
  state()
885
630
  ], DxGrid.prototype, "visRowMax", void 0);
886
- _ts_decorate2([
631
+ _ts_decorate([
887
632
  state()
888
633
  ], DxGrid.prototype, "templateColumns", void 0);
889
- _ts_decorate2([
634
+ _ts_decorate([
890
635
  state()
891
636
  ], DxGrid.prototype, "templateRows", void 0);
892
- _ts_decorate2([
893
- state()
894
- ], DxGrid.prototype, "pointer", void 0);
895
- _ts_decorate2([
637
+ _ts_decorate([
896
638
  state()
897
639
  ], DxGrid.prototype, "colSizes", void 0);
898
- _ts_decorate2([
640
+ _ts_decorate([
899
641
  state()
900
642
  ], DxGrid.prototype, "rowSizes", void 0);
901
- _ts_decorate2([
902
- state()
903
- ], DxGrid.prototype, "focusActive", void 0);
904
- _ts_decorate2([
643
+ _ts_decorate([
905
644
  state()
906
- ], DxGrid.prototype, "focusedCell", void 0);
907
- _ts_decorate2([
645
+ ], DxGrid.prototype, "resizing", void 0);
646
+ _ts_decorate([
908
647
  state()
909
- ], DxGrid.prototype, "selectionStart", void 0);
910
- _ts_decorate2([
648
+ ], DxGrid.prototype, "observer", void 0);
649
+ _ts_decorate([
911
650
  state()
912
- ], DxGrid.prototype, "selectionEnd", void 0);
913
- _ts_decorate2([
651
+ ], DxGrid.prototype, "focusedCell", void 0);
652
+ _ts_decorate([
914
653
  state()
915
- ], DxGrid.prototype, "observer", void 0);
916
- _ts_decorate2([
654
+ ], DxGrid.prototype, "focusActive", void 0);
655
+ _ts_decorate([
917
656
  eventOptions({
918
657
  capture: true
919
658
  })
920
659
  ], DxGrid.prototype, "handleFocus", null);
921
- _ts_decorate2([
660
+ _ts_decorate([
922
661
  eventOptions({
923
662
  capture: true
924
663
  })
925
664
  ], DxGrid.prototype, "handleBlur", null);
926
- DxGrid = _ts_decorate2([
927
- customElement2("dx-grid")
665
+ DxGrid = _ts_decorate([
666
+ customElement("dx-grid")
928
667
  ], DxGrid);
929
668
  export {
930
669
  DxAxisResize,
931
- DxAxisResizeInternal,
932
670
  DxEditRequest,
933
- DxGrid,
934
- DxGridCellsSelect
671
+ DxGrid
935
672
  };
936
673
  //# sourceMappingURL=index.mjs.map