@dxos/lit-grid 0.6.12-main.c1d977f → 0.6.12-main.c4a728f
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.
- package/dist/lib/browser/index.mjs +308 -811
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/types/src/dx-grid.d.ts +6 -47
- package/dist/types/src/dx-grid.d.ts.map +1 -1
- package/dist/types/src/dx-grid.lit-stories.d.ts +1 -23
- package/dist/types/src/dx-grid.lit-stories.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +13 -57
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/types/src/util.d.ts +2 -4
- package/dist/types/src/util.d.ts.map +1 -1
- package/package.json +1 -2
- package/src/dx-grid.lit-stories.ts +16 -140
- package/src/dx-grid.pcss +67 -43
- package/src/dx-grid.ts +287 -708
- package/src/types.ts +11 -72
- package/src/util.ts +2 -18
- package/dist/types/src/dx-grid-axis-resize-handle.d.ts +0 -16
- package/dist/types/src/dx-grid-axis-resize-handle.d.ts.map +0 -1
- package/src/dx-grid-axis-resize-handle.ts +0 -87
|
@@ -1,51 +1,21 @@
|
|
|
1
1
|
// packages/ui/lit-grid/src/dx-grid.ts
|
|
2
|
-
import { LitElement
|
|
3
|
-
import { customElement
|
|
4
|
-
import { ref
|
|
5
|
-
import { styleMap } from "lit/directives/style-map.js";
|
|
6
|
-
|
|
7
|
-
// packages/ui/lit-grid/src/dx-grid-axis-resize-handle.ts
|
|
8
|
-
import { draggable } from "@atlaskit/pragmatic-drag-and-drop/element/adapter";
|
|
9
|
-
import { disableNativeDragPreview } from "@atlaskit/pragmatic-drag-and-drop/element/disable-native-drag-preview";
|
|
10
|
-
import { preventUnhandled } from "@atlaskit/pragmatic-drag-and-drop/prevent-unhandled";
|
|
11
|
-
import { html, LitElement } from "lit";
|
|
12
|
-
import { customElement, property } from "lit/decorators.js";
|
|
13
|
-
import { ref } from "lit/directives/ref.js";
|
|
2
|
+
import { LitElement, html, nothing } from "lit";
|
|
3
|
+
import { customElement, state, property, eventOptions } from "lit/decorators.js";
|
|
4
|
+
import { ref, createRef } from "lit/directives/ref.js";
|
|
14
5
|
|
|
15
6
|
// packages/ui/lit-grid/src/util.ts
|
|
16
7
|
var separator = ",";
|
|
17
8
|
var toCellIndex = (cellCoords) => `${cellCoords.col}${separator}${cellCoords.row}`;
|
|
18
|
-
var colToA1Notation = (col) => {
|
|
19
|
-
return (col >= 26 ? String.fromCharCode("A".charCodeAt(0) + Math.floor(col / 26) - 1) : "") + String.fromCharCode("A".charCodeAt(0) + col % 26);
|
|
20
|
-
};
|
|
21
|
-
var rowToA1Notation = (row) => {
|
|
22
|
-
return `${row + 1}`;
|
|
23
|
-
};
|
|
24
9
|
|
|
25
10
|
// packages/ui/lit-grid/src/types.ts
|
|
26
11
|
var DxAxisResize = class extends Event {
|
|
27
12
|
constructor(props) {
|
|
28
13
|
super("dx-axis-resize");
|
|
29
14
|
this.axis = props.axis;
|
|
30
|
-
this.plane = props.plane;
|
|
31
15
|
this.index = props.index;
|
|
32
16
|
this.size = props.size;
|
|
33
17
|
}
|
|
34
18
|
};
|
|
35
|
-
var DxAxisResizeInternal = class extends Event {
|
|
36
|
-
constructor(props) {
|
|
37
|
-
super("dx-axis-resize-internal", {
|
|
38
|
-
composed: true,
|
|
39
|
-
bubbles: true
|
|
40
|
-
});
|
|
41
|
-
this.axis = props.axis;
|
|
42
|
-
this.plane = props.plane;
|
|
43
|
-
this.index = props.index;
|
|
44
|
-
this.size = props.size;
|
|
45
|
-
this.delta = props.delta;
|
|
46
|
-
this.state = props.state;
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
19
|
var DxEditRequest = class extends Event {
|
|
50
20
|
constructor(props) {
|
|
51
21
|
super("dx-edit-request");
|
|
@@ -66,137 +36,26 @@ var DxGridCellsSelect = class extends Event {
|
|
|
66
36
|
}
|
|
67
37
|
};
|
|
68
38
|
|
|
69
|
-
// packages/ui/lit-grid/src/dx-grid-axis-resize-handle.ts
|
|
70
|
-
function _ts_decorate(decorators, target, key, desc) {
|
|
71
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
72
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
73
|
-
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;
|
|
74
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
75
|
-
}
|
|
76
|
-
var DxGridAxisResizeHandle = class extends LitElement {
|
|
77
|
-
constructor() {
|
|
78
|
-
super(...arguments);
|
|
79
|
-
this.axis = "row";
|
|
80
|
-
this.plane = "grid";
|
|
81
|
-
this.index = "-1";
|
|
82
|
-
this.size = 128;
|
|
83
|
-
this.dragStartSize = 128;
|
|
84
|
-
this.cleanup = null;
|
|
85
|
-
}
|
|
86
|
-
render() {
|
|
87
|
-
return html`<button class="dx-grid__resize-handle" data-dx-grid-axis=${this.axis} ${ref(this.mount)}>
|
|
88
|
-
<span class="sr-only">Resize</span>
|
|
89
|
-
</button>`;
|
|
90
|
-
}
|
|
91
|
-
dispatchResize(location, state2) {
|
|
92
|
-
const client = this.axis === "row" ? "clientY" : "clientX";
|
|
93
|
-
const event = new DxAxisResizeInternal({
|
|
94
|
-
axis: this.axis,
|
|
95
|
-
plane: this.plane,
|
|
96
|
-
size: this.dragStartSize,
|
|
97
|
-
index: this.index,
|
|
98
|
-
delta: location.current.input[client] - location.initial.input[client],
|
|
99
|
-
state: state2
|
|
100
|
-
});
|
|
101
|
-
this.dispatchEvent(event);
|
|
102
|
-
}
|
|
103
|
-
mount(element) {
|
|
104
|
-
this.cleanup?.();
|
|
105
|
-
const host = this;
|
|
106
|
-
if (element) {
|
|
107
|
-
this.cleanup = draggable({
|
|
108
|
-
element,
|
|
109
|
-
onGenerateDragPreview: ({ nativeSetDragImage }) => {
|
|
110
|
-
disableNativeDragPreview({
|
|
111
|
-
nativeSetDragImage
|
|
112
|
-
});
|
|
113
|
-
preventUnhandled.start();
|
|
114
|
-
},
|
|
115
|
-
onDragStart() {
|
|
116
|
-
host.dragStartSize = host.size;
|
|
117
|
-
},
|
|
118
|
-
onDrag({ location }) {
|
|
119
|
-
host.dispatchResize(location, "dragging");
|
|
120
|
-
},
|
|
121
|
-
onDrop({ location }) {
|
|
122
|
-
host.dispatchResize(location, "dropped");
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
disconnectedCallback() {
|
|
128
|
-
super.disconnectedCallback();
|
|
129
|
-
this.cleanup?.();
|
|
130
|
-
}
|
|
131
|
-
createRenderRoot() {
|
|
132
|
-
return this;
|
|
133
|
-
}
|
|
134
|
-
};
|
|
135
|
-
_ts_decorate([
|
|
136
|
-
property({
|
|
137
|
-
type: String
|
|
138
|
-
})
|
|
139
|
-
], DxGridAxisResizeHandle.prototype, "axis", void 0);
|
|
140
|
-
_ts_decorate([
|
|
141
|
-
property({
|
|
142
|
-
type: String
|
|
143
|
-
})
|
|
144
|
-
], DxGridAxisResizeHandle.prototype, "plane", void 0);
|
|
145
|
-
_ts_decorate([
|
|
146
|
-
property({
|
|
147
|
-
type: String
|
|
148
|
-
})
|
|
149
|
-
], DxGridAxisResizeHandle.prototype, "index", void 0);
|
|
150
|
-
_ts_decorate([
|
|
151
|
-
property({
|
|
152
|
-
type: Number
|
|
153
|
-
})
|
|
154
|
-
], DxGridAxisResizeHandle.prototype, "size", void 0);
|
|
155
|
-
DxGridAxisResizeHandle = _ts_decorate([
|
|
156
|
-
customElement("dx-grid-axis-resize-handle")
|
|
157
|
-
], DxGridAxisResizeHandle);
|
|
158
|
-
|
|
159
39
|
// packages/ui/lit-grid/src/dx-grid.ts
|
|
160
|
-
function
|
|
40
|
+
function _ts_decorate(decorators, target, key, desc) {
|
|
161
41
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
162
42
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
163
43
|
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;
|
|
164
44
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
165
45
|
}
|
|
166
46
|
var gap = 1;
|
|
167
|
-
var resizeTolerance =
|
|
168
|
-
var selectTolerance = 4;
|
|
47
|
+
var resizeTolerance = 8;
|
|
169
48
|
var overscanCol = 1;
|
|
170
49
|
var overscanRow = 1;
|
|
171
50
|
var sizeColMin = 32;
|
|
172
51
|
var sizeColMax = 1024;
|
|
173
52
|
var sizeRowMin = 16;
|
|
174
53
|
var sizeRowMax = 1024;
|
|
175
|
-
var
|
|
176
|
-
|
|
177
|
-
return Math.hypot(Math.abs(pointer.pageX - pageX), Math.abs(pointer.pageY - pageY)) >= selectTolerance;
|
|
178
|
-
} else {
|
|
179
|
-
return false;
|
|
180
|
-
}
|
|
181
|
-
};
|
|
182
|
-
var selectionProps = (selectionStart, selectionEnd) => {
|
|
183
|
-
const colMin = Math.min(selectionStart.col, selectionEnd.col);
|
|
184
|
-
const colMax = Math.max(selectionStart.col, selectionEnd.col);
|
|
185
|
-
const rowMin = Math.min(selectionStart.row, selectionEnd.row);
|
|
186
|
-
const rowMax = Math.max(selectionStart.row, selectionEnd.row);
|
|
187
|
-
const plane = selectionStart.plane;
|
|
188
|
-
const visible = colMin !== colMax || rowMin !== rowMax;
|
|
189
|
-
return {
|
|
190
|
-
colMin,
|
|
191
|
-
colMax,
|
|
192
|
-
rowMin,
|
|
193
|
-
rowMax,
|
|
194
|
-
plane,
|
|
195
|
-
visible
|
|
196
|
-
};
|
|
54
|
+
var colToA1Notation = (col) => {
|
|
55
|
+
return (col >= 26 ? String.fromCharCode("A".charCodeAt(0) + Math.floor(col / 26) - 1) : "") + String.fromCharCode("A".charCodeAt(0) + col % 26);
|
|
197
56
|
};
|
|
198
|
-
var
|
|
199
|
-
return
|
|
57
|
+
var rowToA1Notation = (row) => {
|
|
58
|
+
return `${row + 1}`;
|
|
200
59
|
};
|
|
201
60
|
var closestAction = (target) => {
|
|
202
61
|
const actionEl = target?.closest("[data-dx-grid-action]") ?? null;
|
|
@@ -216,9 +75,7 @@ var closestCell = (target, actionEl) => {
|
|
|
216
75
|
if (cellElement) {
|
|
217
76
|
const col = parseInt(cellElement.getAttribute("aria-colindex") ?? "never");
|
|
218
77
|
const row = parseInt(cellElement.getAttribute("aria-rowindex") ?? "never");
|
|
219
|
-
const plane = cellElement.closest("[data-dx-grid-plane]")?.getAttribute("data-dx-grid-plane") ?? "grid";
|
|
220
78
|
return {
|
|
221
|
-
plane,
|
|
222
79
|
col,
|
|
223
80
|
row
|
|
224
81
|
};
|
|
@@ -226,92 +83,30 @@ var closestCell = (target, actionEl) => {
|
|
|
226
83
|
return null;
|
|
227
84
|
}
|
|
228
85
|
};
|
|
229
|
-
var
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
return "frozenRowsStart";
|
|
235
|
-
case "fixedEndStart":
|
|
236
|
-
case "fixedEndEnd":
|
|
237
|
-
case "frozenRowsEnd":
|
|
238
|
-
return "frozenRowsEnd";
|
|
239
|
-
default:
|
|
240
|
-
return "grid";
|
|
241
|
-
}
|
|
242
|
-
};
|
|
243
|
-
var resolveColPlane = (plane) => {
|
|
244
|
-
switch (plane) {
|
|
245
|
-
case "fixedStartStart":
|
|
246
|
-
case "fixedEndStart":
|
|
247
|
-
case "frozenColsStart":
|
|
248
|
-
return "frozenColsStart";
|
|
249
|
-
case "fixedStartEnd":
|
|
250
|
-
case "fixedEndEnd":
|
|
251
|
-
case "frozenColsEnd":
|
|
252
|
-
return "frozenColsEnd";
|
|
253
|
-
default:
|
|
254
|
-
return "grid";
|
|
255
|
-
}
|
|
256
|
-
};
|
|
257
|
-
var resolveResizePlane = (resizeAxis, cellPlane) => {
|
|
258
|
-
switch (cellPlane) {
|
|
259
|
-
case "fixedStartStart":
|
|
260
|
-
return resizeAxis === "col" ? "frozenColsStart" : "frozenRowsStart";
|
|
261
|
-
case "fixedStartEnd":
|
|
262
|
-
return resizeAxis === "col" ? "frozenColsEnd" : "frozenRowsStart";
|
|
263
|
-
case "fixedEndStart":
|
|
264
|
-
return resizeAxis === "col" ? "frozenColsStart" : "frozenRowsEnd";
|
|
265
|
-
case "fixedEndEnd":
|
|
266
|
-
return resizeAxis === "col" ? "frozenColsEnd" : "frozenRowsEnd";
|
|
267
|
-
case "frozenColsStart":
|
|
268
|
-
case "frozenColsEnd":
|
|
269
|
-
return resizeAxis === "col" ? cellPlane : "grid";
|
|
270
|
-
case "frozenRowsStart":
|
|
271
|
-
case "frozenRowsEnd":
|
|
272
|
-
return resizeAxis === "row" ? cellPlane : "grid";
|
|
273
|
-
default:
|
|
274
|
-
return cellPlane;
|
|
275
|
-
}
|
|
276
|
-
};
|
|
277
|
-
var isSameCell = (a, b) => a && b && a.plane === b.plane && Number.isFinite(a.col) && Number.isFinite(a.row) && a.col === b.col && a.row === b.row;
|
|
278
|
-
var defaultRowSize = 32;
|
|
279
|
-
var defaultColSize = 180;
|
|
280
|
-
var DxGrid = class extends LitElement2 {
|
|
86
|
+
var isSameCell = (a, b) => a && b && Number.isFinite(a.col) && Number.isFinite(a.row) && a.col === b.col && a.row === b.row;
|
|
87
|
+
var localChId = (c0) => `ch--${c0}`;
|
|
88
|
+
var localRhId = (r0) => `rh--${r0}`;
|
|
89
|
+
var getPage = (axis, event) => axis === "col" ? event.pageX : event.pageY;
|
|
90
|
+
var DxGrid = class extends LitElement {
|
|
281
91
|
constructor() {
|
|
282
|
-
super();
|
|
92
|
+
super(...arguments);
|
|
283
93
|
this.gridId = "default-grid-id";
|
|
284
94
|
this.rowDefault = {
|
|
285
|
-
|
|
286
|
-
size: defaultRowSize
|
|
287
|
-
}
|
|
95
|
+
size: 32
|
|
288
96
|
};
|
|
289
97
|
this.columnDefault = {
|
|
290
|
-
|
|
291
|
-
size: defaultColSize
|
|
292
|
-
}
|
|
293
|
-
};
|
|
294
|
-
this.rows = {
|
|
295
|
-
grid: {}
|
|
296
|
-
};
|
|
297
|
-
this.columns = {
|
|
298
|
-
grid: {}
|
|
299
|
-
};
|
|
300
|
-
this.initialCells = {
|
|
301
|
-
grid: {}
|
|
98
|
+
size: 180
|
|
302
99
|
};
|
|
100
|
+
this.rows = {};
|
|
101
|
+
this.columns = {};
|
|
102
|
+
this.initialCells = {};
|
|
303
103
|
this.mode = "browse";
|
|
304
|
-
this.limitColumns = Infinity;
|
|
305
|
-
this.limitRows = Infinity;
|
|
306
|
-
this.frozen = {};
|
|
307
104
|
/**
|
|
308
105
|
* When this function is defined, it is used first to try to get a value for a cell, and otherwise will fall back
|
|
309
106
|
* to `cells`.
|
|
310
107
|
*/
|
|
311
108
|
this.getCells = null;
|
|
312
|
-
this.cells = {
|
|
313
|
-
grid: {}
|
|
314
|
-
};
|
|
109
|
+
this.cells = {};
|
|
315
110
|
//
|
|
316
111
|
// `pos`, short for ‘position’, is the position in pixels of the viewport from the origin.
|
|
317
112
|
//
|
|
@@ -331,9 +126,9 @@ var DxGrid = class extends LitElement2 {
|
|
|
331
126
|
// `bin`, not short for anything, is the range in pixels within which virtualization does not need to reassess.
|
|
332
127
|
//
|
|
333
128
|
this.binInlineMin = 0;
|
|
334
|
-
this.binInlineMax =
|
|
129
|
+
this.binInlineMax = this.colSize(0);
|
|
335
130
|
this.binBlockMin = 0;
|
|
336
|
-
this.binBlockMax =
|
|
131
|
+
this.binBlockMax = this.rowSize(0);
|
|
337
132
|
//
|
|
338
133
|
// `vis`, short for ‘visible’, is the range in numeric index of the columns or rows which should be rendered within
|
|
339
134
|
// the viewport. These start with naïve values that are updated before first contentful render.
|
|
@@ -345,57 +140,48 @@ var DxGrid = class extends LitElement2 {
|
|
|
345
140
|
//
|
|
346
141
|
// `template` is the rendered value of `grid-{axis}-template`.
|
|
347
142
|
//
|
|
348
|
-
this.
|
|
349
|
-
this.
|
|
350
|
-
this.templatefrozenColsEnd = "";
|
|
351
|
-
this.templateGridRows = "0";
|
|
352
|
-
this.templatefrozenRowsStart = "";
|
|
353
|
-
this.templatefrozenRowsEnd = "";
|
|
143
|
+
this.templateColumns = `${this.colSize(0)}px`;
|
|
144
|
+
this.templateRows = `${this.rowSize(0)}px`;
|
|
354
145
|
//
|
|
355
146
|
// Focus, selection, and resize states
|
|
356
147
|
//
|
|
357
148
|
this.pointer = null;
|
|
358
|
-
this.colSizes = {
|
|
359
|
-
|
|
360
|
-
};
|
|
361
|
-
this.rowSizes = {
|
|
362
|
-
grid: {}
|
|
363
|
-
};
|
|
149
|
+
this.colSizes = {};
|
|
150
|
+
this.rowSizes = {};
|
|
364
151
|
this.focusActive = false;
|
|
365
152
|
this.focusedCell = {
|
|
366
|
-
plane: "grid",
|
|
367
153
|
col: 0,
|
|
368
154
|
row: 0
|
|
369
155
|
};
|
|
370
156
|
this.selectionStart = {
|
|
371
|
-
plane: "grid",
|
|
372
157
|
col: 0,
|
|
373
158
|
row: 0
|
|
374
159
|
};
|
|
375
160
|
this.selectionEnd = {
|
|
376
|
-
plane: "grid",
|
|
377
161
|
col: 0,
|
|
378
162
|
row: 0
|
|
379
163
|
};
|
|
380
|
-
//
|
|
381
|
-
// Limits
|
|
382
|
-
//
|
|
383
|
-
this.intrinsicInlineSize = Infinity;
|
|
384
|
-
this.intrinsicBlockSize = Infinity;
|
|
385
164
|
this.handlePointerDown = (event) => {
|
|
386
165
|
if (event.isPrimary) {
|
|
387
166
|
const { action, actionEl } = closestAction(event.target);
|
|
388
167
|
if (action) {
|
|
389
|
-
if (action === "
|
|
168
|
+
if (action.startsWith("resize") && this.mode === "browse") {
|
|
169
|
+
const [resize, index] = action.split(",");
|
|
170
|
+
const [_, axis] = resize.split("-");
|
|
171
|
+
this.pointer = {
|
|
172
|
+
state: "resizing",
|
|
173
|
+
axis,
|
|
174
|
+
size: axis === "col" ? this.colSize(index) : this.rowSize(index),
|
|
175
|
+
page: getPage(axis, event),
|
|
176
|
+
index
|
|
177
|
+
};
|
|
178
|
+
} else if (action === "cell") {
|
|
390
179
|
const cellCoords = closestCell(event.target, actionEl);
|
|
391
180
|
if (cellCoords) {
|
|
392
181
|
this.pointer = {
|
|
393
|
-
state: "
|
|
394
|
-
pageX: event.pageX,
|
|
395
|
-
pageY: event.pageY
|
|
182
|
+
state: "selecting"
|
|
396
183
|
};
|
|
397
184
|
this.selectionStart = cellCoords;
|
|
398
|
-
this.selectionEnd = cellCoords;
|
|
399
185
|
}
|
|
400
186
|
if (this.mode === "edit") {
|
|
401
187
|
event.preventDefault();
|
|
@@ -409,24 +195,46 @@ var DxGrid = class extends LitElement2 {
|
|
|
409
195
|
}
|
|
410
196
|
};
|
|
411
197
|
this.handlePointerUp = (event) => {
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
198
|
+
if (this.pointer?.state === "resizing") {
|
|
199
|
+
const resizeEvent = new DxAxisResize({
|
|
200
|
+
axis: this.pointer.axis,
|
|
201
|
+
index: this.pointer.index,
|
|
202
|
+
size: this[this.pointer.axis === "col" ? "colSize" : "rowSize"](this.pointer.index)
|
|
203
|
+
});
|
|
204
|
+
this.dispatchEvent(resizeEvent);
|
|
205
|
+
} else {
|
|
206
|
+
const cell = closestCell(event.target);
|
|
207
|
+
if (cell) {
|
|
208
|
+
this.selectionEnd = cell;
|
|
209
|
+
this.dispatchEvent(new DxGridCellsSelect({
|
|
210
|
+
start: this.selectionStart,
|
|
211
|
+
end: this.selectionEnd
|
|
212
|
+
}));
|
|
213
|
+
}
|
|
419
214
|
}
|
|
420
215
|
this.pointer = null;
|
|
421
216
|
};
|
|
422
217
|
this.handlePointerMove = (event) => {
|
|
423
|
-
if (
|
|
424
|
-
this.pointer
|
|
425
|
-
|
|
426
|
-
|
|
218
|
+
if (this.pointer?.state === "resizing") {
|
|
219
|
+
const delta = getPage(this.pointer.axis, event) - this.pointer.page;
|
|
220
|
+
if (this.pointer.axis === "col") {
|
|
221
|
+
const nextSize = Math.max(sizeColMin, Math.min(sizeColMax, this.pointer.size + delta));
|
|
222
|
+
this.colSizes = {
|
|
223
|
+
...this.colSizes,
|
|
224
|
+
[this.pointer.index]: nextSize
|
|
225
|
+
};
|
|
226
|
+
this.updateVisInline();
|
|
227
|
+
} else {
|
|
228
|
+
const nextSize = Math.max(sizeRowMin, Math.min(sizeRowMax, this.pointer.size + delta));
|
|
229
|
+
this.rowSizes = {
|
|
230
|
+
...this.rowSizes,
|
|
231
|
+
[this.pointer.index]: nextSize
|
|
232
|
+
};
|
|
233
|
+
this.updateVisBlock();
|
|
234
|
+
}
|
|
427
235
|
} else if (this.pointer?.state === "selecting") {
|
|
428
236
|
const cell = closestCell(event.target);
|
|
429
|
-
if (cell &&
|
|
237
|
+
if (cell && (cell.col !== this.selectionEnd.col || cell.row !== this.selectionEnd.row)) {
|
|
430
238
|
this.selectionEnd = cell;
|
|
431
239
|
}
|
|
432
240
|
}
|
|
@@ -443,40 +251,19 @@ var DxGrid = class extends LitElement2 {
|
|
|
443
251
|
this.sizeInline = inlineSize;
|
|
444
252
|
this.sizeBlock = blockSize;
|
|
445
253
|
this.updateVis();
|
|
446
|
-
queueMicrotask(() => this.updatePos());
|
|
447
254
|
}
|
|
448
255
|
});
|
|
449
256
|
this.viewportRef = createRef();
|
|
450
|
-
this.maybeUpdateVisInline = () => {
|
|
451
|
-
if (this.posInline < this.binInlineMin || this.posInline >= this.binInlineMax) {
|
|
452
|
-
this.updateVisInline();
|
|
453
|
-
}
|
|
454
|
-
};
|
|
455
|
-
this.maybeUpdateVisBlock = () => {
|
|
456
|
-
if (this.posBlock < this.binBlockMin || this.posBlock >= this.binBlockMax) {
|
|
457
|
-
this.updateVisBlock();
|
|
458
|
-
}
|
|
459
|
-
};
|
|
460
257
|
this.handleWheel = ({ deltaX, deltaY }) => {
|
|
461
258
|
if (this.mode === "browse") {
|
|
462
|
-
this.
|
|
259
|
+
this.posInline = Math.max(0, this.posInline + deltaX);
|
|
260
|
+
this.posBlock = Math.max(0, this.posBlock + deltaY);
|
|
261
|
+
if (this.posInline >= this.binInlineMin && this.posInline < this.binInlineMax && this.posBlock >= this.binBlockMin && this.posBlock < this.binBlockMax) {
|
|
262
|
+
} else {
|
|
263
|
+
this.updateVis();
|
|
264
|
+
}
|
|
463
265
|
}
|
|
464
266
|
};
|
|
465
|
-
this.addEventListener("dx-axis-resize-internal", this.handleAxisResizeInternal);
|
|
466
|
-
this.addEventListener("wheel", this.handleWheel, {
|
|
467
|
-
passive: true
|
|
468
|
-
});
|
|
469
|
-
this.addEventListener("pointerdown", this.handlePointerDown);
|
|
470
|
-
this.addEventListener("pointermove", this.handlePointerMove);
|
|
471
|
-
this.addEventListener("pointerup", this.handlePointerUp);
|
|
472
|
-
this.addEventListener("pointerleave", this.handlePointerUp);
|
|
473
|
-
this.addEventListener("focus", this.handleFocus, {
|
|
474
|
-
capture: true
|
|
475
|
-
});
|
|
476
|
-
this.addEventListener("blur", this.handleBlur, {
|
|
477
|
-
capture: true
|
|
478
|
-
});
|
|
479
|
-
this.addEventListener("keydown", this.handleKeydown);
|
|
480
267
|
}
|
|
481
268
|
//
|
|
482
269
|
// Primary pointer and keyboard handlers
|
|
@@ -495,7 +282,7 @@ var DxGrid = class extends LitElement2 {
|
|
|
495
282
|
case "ArrowDown":
|
|
496
283
|
this.focusedCell = {
|
|
497
284
|
...this.focusedCell,
|
|
498
|
-
row:
|
|
285
|
+
row: this.focusedCell.row + 1
|
|
499
286
|
};
|
|
500
287
|
break;
|
|
501
288
|
case "ArrowUp":
|
|
@@ -507,7 +294,7 @@ var DxGrid = class extends LitElement2 {
|
|
|
507
294
|
case "ArrowRight":
|
|
508
295
|
this.focusedCell = {
|
|
509
296
|
...this.focusedCell,
|
|
510
|
-
col:
|
|
297
|
+
col: this.focusedCell.col + 1
|
|
511
298
|
};
|
|
512
299
|
break;
|
|
513
300
|
case "ArrowLeft":
|
|
@@ -541,26 +328,21 @@ var DxGrid = class extends LitElement2 {
|
|
|
541
328
|
//
|
|
542
329
|
// Accessors
|
|
543
330
|
//
|
|
544
|
-
colSize(c
|
|
545
|
-
|
|
546
|
-
return this.colSizes?.[resolvedPlane]?.[c] ?? this.columnDefault[resolvedPlane]?.size ?? defaultColSize;
|
|
331
|
+
colSize(c) {
|
|
332
|
+
return this.colSizes?.[c] ?? this.columnDefault.size;
|
|
547
333
|
}
|
|
548
|
-
rowSize(r
|
|
549
|
-
|
|
550
|
-
return this.rowSizes?.[resolvedPlane]?.[r] ?? this.rowDefault[resolvedPlane]?.size ?? defaultRowSize;
|
|
334
|
+
rowSize(r) {
|
|
335
|
+
return this.rowSizes?.[r] ?? this.rowDefault.size;
|
|
551
336
|
}
|
|
552
|
-
cell(c, r
|
|
337
|
+
cell(c, r) {
|
|
553
338
|
const index = `${c}${separator}${r}`;
|
|
554
|
-
return this.cells
|
|
555
|
-
}
|
|
556
|
-
cellActive(c, r, plane) {
|
|
557
|
-
return this.focusActive && this.focusedCell.plane === plane && this.focusedCell.col === c && this.focusedCell.row === r;
|
|
339
|
+
return this.cells[index] ?? this.initialCells[index];
|
|
558
340
|
}
|
|
559
341
|
focusedCellBox() {
|
|
560
342
|
const cellElement = this.focusedCellElement();
|
|
561
343
|
const cellSize = {
|
|
562
|
-
inlineSize: this.colSize(this.focusedCell.col
|
|
563
|
-
blockSize: this.rowSize(this.focusedCell.row
|
|
344
|
+
inlineSize: this.colSize(this.focusedCell.col),
|
|
345
|
+
blockSize: this.rowSize(this.focusedCell.row)
|
|
564
346
|
};
|
|
565
347
|
if (!cellElement) {
|
|
566
348
|
return {
|
|
@@ -580,167 +362,60 @@ var DxGrid = class extends LitElement2 {
|
|
|
580
362
|
...cellSize
|
|
581
363
|
};
|
|
582
364
|
}
|
|
583
|
-
updatePosInline(inline) {
|
|
584
|
-
this.posInline = Math.max(0, Math.min(this.intrinsicInlineSize - this.sizeInline, inline ?? this.posInline));
|
|
585
|
-
this.maybeUpdateVisInline();
|
|
586
|
-
}
|
|
587
|
-
updatePosBlock(block) {
|
|
588
|
-
this.posBlock = Math.max(0, Math.min(this.intrinsicBlockSize - this.sizeBlock, block ?? this.posBlock));
|
|
589
|
-
this.maybeUpdateVisBlock();
|
|
590
|
-
}
|
|
591
|
-
updatePos(inline, block) {
|
|
592
|
-
this.updatePosInline(inline);
|
|
593
|
-
this.updatePosBlock(block);
|
|
594
|
-
}
|
|
595
365
|
updateVisInline() {
|
|
596
366
|
let colIndex = 0;
|
|
597
|
-
let pxInline = this.colSize(colIndex
|
|
367
|
+
let pxInline = this.colSize(colIndex);
|
|
598
368
|
while (pxInline < this.posInline) {
|
|
599
369
|
colIndex += 1;
|
|
600
|
-
pxInline += this.colSize(colIndex
|
|
370
|
+
pxInline += this.colSize(colIndex) + gap;
|
|
601
371
|
}
|
|
602
372
|
this.visColMin = colIndex - overscanCol;
|
|
603
|
-
this.binInlineMin = pxInline - this.colSize(colIndex
|
|
373
|
+
this.binInlineMin = pxInline - this.colSize(colIndex) - gap;
|
|
604
374
|
this.binInlineMax = pxInline + gap;
|
|
605
375
|
this.overscanInline = [
|
|
606
376
|
...Array(overscanCol)
|
|
607
377
|
].reduce((acc, _, c0) => {
|
|
608
|
-
acc += this.colSize(this.visColMin + c0
|
|
378
|
+
acc += this.colSize(this.visColMin + c0);
|
|
609
379
|
return acc;
|
|
610
380
|
}, 0) + gap * (overscanCol - 1);
|
|
611
|
-
while (pxInline < this.binInlineMax + this.sizeInline
|
|
381
|
+
while (pxInline < this.binInlineMax + this.sizeInline + gap) {
|
|
612
382
|
colIndex += 1;
|
|
613
|
-
pxInline += this.colSize(colIndex
|
|
383
|
+
pxInline += this.colSize(colIndex) + gap;
|
|
614
384
|
}
|
|
615
|
-
this.visColMax =
|
|
616
|
-
this.
|
|
385
|
+
this.visColMax = colIndex + overscanCol;
|
|
386
|
+
this.templateColumns = [
|
|
617
387
|
...Array(this.visColMax - this.visColMin)
|
|
618
|
-
].map((_, c0) => `${this.colSize(this.visColMin + c0
|
|
619
|
-
this.templatefrozenColsStart = [
|
|
620
|
-
...Array(this.frozen.frozenColsStart ?? 0)
|
|
621
|
-
].map((_, c0) => `${this.colSize(c0, "frozenColsStart")}px`).join(" ");
|
|
622
|
-
this.templatefrozenColsEnd = [
|
|
623
|
-
...Array(this.frozen.frozenColsEnd ?? 0)
|
|
624
|
-
].map((_, c0) => `${this.colSize(c0, "frozenColsEnd")}px`).join(" ");
|
|
388
|
+
].map((_, c0) => `${this.colSize(this.visColMin + c0)}px`).join(" ");
|
|
625
389
|
}
|
|
626
390
|
updateVisBlock() {
|
|
627
391
|
let rowIndex = 0;
|
|
628
|
-
let pxBlock = this.rowSize(rowIndex
|
|
392
|
+
let pxBlock = this.rowSize(rowIndex);
|
|
629
393
|
while (pxBlock < this.posBlock) {
|
|
630
394
|
rowIndex += 1;
|
|
631
|
-
pxBlock += this.rowSize(rowIndex
|
|
395
|
+
pxBlock += this.rowSize(rowIndex) + gap;
|
|
632
396
|
}
|
|
633
397
|
this.visRowMin = rowIndex - overscanRow;
|
|
634
|
-
this.binBlockMin = pxBlock - this.rowSize(rowIndex
|
|
398
|
+
this.binBlockMin = pxBlock - this.rowSize(rowIndex) - gap;
|
|
635
399
|
this.binBlockMax = pxBlock + gap;
|
|
636
400
|
this.overscanBlock = [
|
|
637
401
|
...Array(overscanRow)
|
|
638
402
|
].reduce((acc, _, r0) => {
|
|
639
|
-
acc += this.rowSize(this.visRowMin + r0
|
|
403
|
+
acc += this.rowSize(this.visRowMin + r0);
|
|
640
404
|
return acc;
|
|
641
405
|
}, 0) + gap * (overscanRow - 1);
|
|
642
|
-
while (pxBlock < this.binBlockMax + this.sizeBlock
|
|
406
|
+
while (pxBlock < this.binBlockMax + this.sizeBlock) {
|
|
643
407
|
rowIndex += 1;
|
|
644
|
-
pxBlock += this.rowSize(rowIndex
|
|
408
|
+
pxBlock += this.rowSize(rowIndex) + gap;
|
|
645
409
|
}
|
|
646
|
-
this.visRowMax =
|
|
647
|
-
this.
|
|
410
|
+
this.visRowMax = rowIndex + overscanRow;
|
|
411
|
+
this.templateRows = [
|
|
648
412
|
...Array(this.visRowMax - this.visRowMin)
|
|
649
|
-
].map((_, r0) => `${this.rowSize(this.visRowMin + r0
|
|
650
|
-
this.templatefrozenRowsStart = [
|
|
651
|
-
...Array(this.frozen.frozenRowsStart ?? 0)
|
|
652
|
-
].map((_, r0) => `${this.rowSize(r0, "frozenRowsStart")}px`).join(" ");
|
|
653
|
-
this.templatefrozenRowsEnd = [
|
|
654
|
-
...Array(this.frozen.frozenRowsEnd ?? 0)
|
|
655
|
-
].map((_, r0) => `${this.rowSize(r0, "frozenRowsEnd")}px`).join(" ");
|
|
413
|
+
].map((_, r0) => `${this.rowSize(this.visRowMin + r0)}px`).join(" ");
|
|
656
414
|
}
|
|
657
415
|
updateVis() {
|
|
658
416
|
this.updateVisInline();
|
|
659
417
|
this.updateVisBlock();
|
|
660
418
|
}
|
|
661
|
-
updateCells(includeFixed) {
|
|
662
|
-
this.cells.grid = this.getCells({
|
|
663
|
-
start: {
|
|
664
|
-
col: this.visColMin,
|
|
665
|
-
row: this.visRowMin
|
|
666
|
-
},
|
|
667
|
-
end: {
|
|
668
|
-
col: this.visColMax,
|
|
669
|
-
row: this.visRowMax
|
|
670
|
-
}
|
|
671
|
-
}, "grid");
|
|
672
|
-
Object.entries(this.frozen).filter(([_, limit]) => limit && limit > 0).forEach(([plane, limit]) => {
|
|
673
|
-
this.cells[plane] = this.getCells(plane.startsWith("frozenRows") ? {
|
|
674
|
-
start: {
|
|
675
|
-
col: this.visColMin,
|
|
676
|
-
row: 0
|
|
677
|
-
},
|
|
678
|
-
end: {
|
|
679
|
-
col: this.visColMax,
|
|
680
|
-
row: limit
|
|
681
|
-
}
|
|
682
|
-
} : {
|
|
683
|
-
start: {
|
|
684
|
-
col: 0,
|
|
685
|
-
row: this.visRowMin
|
|
686
|
-
},
|
|
687
|
-
end: {
|
|
688
|
-
col: limit,
|
|
689
|
-
row: this.visRowMax
|
|
690
|
-
}
|
|
691
|
-
}, plane);
|
|
692
|
-
});
|
|
693
|
-
if (includeFixed) {
|
|
694
|
-
if ((this.frozen.frozenColsStart ?? 0) > 0 && (this.frozen.frozenRowsStart ?? 0) > 0) {
|
|
695
|
-
this.cells.fixedStartStart = this.getCells({
|
|
696
|
-
start: {
|
|
697
|
-
col: 0,
|
|
698
|
-
row: 0
|
|
699
|
-
},
|
|
700
|
-
end: {
|
|
701
|
-
col: this.frozen.frozenColsStart,
|
|
702
|
-
row: this.frozen.frozenRowsStart
|
|
703
|
-
}
|
|
704
|
-
}, "fixedStartStart");
|
|
705
|
-
}
|
|
706
|
-
if ((this.frozen.frozenColsEnd ?? 0) > 0 && (this.frozen.frozenRowsStart ?? 0) > 0) {
|
|
707
|
-
this.cells.fixedStartEnd = this.getCells({
|
|
708
|
-
start: {
|
|
709
|
-
col: 0,
|
|
710
|
-
row: 0
|
|
711
|
-
},
|
|
712
|
-
end: {
|
|
713
|
-
col: this.frozen.frozenColsEnd,
|
|
714
|
-
row: this.frozen.frozenRowsStart
|
|
715
|
-
}
|
|
716
|
-
}, "fixedStartEnd");
|
|
717
|
-
}
|
|
718
|
-
if ((this.frozen.frozenColsStart ?? 0) > 0 && (this.frozen.frozenRowsEnd ?? 0) > 0) {
|
|
719
|
-
this.cells.fixedEndStart = this.getCells({
|
|
720
|
-
start: {
|
|
721
|
-
col: 0,
|
|
722
|
-
row: 0
|
|
723
|
-
},
|
|
724
|
-
end: {
|
|
725
|
-
col: this.frozen.frozenColsStart,
|
|
726
|
-
row: this.frozen.frozenRowsEnd
|
|
727
|
-
}
|
|
728
|
-
}, "fixedEndStart");
|
|
729
|
-
}
|
|
730
|
-
if ((this.frozen.frozenColsEnd ?? 0) > 0 && (this.frozen.frozenRowsEnd ?? 0) > 0) {
|
|
731
|
-
this.cells.fixedEndEnd = this.getCells({
|
|
732
|
-
start: {
|
|
733
|
-
col: 0,
|
|
734
|
-
row: 0
|
|
735
|
-
},
|
|
736
|
-
end: {
|
|
737
|
-
col: this.frozen.frozenColsEnd,
|
|
738
|
-
row: this.frozen.frozenRowsEnd
|
|
739
|
-
}
|
|
740
|
-
}, "fixedEndEnd");
|
|
741
|
-
}
|
|
742
|
-
}
|
|
743
|
-
}
|
|
744
419
|
// Focus handlers
|
|
745
420
|
handleFocus(event) {
|
|
746
421
|
const cellCoords = closestCell(event.target);
|
|
@@ -755,43 +430,7 @@ var DxGrid = class extends LitElement2 {
|
|
|
755
430
|
}
|
|
756
431
|
}
|
|
757
432
|
focusedCellElement() {
|
|
758
|
-
return this.viewportRef.value?.querySelector(`[
|
|
759
|
-
}
|
|
760
|
-
//
|
|
761
|
-
// `outOfVis` returns by how many rows/cols the focused cell is outside of the `vis` range for an axis, inset by a
|
|
762
|
-
// `delta`, otherwise zero if it is within that range.
|
|
763
|
-
//
|
|
764
|
-
focusedCellRowOutOfVis(minDelta = 0, maxDelta = minDelta) {
|
|
765
|
-
return this.focusedCell.row <= this.visRowMin + minDelta ? this.focusedCell.row - (this.visRowMin + minDelta) : this.focusedCell.row >= this.visRowMax - maxDelta ? -(this.focusedCell.row - this.visRowMax - maxDelta) : 0;
|
|
766
|
-
}
|
|
767
|
-
focusedCellColOutOfVis(minDelta = 0, maxDelta = minDelta) {
|
|
768
|
-
return this.focusedCell.col <= this.visColMin + minDelta ? this.focusedCell.col - (this.visColMin + minDelta) : this.focusedCell.col >= this.visColMax - maxDelta ? -(this.focusedCell.col - this.visColMax - maxDelta) : 0;
|
|
769
|
-
}
|
|
770
|
-
focusedCellOutOfVis(colDelta = 0, rowDelta = colDelta) {
|
|
771
|
-
switch (this.focusedCell.plane) {
|
|
772
|
-
case "grid":
|
|
773
|
-
return {
|
|
774
|
-
row: this.focusedCellRowOutOfVis(rowDelta),
|
|
775
|
-
col: this.focusedCellColOutOfVis(colDelta)
|
|
776
|
-
};
|
|
777
|
-
case "frozenRowsStart":
|
|
778
|
-
case "frozenRowsEnd":
|
|
779
|
-
return {
|
|
780
|
-
col: this.focusedCellColOutOfVis(colDelta),
|
|
781
|
-
row: 0
|
|
782
|
-
};
|
|
783
|
-
case "frozenColsStart":
|
|
784
|
-
case "frozenColsEnd":
|
|
785
|
-
return {
|
|
786
|
-
col: 0,
|
|
787
|
-
row: this.focusedCellRowOutOfVis(rowDelta)
|
|
788
|
-
};
|
|
789
|
-
default:
|
|
790
|
-
return {
|
|
791
|
-
col: 0,
|
|
792
|
-
row: 0
|
|
793
|
-
};
|
|
794
|
-
}
|
|
433
|
+
return this.viewportRef.value?.querySelector(`[aria-colindex="${this.focusedCell.col}"][aria-rowindex="${this.focusedCell.row}"]`);
|
|
795
434
|
}
|
|
796
435
|
/**
|
|
797
436
|
* Moves focus to the cell with actual focus, otherwise moves focus to the viewport.
|
|
@@ -810,238 +449,124 @@ var DxGrid = class extends LitElement2 {
|
|
|
810
449
|
col: this.focusedCell.col + delta
|
|
811
450
|
};
|
|
812
451
|
}
|
|
452
|
+
(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({
|
|
453
|
+
preventScroll: true
|
|
454
|
+
});
|
|
813
455
|
if (increment) {
|
|
814
456
|
this.snapPosToFocusedCell();
|
|
815
457
|
}
|
|
816
|
-
queueMicrotask(() => {
|
|
817
|
-
const outOfVis = this.focusedCellOutOfVis(overscanCol, overscanRow);
|
|
818
|
-
(outOfVis.col !== 0 || outOfVis.row !== 0 ? this.viewportRef.value : this.focusedCellElement())?.focus({
|
|
819
|
-
preventScroll: true
|
|
820
|
-
});
|
|
821
|
-
});
|
|
822
|
-
}
|
|
823
|
-
findPosInlineFromVisColMin(deltaCols) {
|
|
824
|
-
return [
|
|
825
|
-
...Array(deltaCols)
|
|
826
|
-
].reduce((acc, _, c0) => acc - this.colSize(this.visColMin - c0, "grid") - gap, this.binInlineMin + gap);
|
|
827
|
-
}
|
|
828
|
-
findPosBlockFromVisRowMin(deltaRows) {
|
|
829
|
-
return [
|
|
830
|
-
...Array(deltaRows)
|
|
831
|
-
].reduce((acc, _, r0) => acc - this.rowSize(this.visRowMin - r0, "grid") - gap, this.binBlockMin + gap);
|
|
832
458
|
}
|
|
833
459
|
/**
|
|
834
460
|
* Updates `pos` so that a cell in focus is fully within the viewport
|
|
835
461
|
*/
|
|
836
462
|
snapPosToFocusedCell() {
|
|
837
|
-
|
|
838
|
-
if (
|
|
839
|
-
this.posInline = this.findPosInlineFromVisColMin(-outOfVis.col);
|
|
840
|
-
this.updateVisInline();
|
|
841
|
-
} else if (outOfVis.col > 0) {
|
|
842
|
-
const sizeSumCol = [
|
|
843
|
-
...Array(this.focusedCell.col - this.visColMin)
|
|
844
|
-
].reduce((acc, _, c0) => {
|
|
845
|
-
acc += this.colSize(this.visColMin + overscanCol + c0, "grid") + gap;
|
|
846
|
-
return acc;
|
|
847
|
-
}, 0);
|
|
848
|
-
this.posInline = Math.max(0, Math.min(this.intrinsicInlineSize - this.sizeInline, this.binInlineMin + sizeSumCol - this.sizeInline));
|
|
849
|
-
this.updateVisInline();
|
|
850
|
-
}
|
|
851
|
-
if (outOfVis.row < 0) {
|
|
852
|
-
this.posBlock = this.findPosBlockFromVisRowMin(-outOfVis.row);
|
|
853
|
-
this.updateVisBlock();
|
|
854
|
-
} else if (outOfVis.row > 0) {
|
|
855
|
-
const sizeSumRow = [
|
|
856
|
-
...Array(this.focusedCell.row - this.visRowMin)
|
|
857
|
-
].reduce((acc, _, r0) => {
|
|
858
|
-
acc += this.rowSize(this.visRowMin + overscanRow + r0, "grid") + gap;
|
|
859
|
-
return acc;
|
|
860
|
-
}, 0);
|
|
861
|
-
this.posBlock = Math.max(0, Math.min(this.intrinsicBlockSize - this.sizeBlock, this.binBlockMin + sizeSumRow - this.sizeBlock));
|
|
862
|
-
this.updateVisBlock();
|
|
863
|
-
}
|
|
864
|
-
}
|
|
865
|
-
//
|
|
866
|
-
// Map scroll DOM methods to virtualized value.
|
|
867
|
-
//
|
|
868
|
-
get scrollLeft() {
|
|
869
|
-
return this.posInline;
|
|
870
|
-
}
|
|
871
|
-
set scrollLeft(nextValue) {
|
|
872
|
-
this.posInline = nextValue;
|
|
873
|
-
this.maybeUpdateVisInline();
|
|
874
|
-
}
|
|
875
|
-
get scrollTop() {
|
|
876
|
-
return this.posBlock;
|
|
877
|
-
}
|
|
878
|
-
set scrollTop(nextValue) {
|
|
879
|
-
this.posBlock = nextValue;
|
|
880
|
-
this.maybeUpdateVisBlock();
|
|
881
|
-
}
|
|
882
|
-
//
|
|
883
|
-
// Resize handlers
|
|
884
|
-
//
|
|
885
|
-
axisResizeable(plane, axis, index) {
|
|
886
|
-
return axis === "col" ? !!(this.columns[plane]?.[index]?.resizeable ?? this.columnDefault[plane]?.resizeable) : !!(this.rows[plane]?.[index]?.resizeable ?? this.rowDefault[plane]?.resizeable);
|
|
887
|
-
}
|
|
888
|
-
handleAxisResizeInternal(event) {
|
|
889
|
-
event.stopPropagation();
|
|
890
|
-
const { plane, axis, delta, size, index, state: state2 } = event;
|
|
891
|
-
if (axis === "col") {
|
|
892
|
-
const nextSize = Math.max(sizeColMin, Math.min(sizeColMax, size + delta));
|
|
893
|
-
this.colSizes = {
|
|
894
|
-
...this.colSizes,
|
|
895
|
-
[plane]: {
|
|
896
|
-
...this.colSizes[plane],
|
|
897
|
-
[index]: nextSize
|
|
898
|
-
}
|
|
899
|
-
};
|
|
900
|
-
this.updateVisInline();
|
|
901
|
-
this.updateIntrinsicInlineSize();
|
|
463
|
+
if (this.focusedCell.col < this.visColMin || this.focusedCell.col > this.visColMax || this.focusedCell.row < this.visRowMin || this.focusedCell.row > this.visRowMax) {
|
|
464
|
+
} else if (this.focusedCell.col > this.visColMin + overscanCol && this.focusedCell.col < this.visColMax - overscanCol - 1 && this.focusedCell.row > this.visRowMin + overscanRow && this.focusedCell.row < this.visRowMax - overscanRow - 1) {
|
|
902
465
|
} else {
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
466
|
+
if (this.focusedCell.col <= this.visColMin + overscanCol) {
|
|
467
|
+
this.posInline = this.binInlineMin;
|
|
468
|
+
this.updateVisInline();
|
|
469
|
+
} else if (this.focusedCell.col >= this.visColMax - overscanCol - 1) {
|
|
470
|
+
const sizeSumCol = [
|
|
471
|
+
...Array(this.focusedCell.col - this.visColMin)
|
|
472
|
+
].reduce((acc, _, c0) => {
|
|
473
|
+
acc += this.colSize(this.visColMin + overscanCol + c0) + gap;
|
|
474
|
+
return acc;
|
|
475
|
+
}, 0);
|
|
476
|
+
this.posInline = Math.max(0, this.binInlineMin + sizeSumCol + gap * 2 - this.sizeInline);
|
|
477
|
+
this.updateVisInline();
|
|
478
|
+
}
|
|
479
|
+
if (this.focusedCell.row <= this.visRowMin + overscanRow) {
|
|
480
|
+
this.posBlock = this.binBlockMin;
|
|
481
|
+
this.updateVisBlock();
|
|
482
|
+
} else if (this.focusedCell.row >= this.visRowMax - overscanRow - 1) {
|
|
483
|
+
const sizeSumRow = [
|
|
484
|
+
...Array(this.focusedCell.row - this.visRowMin)
|
|
485
|
+
].reduce((acc, _, r0) => {
|
|
486
|
+
acc += this.rowSize(this.visRowMin + overscanRow + r0) + gap;
|
|
487
|
+
return acc;
|
|
488
|
+
}, 0);
|
|
489
|
+
this.posBlock = Math.max(0, this.binBlockMin + sizeSumRow + gap * 2 - this.sizeBlock);
|
|
490
|
+
this.updateVisBlock();
|
|
491
|
+
}
|
|
921
492
|
}
|
|
922
493
|
}
|
|
923
494
|
//
|
|
924
495
|
// Render and other lifecycle methods
|
|
925
496
|
//
|
|
926
|
-
renderFixed(plane, selection) {
|
|
927
|
-
const colPlane = resolveColPlane(plane);
|
|
928
|
-
const rowPlane = resolveRowPlane(plane);
|
|
929
|
-
const cols = this.frozen[colPlane];
|
|
930
|
-
const rows = this.frozen[rowPlane];
|
|
931
|
-
return (cols ?? 0) > 0 && (rows ?? 0) > 0 ? html2`<div
|
|
932
|
-
role="none"
|
|
933
|
-
data-dx-grid-plane=${plane}
|
|
934
|
-
class="dx-grid__plane--fixed"
|
|
935
|
-
style=${styleMap({
|
|
936
|
-
"grid-template-columns": this[`template${colPlane}`],
|
|
937
|
-
"grid-template-rows": this[`template${rowPlane}`]
|
|
938
|
-
})}
|
|
939
|
-
>
|
|
940
|
-
${[
|
|
941
|
-
...Array(cols)
|
|
942
|
-
].map((_, c) => {
|
|
943
|
-
return [
|
|
944
|
-
...Array(rows)
|
|
945
|
-
].map((_2, r) => {
|
|
946
|
-
return this.renderCell(c, r, plane, cellSelected(c, r, plane, selection));
|
|
947
|
-
});
|
|
948
|
-
})}
|
|
949
|
-
</div>` : null;
|
|
950
|
-
}
|
|
951
|
-
renderFrozenRows(plane, visibleCols, offsetInline, selection) {
|
|
952
|
-
const rowPlane = resolveRowPlane(plane);
|
|
953
|
-
const rows = this.frozen[rowPlane];
|
|
954
|
-
return (rows ?? 0) > 0 ? html2`<div role="none" class="dx-grid__plane--frozen-row">
|
|
955
|
-
<div
|
|
956
|
-
role="none"
|
|
957
|
-
data-dx-grid-plane=${plane}
|
|
958
|
-
class="dx-grid__plane--frozen-row__content"
|
|
959
|
-
style="transform:translate3d(${offsetInline}px,0,0);grid-template-columns:${this.templateGridColumns};grid-template-rows:${this[`template${rowPlane}`]}"
|
|
960
|
-
>
|
|
961
|
-
${[
|
|
962
|
-
...Array(visibleCols)
|
|
963
|
-
].map((_, c0) => {
|
|
964
|
-
return [
|
|
965
|
-
...Array(rows)
|
|
966
|
-
].map((_2, r) => {
|
|
967
|
-
const c = this.visColMin + c0;
|
|
968
|
-
return this.renderCell(c, r, plane, cellSelected(c, r, plane, selection), c0, r);
|
|
969
|
-
});
|
|
970
|
-
})}
|
|
971
|
-
</div>
|
|
972
|
-
</div>` : null;
|
|
973
|
-
}
|
|
974
|
-
renderFrozenColumns(plane, visibleRows, offsetBlock, selection) {
|
|
975
|
-
const colPlane = resolveColPlane(plane);
|
|
976
|
-
const cols = this.frozen[colPlane];
|
|
977
|
-
return (cols ?? 0) > 0 ? html2`<div role="none" class="dx-grid__plane--frozen-col">
|
|
978
|
-
<div
|
|
979
|
-
role="none"
|
|
980
|
-
data-dx-grid-plane=${plane}
|
|
981
|
-
class="dx-grid__plane--frozen-col__content"
|
|
982
|
-
style="transform:translate3d(0,${offsetBlock}px,0);grid-template-rows:${this.templateGridRows};grid-template-columns:${this[`template${colPlane}`]}"
|
|
983
|
-
>
|
|
984
|
-
${[
|
|
985
|
-
...Array(cols)
|
|
986
|
-
].map((_, c) => {
|
|
987
|
-
return [
|
|
988
|
-
...Array(visibleRows)
|
|
989
|
-
].map((_2, r0) => {
|
|
990
|
-
const r = this.visRowMin + r0;
|
|
991
|
-
return this.renderCell(c, r, plane, cellSelected(c, r, plane, selection), c, r0);
|
|
992
|
-
});
|
|
993
|
-
})}
|
|
994
|
-
</div>
|
|
995
|
-
</div>` : null;
|
|
996
|
-
}
|
|
997
|
-
renderCell(col, row, plane, selected, visCol = col, visRow = row) {
|
|
998
|
-
const cell = this.cell(col, row, plane);
|
|
999
|
-
const active = this.cellActive(col, row, plane);
|
|
1000
|
-
const resizeIndex = cell?.resizeHandle ? cell.resizeHandle === "col" ? col : row : void 0;
|
|
1001
|
-
const resizePlane = cell?.resizeHandle ? resolveResizePlane(cell.resizeHandle, plane) : void 0;
|
|
1002
|
-
return html2`<div
|
|
1003
|
-
role="gridcell"
|
|
1004
|
-
tabindex="0"
|
|
1005
|
-
?inert=${col < 0 || row < 0}
|
|
1006
|
-
?aria-selected=${selected}
|
|
1007
|
-
class=${cell || active ? (cell?.className ? cell.className + " " : "") + (active ? "dx-grid__cell--active" : "") : nothing}
|
|
1008
|
-
aria-colindex=${col}
|
|
1009
|
-
aria-rowindex=${row}
|
|
1010
|
-
data-dx-grid-action="cell"
|
|
1011
|
-
style="grid-column:${visCol + 1};grid-row:${visRow + 1}"
|
|
1012
|
-
>
|
|
1013
|
-
${cell?.value}${cell?.resizeHandle && this.axisResizeable(resizePlane, cell.resizeHandle, resizeIndex) ? html2`<dx-grid-axis-resize-handle
|
|
1014
|
-
axis=${cell.resizeHandle}
|
|
1015
|
-
plane=${resizePlane}
|
|
1016
|
-
index=${resizeIndex}
|
|
1017
|
-
size=${this[`${cell.resizeHandle}Size`](resizeIndex, plane)}
|
|
1018
|
-
></dx-grid-axis-resize-handle>` : null}
|
|
1019
|
-
</div>`;
|
|
1020
|
-
}
|
|
1021
497
|
render() {
|
|
1022
498
|
const visibleCols = this.visColMax - this.visColMin;
|
|
1023
499
|
const visibleRows = this.visRowMax - this.visRowMin;
|
|
1024
500
|
const offsetInline = this.binInlineMin - this.posInline - this.overscanInline;
|
|
1025
501
|
const offsetBlock = this.binBlockMin - this.posBlock - this.overscanBlock;
|
|
1026
|
-
const
|
|
1027
|
-
|
|
502
|
+
const selectColMin = Math.min(this.selectionStart.col, this.selectionEnd.col);
|
|
503
|
+
const selectColMax = Math.max(this.selectionStart.col, this.selectionEnd.col);
|
|
504
|
+
const selectRowMin = Math.min(this.selectionStart.row, this.selectionEnd.row);
|
|
505
|
+
const selectRowMax = Math.max(this.selectionStart.row, this.selectionEnd.row);
|
|
506
|
+
const selectVisible = selectColMin !== selectColMax || selectRowMin !== selectRowMax;
|
|
507
|
+
return html`<div
|
|
1028
508
|
role="none"
|
|
1029
509
|
class="dx-grid"
|
|
1030
|
-
style=${styleMap({
|
|
1031
|
-
"grid-template-columns": `${this.templatefrozenColsStart ? "min-content " : ""}minmax(0, ${Number.isFinite(this.limitColumns) ? `${this.intrinsicInlineSize}px` : "1fr"})${this.templatefrozenColsEnd ? " min-content" : ""}`,
|
|
1032
|
-
"grid-template-rows": `${this.templatefrozenRowsStart ? "min-content " : ""}minmax(0, ${Number.isFinite(this.limitRows) ? `${this.intrinsicBlockSize}px` : "1fr"})${this.templatefrozenRowsEnd ? " min-content" : ""}`
|
|
1033
|
-
})}
|
|
1034
510
|
data-grid=${this.gridId}
|
|
1035
511
|
data-grid-mode=${this.mode}
|
|
1036
|
-
?data-grid-select=${
|
|
512
|
+
?data-grid-select=${selectVisible}
|
|
513
|
+
@pointerdown=${this.handlePointerDown}
|
|
514
|
+
@pointerup=${this.handlePointerUp}
|
|
515
|
+
@pointermove=${this.handlePointerMove}
|
|
516
|
+
@pointerleave=${this.handlePointerUp}
|
|
517
|
+
@focus=${this.handleFocus}
|
|
518
|
+
@blur=${this.handleBlur}
|
|
519
|
+
@keydown=${this.handleKeydown}
|
|
1037
520
|
>
|
|
1038
|
-
|
|
1039
|
-
<div role="
|
|
521
|
+
<div role="none" class="dx-grid__corner"></div>
|
|
522
|
+
<div role="none" class="dx-grid__columnheader">
|
|
523
|
+
<div
|
|
524
|
+
role="none"
|
|
525
|
+
class="dx-grid__columnheader__content"
|
|
526
|
+
style="transform:translate3d(${offsetInline}px,0,0);grid-template-columns:${this.templateColumns};"
|
|
527
|
+
>
|
|
528
|
+
${[
|
|
529
|
+
...Array(visibleCols)
|
|
530
|
+
].map((_, c0) => {
|
|
531
|
+
const c = this.visColMin + c0;
|
|
532
|
+
return html`<div
|
|
533
|
+
role="columnheader"
|
|
534
|
+
?inert=${c < 0}
|
|
535
|
+
style="block-size:${this.rowDefault.size}px;grid-column:${c0 + 1}/${c0 + 2};"
|
|
536
|
+
>
|
|
537
|
+
<span id=${localChId(c0)}>${colToA1Notation(c)}</span>
|
|
538
|
+
${(this.columns[c]?.resizeable ?? this.columnDefault.resizeable) && html`<button class="dx-grid__resize-handle" data-dx-grid-action=${`resize-col,${c}`}>
|
|
539
|
+
<span class="sr-only">Resize</span>
|
|
540
|
+
</button>`}
|
|
541
|
+
</div>`;
|
|
542
|
+
})}
|
|
543
|
+
</div>
|
|
544
|
+
</div>
|
|
545
|
+
<div role="none" class="dx-grid__corner"></div>
|
|
546
|
+
<div role="none" class="dx-grid__rowheader">
|
|
547
|
+
<div
|
|
548
|
+
role="none"
|
|
549
|
+
class="dx-grid__rowheader__content"
|
|
550
|
+
style="transform:translate3d(0,${offsetBlock}px,0);grid-template-rows:${this.templateRows};"
|
|
551
|
+
>
|
|
552
|
+
${[
|
|
553
|
+
...Array(visibleRows)
|
|
554
|
+
].map((_, r0) => {
|
|
555
|
+
const r = this.visRowMin + r0;
|
|
556
|
+
return html`<div role="rowheader" ?inert=${r < 0} style="grid-row:${r0 + 1}/${r0 + 2}">
|
|
557
|
+
<span id=${localRhId(r0)}>${rowToA1Notation(r)}</span>
|
|
558
|
+
${(this.rows[r]?.resizeable ?? this.rowDefault.resizeable) && html`<button class="dx-grid__resize-handle" data-dx-grid-action=${`resize-row,${r}`}>
|
|
559
|
+
<span class="sr-only">Resize</span>
|
|
560
|
+
</button>`}
|
|
561
|
+
</div>`;
|
|
562
|
+
})}
|
|
563
|
+
</div>
|
|
564
|
+
</div>
|
|
565
|
+
<div role="grid" class="dx-grid__viewport" tabindex="0" @wheel=${this.handleWheel} ${ref(this.viewportRef)}>
|
|
1040
566
|
<div
|
|
1041
567
|
role="none"
|
|
1042
|
-
class="dx-
|
|
1043
|
-
|
|
1044
|
-
style="transform:translate3d(${offsetInline}px,${offsetBlock}px,0);grid-template-columns:${this.templateGridColumns};grid-template-rows:${this.templateGridRows};"
|
|
568
|
+
class="dx-grid__content"
|
|
569
|
+
style="transform:translate3d(${offsetInline}px,${offsetBlock}px,0);grid-template-columns:${this.templateColumns};grid-template-rows:${this.templateRows};"
|
|
1045
570
|
>
|
|
1046
571
|
${[
|
|
1047
572
|
...Array(visibleCols)
|
|
@@ -1051,70 +576,75 @@ var DxGrid = class extends LitElement2 {
|
|
|
1051
576
|
].map((_2, r0) => {
|
|
1052
577
|
const c = c0 + this.visColMin;
|
|
1053
578
|
const r = r0 + this.visRowMin;
|
|
1054
|
-
|
|
579
|
+
const cell = this.cell(c, r);
|
|
580
|
+
const active = this.focusActive && this.focusedCell.col === c && this.focusedCell.row === r;
|
|
581
|
+
const selected = c >= selectColMin && c <= selectColMax && r >= selectRowMin && r <= selectRowMax;
|
|
582
|
+
return html`<div
|
|
583
|
+
role="gridcell"
|
|
584
|
+
tabindex="0"
|
|
585
|
+
?inert=${c < 0 || r < 0}
|
|
586
|
+
?aria-selected=${selected}
|
|
587
|
+
class=${cell || active ? (cell?.className ? cell.className + " " : "") + (active ? "dx-grid__cell--active" : "") : nothing}
|
|
588
|
+
aria-rowindex=${r}
|
|
589
|
+
aria-colindex=${c}
|
|
590
|
+
data-dx-grid-action="cell"
|
|
591
|
+
style="grid-column:${c0 + 1};grid-row:${r0 + 1}"
|
|
592
|
+
>
|
|
593
|
+
${cell?.value}
|
|
594
|
+
</div>`;
|
|
1055
595
|
});
|
|
1056
596
|
})}
|
|
1057
597
|
</div>
|
|
1058
598
|
</div>
|
|
1059
|
-
|
|
599
|
+
<div role="none" class="dx-grid__scrollbar" aria-orientation="vertical">
|
|
600
|
+
<div role="none" class="dx-grid__scrollbar__thumb"></div>
|
|
601
|
+
</div>
|
|
602
|
+
<div role="none" class="dx-grid__corner"></div>
|
|
603
|
+
<div role="none" class="dx-grid__scrollbar" aria-orientation="horizontal">
|
|
604
|
+
<div role="none" class="dx-grid__scrollbar__thumb"></div>
|
|
605
|
+
</div>
|
|
606
|
+
<div role="none" class="dx-grid__corner"></div>
|
|
1060
607
|
</div>`;
|
|
1061
608
|
}
|
|
1062
|
-
updateIntrinsicInlineSize() {
|
|
1063
|
-
this.intrinsicInlineSize = Number.isFinite(this.limitColumns) ? [
|
|
1064
|
-
...Array(this.limitColumns)
|
|
1065
|
-
].reduce((acc, _, c0) => acc + this.colSize(c0, "grid"), 0) + gap * (this.limitColumns - 1) : Infinity;
|
|
1066
|
-
}
|
|
1067
|
-
updateIntrinsicBlockSize() {
|
|
1068
|
-
this.intrinsicBlockSize = Number.isFinite(this.limitRows) ? [
|
|
1069
|
-
...Array(this.limitRows)
|
|
1070
|
-
].reduce((acc, _, r0) => acc + this.rowSize(r0, "grid"), 0) + gap * (this.limitRows - 1) : Infinity;
|
|
1071
|
-
}
|
|
1072
|
-
updateIntrinsicSizes() {
|
|
1073
|
-
this.updateIntrinsicInlineSize();
|
|
1074
|
-
this.updateIntrinsicBlockSize();
|
|
1075
|
-
}
|
|
1076
609
|
firstUpdated() {
|
|
1077
610
|
if (this.getCells) {
|
|
1078
|
-
this.
|
|
611
|
+
this.cells = this.getCells({
|
|
612
|
+
start: {
|
|
613
|
+
col: this.visColMin,
|
|
614
|
+
row: this.visRowMin
|
|
615
|
+
},
|
|
616
|
+
end: {
|
|
617
|
+
col: this.visColMax,
|
|
618
|
+
row: this.visRowMax
|
|
619
|
+
}
|
|
620
|
+
});
|
|
1079
621
|
}
|
|
1080
622
|
this.observer.observe(this.viewportRef.value);
|
|
1081
|
-
this.colSizes = Object.entries(this.columns).reduce((acc, [
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
}
|
|
1086
|
-
return planeAcc;
|
|
1087
|
-
}, {});
|
|
623
|
+
this.colSizes = Object.entries(this.columns).reduce((acc, [colId, colMeta]) => {
|
|
624
|
+
if (colMeta?.size) {
|
|
625
|
+
acc[colId] = colMeta.size;
|
|
626
|
+
}
|
|
1088
627
|
return acc;
|
|
1089
|
-
}, {
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
if (rowMeta?.size) {
|
|
1095
|
-
planeAcc[row] = rowMeta.size;
|
|
1096
|
-
}
|
|
1097
|
-
return planeAcc;
|
|
1098
|
-
}, {});
|
|
628
|
+
}, {});
|
|
629
|
+
this.rowSizes = Object.entries(this.rows).reduce((acc, [rowId, rowMeta]) => {
|
|
630
|
+
if (rowMeta?.size) {
|
|
631
|
+
acc[rowId] = rowMeta.size;
|
|
632
|
+
}
|
|
1099
633
|
return acc;
|
|
1100
|
-
}, {
|
|
1101
|
-
grid: {}
|
|
1102
|
-
});
|
|
1103
|
-
this.updateIntrinsicSizes();
|
|
634
|
+
}, {});
|
|
1104
635
|
}
|
|
1105
636
|
willUpdate(changedProperties) {
|
|
1106
637
|
if (this.getCells && (changedProperties.has("initialCells") || changedProperties.has("visColMin") || changedProperties.has("visColMax") || changedProperties.has("visRowMin") || changedProperties.has("visRowMax"))) {
|
|
1107
|
-
this.
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
this.updateVisInline();
|
|
638
|
+
this.cells = this.getCells({
|
|
639
|
+
start: {
|
|
640
|
+
col: this.visColMin,
|
|
641
|
+
row: this.visRowMin
|
|
642
|
+
},
|
|
643
|
+
end: {
|
|
644
|
+
col: this.visColMax,
|
|
645
|
+
row: this.visRowMax
|
|
646
|
+
}
|
|
647
|
+
});
|
|
1118
648
|
}
|
|
1119
649
|
}
|
|
1120
650
|
updated(changedProperties) {
|
|
@@ -1122,13 +652,6 @@ var DxGrid = class extends LitElement2 {
|
|
|
1122
652
|
this.refocus();
|
|
1123
653
|
}
|
|
1124
654
|
}
|
|
1125
|
-
updateIfWithinBounds({ col, row }) {
|
|
1126
|
-
if (col >= this.visColMin && col <= this.visColMax && row >= this.visRowMin && row <= this.visRowMax) {
|
|
1127
|
-
this.requestUpdate();
|
|
1128
|
-
return true;
|
|
1129
|
-
}
|
|
1130
|
-
return false;
|
|
1131
|
-
}
|
|
1132
655
|
disconnectedCallback() {
|
|
1133
656
|
super.disconnectedCallback();
|
|
1134
657
|
if (this.viewportRef.value) {
|
|
@@ -1139,159 +662,133 @@ var DxGrid = class extends LitElement2 {
|
|
|
1139
662
|
return this;
|
|
1140
663
|
}
|
|
1141
664
|
};
|
|
1142
|
-
|
|
1143
|
-
|
|
665
|
+
_ts_decorate([
|
|
666
|
+
property({
|
|
1144
667
|
type: String
|
|
1145
668
|
})
|
|
1146
669
|
], DxGrid.prototype, "gridId", void 0);
|
|
1147
|
-
|
|
1148
|
-
|
|
670
|
+
_ts_decorate([
|
|
671
|
+
property({
|
|
1149
672
|
type: Object
|
|
1150
673
|
})
|
|
1151
674
|
], DxGrid.prototype, "rowDefault", void 0);
|
|
1152
|
-
|
|
1153
|
-
|
|
675
|
+
_ts_decorate([
|
|
676
|
+
property({
|
|
1154
677
|
type: Object
|
|
1155
678
|
})
|
|
1156
679
|
], DxGrid.prototype, "columnDefault", void 0);
|
|
1157
|
-
|
|
1158
|
-
|
|
680
|
+
_ts_decorate([
|
|
681
|
+
property({
|
|
1159
682
|
type: Object
|
|
1160
683
|
})
|
|
1161
684
|
], DxGrid.prototype, "rows", void 0);
|
|
1162
|
-
|
|
1163
|
-
|
|
685
|
+
_ts_decorate([
|
|
686
|
+
property({
|
|
1164
687
|
type: Object
|
|
1165
688
|
})
|
|
1166
689
|
], DxGrid.prototype, "columns", void 0);
|
|
1167
|
-
|
|
1168
|
-
|
|
690
|
+
_ts_decorate([
|
|
691
|
+
property({
|
|
1169
692
|
type: Object
|
|
1170
693
|
})
|
|
1171
694
|
], DxGrid.prototype, "initialCells", void 0);
|
|
1172
|
-
|
|
1173
|
-
|
|
695
|
+
_ts_decorate([
|
|
696
|
+
property({
|
|
1174
697
|
type: String
|
|
1175
698
|
})
|
|
1176
699
|
], DxGrid.prototype, "mode", void 0);
|
|
1177
|
-
|
|
1178
|
-
property2({
|
|
1179
|
-
type: Number
|
|
1180
|
-
})
|
|
1181
|
-
], DxGrid.prototype, "limitColumns", void 0);
|
|
1182
|
-
_ts_decorate2([
|
|
1183
|
-
property2({
|
|
1184
|
-
type: Number
|
|
1185
|
-
})
|
|
1186
|
-
], DxGrid.prototype, "limitRows", void 0);
|
|
1187
|
-
_ts_decorate2([
|
|
1188
|
-
property2({
|
|
1189
|
-
type: Object
|
|
1190
|
-
})
|
|
1191
|
-
], DxGrid.prototype, "frozen", void 0);
|
|
1192
|
-
_ts_decorate2([
|
|
700
|
+
_ts_decorate([
|
|
1193
701
|
state()
|
|
1194
702
|
], DxGrid.prototype, "cells", void 0);
|
|
1195
|
-
|
|
703
|
+
_ts_decorate([
|
|
1196
704
|
state()
|
|
1197
705
|
], DxGrid.prototype, "posInline", void 0);
|
|
1198
|
-
|
|
706
|
+
_ts_decorate([
|
|
1199
707
|
state()
|
|
1200
708
|
], DxGrid.prototype, "posBlock", void 0);
|
|
1201
|
-
|
|
709
|
+
_ts_decorate([
|
|
1202
710
|
state()
|
|
1203
711
|
], DxGrid.prototype, "sizeInline", void 0);
|
|
1204
|
-
|
|
712
|
+
_ts_decorate([
|
|
1205
713
|
state()
|
|
1206
714
|
], DxGrid.prototype, "sizeBlock", void 0);
|
|
1207
|
-
|
|
715
|
+
_ts_decorate([
|
|
1208
716
|
state()
|
|
1209
717
|
], DxGrid.prototype, "overscanInline", void 0);
|
|
1210
|
-
|
|
718
|
+
_ts_decorate([
|
|
1211
719
|
state()
|
|
1212
720
|
], DxGrid.prototype, "overscanBlock", void 0);
|
|
1213
|
-
|
|
721
|
+
_ts_decorate([
|
|
1214
722
|
state()
|
|
1215
723
|
], DxGrid.prototype, "binInlineMin", void 0);
|
|
1216
|
-
|
|
724
|
+
_ts_decorate([
|
|
1217
725
|
state()
|
|
1218
726
|
], DxGrid.prototype, "binInlineMax", void 0);
|
|
1219
|
-
|
|
727
|
+
_ts_decorate([
|
|
1220
728
|
state()
|
|
1221
729
|
], DxGrid.prototype, "binBlockMin", void 0);
|
|
1222
|
-
|
|
730
|
+
_ts_decorate([
|
|
1223
731
|
state()
|
|
1224
732
|
], DxGrid.prototype, "binBlockMax", void 0);
|
|
1225
|
-
|
|
733
|
+
_ts_decorate([
|
|
1226
734
|
state()
|
|
1227
735
|
], DxGrid.prototype, "visColMin", void 0);
|
|
1228
|
-
|
|
736
|
+
_ts_decorate([
|
|
1229
737
|
state()
|
|
1230
738
|
], DxGrid.prototype, "visColMax", void 0);
|
|
1231
|
-
|
|
739
|
+
_ts_decorate([
|
|
1232
740
|
state()
|
|
1233
741
|
], DxGrid.prototype, "visRowMin", void 0);
|
|
1234
|
-
|
|
742
|
+
_ts_decorate([
|
|
1235
743
|
state()
|
|
1236
744
|
], DxGrid.prototype, "visRowMax", void 0);
|
|
1237
|
-
|
|
1238
|
-
state()
|
|
1239
|
-
], DxGrid.prototype, "templateGridColumns", void 0);
|
|
1240
|
-
_ts_decorate2([
|
|
1241
|
-
state()
|
|
1242
|
-
], DxGrid.prototype, "templatefrozenColsStart", void 0);
|
|
1243
|
-
_ts_decorate2([
|
|
1244
|
-
state()
|
|
1245
|
-
], DxGrid.prototype, "templatefrozenColsEnd", void 0);
|
|
1246
|
-
_ts_decorate2([
|
|
1247
|
-
state()
|
|
1248
|
-
], DxGrid.prototype, "templateGridRows", void 0);
|
|
1249
|
-
_ts_decorate2([
|
|
745
|
+
_ts_decorate([
|
|
1250
746
|
state()
|
|
1251
|
-
], DxGrid.prototype, "
|
|
1252
|
-
|
|
747
|
+
], DxGrid.prototype, "templateColumns", void 0);
|
|
748
|
+
_ts_decorate([
|
|
1253
749
|
state()
|
|
1254
|
-
], DxGrid.prototype, "
|
|
1255
|
-
|
|
750
|
+
], DxGrid.prototype, "templateRows", void 0);
|
|
751
|
+
_ts_decorate([
|
|
1256
752
|
state()
|
|
1257
753
|
], DxGrid.prototype, "pointer", void 0);
|
|
1258
|
-
|
|
754
|
+
_ts_decorate([
|
|
1259
755
|
state()
|
|
1260
756
|
], DxGrid.prototype, "colSizes", void 0);
|
|
1261
|
-
|
|
757
|
+
_ts_decorate([
|
|
1262
758
|
state()
|
|
1263
759
|
], DxGrid.prototype, "rowSizes", void 0);
|
|
1264
|
-
|
|
760
|
+
_ts_decorate([
|
|
1265
761
|
state()
|
|
1266
762
|
], DxGrid.prototype, "focusActive", void 0);
|
|
1267
|
-
|
|
763
|
+
_ts_decorate([
|
|
1268
764
|
state()
|
|
1269
765
|
], DxGrid.prototype, "focusedCell", void 0);
|
|
1270
|
-
|
|
766
|
+
_ts_decorate([
|
|
1271
767
|
state()
|
|
1272
768
|
], DxGrid.prototype, "selectionStart", void 0);
|
|
1273
|
-
|
|
769
|
+
_ts_decorate([
|
|
1274
770
|
state()
|
|
1275
771
|
], DxGrid.prototype, "selectionEnd", void 0);
|
|
1276
|
-
|
|
1277
|
-
state()
|
|
1278
|
-
], DxGrid.prototype, "intrinsicInlineSize", void 0);
|
|
1279
|
-
_ts_decorate2([
|
|
1280
|
-
state()
|
|
1281
|
-
], DxGrid.prototype, "intrinsicBlockSize", void 0);
|
|
1282
|
-
_ts_decorate2([
|
|
772
|
+
_ts_decorate([
|
|
1283
773
|
state()
|
|
1284
774
|
], DxGrid.prototype, "observer", void 0);
|
|
1285
|
-
|
|
1286
|
-
|
|
775
|
+
_ts_decorate([
|
|
776
|
+
eventOptions({
|
|
777
|
+
capture: true
|
|
778
|
+
})
|
|
779
|
+
], DxGrid.prototype, "handleFocus", null);
|
|
780
|
+
_ts_decorate([
|
|
781
|
+
eventOptions({
|
|
782
|
+
capture: true
|
|
783
|
+
})
|
|
784
|
+
], DxGrid.prototype, "handleBlur", null);
|
|
785
|
+
DxGrid = _ts_decorate([
|
|
786
|
+
customElement("dx-grid")
|
|
1287
787
|
], DxGrid);
|
|
1288
788
|
export {
|
|
1289
789
|
DxAxisResize,
|
|
1290
|
-
DxAxisResizeInternal,
|
|
1291
790
|
DxEditRequest,
|
|
1292
791
|
DxGrid,
|
|
1293
|
-
DxGridCellsSelect
|
|
1294
|
-
colToA1Notation,
|
|
1295
|
-
rowToA1Notation
|
|
792
|
+
DxGridCellsSelect
|
|
1296
793
|
};
|
|
1297
794
|
//# sourceMappingURL=index.mjs.map
|