@dxos/lit-grid 0.6.12-main.568932b → 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.
- package/dist/lib/browser/index.mjs +294 -918
- 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 +41 -90
- 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 +10 -76
- package/dist/types/src/types.d.ts.map +1 -1
- package/package.json +1 -2
- package/src/dx-grid.lit-stories.ts +17 -141
- package/src/dx-grid.pcss +66 -61
- package/src/dx-grid.ts +312 -823
- package/src/types.ts +10 -100
- 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/dist/types/src/util.d.ts +0 -9
- package/dist/types/src/util.d.ts.map +0 -1
- package/src/dx-grid-axis-resize-handle.ts +0 -87
- package/src/util.ts +0 -28
|
@@ -1,202 +1,46 @@
|
|
|
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";
|
|
14
|
-
|
|
15
|
-
// packages/ui/lit-grid/src/util.ts
|
|
16
|
-
var separator = ",";
|
|
17
|
-
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
|
-
};
|
|
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";
|
|
24
5
|
|
|
25
6
|
// packages/ui/lit-grid/src/types.ts
|
|
26
7
|
var DxAxisResize = class extends Event {
|
|
27
8
|
constructor(props) {
|
|
28
9
|
super("dx-axis-resize");
|
|
29
10
|
this.axis = props.axis;
|
|
30
|
-
this.plane = props.plane;
|
|
31
11
|
this.index = props.index;
|
|
32
12
|
this.size = props.size;
|
|
33
13
|
}
|
|
34
14
|
};
|
|
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
15
|
var DxEditRequest = class extends Event {
|
|
50
16
|
constructor(props) {
|
|
51
17
|
super("dx-edit-request");
|
|
52
18
|
this.cellIndex = props.cellIndex;
|
|
53
19
|
this.cellBox = props.cellBox;
|
|
54
|
-
this.initialContent = props.initialContent;
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
var DxGridCellsSelect = class extends Event {
|
|
58
|
-
constructor({ start, end }) {
|
|
59
|
-
super("dx-grid-cells-select");
|
|
60
|
-
this.start = toCellIndex(start);
|
|
61
|
-
this.end = toCellIndex(end);
|
|
62
|
-
this.minCol = Math.min(start.col, end.col);
|
|
63
|
-
this.maxCol = Math.max(start.col, end.col);
|
|
64
|
-
this.minRow = Math.min(start.row, end.row);
|
|
65
|
-
this.maxRow = Math.max(start.row, end.row);
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
|
|
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
20
|
}
|
|
134
21
|
};
|
|
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
22
|
|
|
159
23
|
// packages/ui/lit-grid/src/dx-grid.ts
|
|
160
|
-
function
|
|
24
|
+
function _ts_decorate(decorators, target, key, desc) {
|
|
161
25
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
162
26
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
163
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;
|
|
164
28
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
165
29
|
}
|
|
166
30
|
var gap = 1;
|
|
167
|
-
var resizeTolerance =
|
|
168
|
-
var selectTolerance = 4;
|
|
31
|
+
var resizeTolerance = 8;
|
|
169
32
|
var overscanCol = 1;
|
|
170
33
|
var overscanRow = 1;
|
|
171
34
|
var sizeColMin = 32;
|
|
172
35
|
var sizeColMax = 1024;
|
|
173
36
|
var sizeRowMin = 16;
|
|
174
37
|
var sizeRowMax = 1024;
|
|
175
|
-
var
|
|
176
|
-
|
|
177
|
-
|
|
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
|
-
};
|
|
38
|
+
var separator = ",";
|
|
39
|
+
var colToA1Notation = (col) => {
|
|
40
|
+
return (col >= 26 ? String.fromCharCode("A".charCodeAt(0) + Math.floor(col / 26) - 1) : "") + String.fromCharCode("A".charCodeAt(0) + col % 26);
|
|
197
41
|
};
|
|
198
|
-
var
|
|
199
|
-
return
|
|
42
|
+
var rowToA1Notation = (row) => {
|
|
43
|
+
return `${row + 1}`;
|
|
200
44
|
};
|
|
201
45
|
var closestAction = (target) => {
|
|
202
46
|
const actionEl = target?.closest("[data-dx-grid-action]") ?? null;
|
|
@@ -216,9 +60,7 @@ var closestCell = (target, actionEl) => {
|
|
|
216
60
|
if (cellElement) {
|
|
217
61
|
const col = parseInt(cellElement.getAttribute("aria-colindex") ?? "never");
|
|
218
62
|
const row = parseInt(cellElement.getAttribute("aria-rowindex") ?? "never");
|
|
219
|
-
const plane = cellElement.closest("[data-dx-grid-plane]")?.getAttribute("data-dx-grid-plane") ?? "grid";
|
|
220
63
|
return {
|
|
221
|
-
plane,
|
|
222
64
|
col,
|
|
223
65
|
row
|
|
224
66
|
};
|
|
@@ -226,92 +68,24 @@ var closestCell = (target, actionEl) => {
|
|
|
226
68
|
return null;
|
|
227
69
|
}
|
|
228
70
|
};
|
|
229
|
-
var
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
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 {
|
|
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}`;
|
|
73
|
+
var localChId = (c0) => `ch--${c0}`;
|
|
74
|
+
var localRhId = (r0) => `rh--${r0}`;
|
|
75
|
+
var getPage = (axis, event) => axis === "col" ? event.pageX : event.pageY;
|
|
76
|
+
var DxGrid = class extends LitElement {
|
|
281
77
|
constructor() {
|
|
282
|
-
super();
|
|
283
|
-
this.gridId = "default-grid-id";
|
|
78
|
+
super(...arguments);
|
|
284
79
|
this.rowDefault = {
|
|
285
|
-
|
|
286
|
-
size: defaultRowSize
|
|
287
|
-
}
|
|
80
|
+
size: 32
|
|
288
81
|
};
|
|
289
82
|
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: {}
|
|
83
|
+
size: 180
|
|
302
84
|
};
|
|
85
|
+
this.rows = {};
|
|
86
|
+
this.columns = {};
|
|
87
|
+
this.cells = {};
|
|
303
88
|
this.mode = "browse";
|
|
304
|
-
this.limitColumns = Infinity;
|
|
305
|
-
this.limitRows = Infinity;
|
|
306
|
-
this.frozen = {};
|
|
307
|
-
/**
|
|
308
|
-
* When this function is defined, it is used first to try to get a value for a cell, and otherwise will fall back
|
|
309
|
-
* to `cells`.
|
|
310
|
-
*/
|
|
311
|
-
this.getCells = null;
|
|
312
|
-
this.cells = {
|
|
313
|
-
grid: {}
|
|
314
|
-
};
|
|
315
89
|
//
|
|
316
90
|
// `pos`, short for ‘position’, is the position in pixels of the viewport from the origin.
|
|
317
91
|
//
|
|
@@ -331,9 +105,9 @@ var DxGrid = class extends LitElement2 {
|
|
|
331
105
|
// `bin`, not short for anything, is the range in pixels within which virtualization does not need to reassess.
|
|
332
106
|
//
|
|
333
107
|
this.binInlineMin = 0;
|
|
334
|
-
this.binInlineMax =
|
|
108
|
+
this.binInlineMax = this.colSize(0);
|
|
335
109
|
this.binBlockMin = 0;
|
|
336
|
-
this.binBlockMax =
|
|
110
|
+
this.binBlockMax = this.rowSize(0);
|
|
337
111
|
//
|
|
338
112
|
// `vis`, short for ‘visible’, is the range in numeric index of the columns or rows which should be rendered within
|
|
339
113
|
// the viewport. These start with naïve values that are updated before first contentful render.
|
|
@@ -345,89 +119,68 @@ var DxGrid = class extends LitElement2 {
|
|
|
345
119
|
//
|
|
346
120
|
// `template` is the rendered value of `grid-{axis}-template`.
|
|
347
121
|
//
|
|
348
|
-
this.
|
|
349
|
-
this.
|
|
350
|
-
this.templatefrozenColsEnd = "";
|
|
351
|
-
this.templateGridRows = "0";
|
|
352
|
-
this.templatefrozenRowsStart = "";
|
|
353
|
-
this.templatefrozenRowsEnd = "";
|
|
122
|
+
this.templateColumns = `${this.colSize(0)}px`;
|
|
123
|
+
this.templateRows = `${this.rowSize(0)}px`;
|
|
354
124
|
//
|
|
355
|
-
//
|
|
125
|
+
// Resize state
|
|
356
126
|
//
|
|
357
|
-
this.
|
|
358
|
-
this.
|
|
359
|
-
|
|
360
|
-
};
|
|
361
|
-
this.rowSizes = {
|
|
362
|
-
grid: {}
|
|
363
|
-
};
|
|
364
|
-
this.focusActive = false;
|
|
365
|
-
this.focusedCell = {
|
|
366
|
-
plane: "grid",
|
|
367
|
-
col: 0,
|
|
368
|
-
row: 0
|
|
369
|
-
};
|
|
370
|
-
this.selectionStart = {
|
|
371
|
-
plane: "grid",
|
|
372
|
-
col: 0,
|
|
373
|
-
row: 0
|
|
374
|
-
};
|
|
375
|
-
this.selectionEnd = {
|
|
376
|
-
plane: "grid",
|
|
377
|
-
col: 0,
|
|
378
|
-
row: 0
|
|
379
|
-
};
|
|
127
|
+
this.colSizes = {};
|
|
128
|
+
this.rowSizes = {};
|
|
129
|
+
this.resizing = null;
|
|
380
130
|
//
|
|
381
|
-
//
|
|
131
|
+
// Primary pointer and keyboard handlers
|
|
382
132
|
//
|
|
383
|
-
this.intrinsicInlineSize = Infinity;
|
|
384
|
-
this.intrinsicBlockSize = Infinity;
|
|
385
133
|
this.handlePointerDown = (event) => {
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
if (action) {
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
this.dispatchEditRequest();
|
|
405
|
-
}
|
|
406
|
-
}
|
|
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
|
+
}));
|
|
407
152
|
}
|
|
408
153
|
}
|
|
409
154
|
}
|
|
410
155
|
};
|
|
411
|
-
this.handlePointerUp = (
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
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;
|
|
419
165
|
}
|
|
420
|
-
this.pointer = null;
|
|
421
166
|
};
|
|
422
167
|
this.handlePointerMove = (event) => {
|
|
423
|
-
if (
|
|
424
|
-
this.
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
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();
|
|
431
184
|
}
|
|
432
185
|
}
|
|
433
186
|
};
|
|
@@ -443,51 +196,25 @@ var DxGrid = class extends LitElement2 {
|
|
|
443
196
|
this.sizeInline = inlineSize;
|
|
444
197
|
this.sizeBlock = blockSize;
|
|
445
198
|
this.updateVis();
|
|
446
|
-
queueMicrotask(() => this.updatePos());
|
|
447
199
|
}
|
|
448
200
|
});
|
|
449
201
|
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
202
|
this.handleWheel = ({ deltaX, deltaY }) => {
|
|
461
203
|
if (this.mode === "browse") {
|
|
462
|
-
this.
|
|
204
|
+
this.posInline = Math.max(0, this.posInline + deltaX);
|
|
205
|
+
this.posBlock = Math.max(0, this.posBlock + deltaY);
|
|
206
|
+
if (this.posInline >= this.binInlineMin && this.posInline < this.binInlineMax && this.posBlock >= this.binBlockMin && this.posBlock < this.binBlockMax) {
|
|
207
|
+
} else {
|
|
208
|
+
this.updateVis();
|
|
209
|
+
}
|
|
463
210
|
}
|
|
464
211
|
};
|
|
465
|
-
|
|
466
|
-
this.
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
this.
|
|
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
|
-
}
|
|
481
|
-
//
|
|
482
|
-
// Primary pointer and keyboard handlers
|
|
483
|
-
//
|
|
484
|
-
dispatchEditRequest(initialContent) {
|
|
485
|
-
this.snapPosToFocusedCell();
|
|
486
|
-
queueMicrotask(() => this.dispatchEvent(new DxEditRequest({
|
|
487
|
-
cellIndex: toCellIndex(this.focusedCell),
|
|
488
|
-
cellBox: this.focusedCellBox(),
|
|
489
|
-
initialContent
|
|
490
|
-
})));
|
|
212
|
+
// Focus handlers
|
|
213
|
+
this.focusedCell = {
|
|
214
|
+
col: 0,
|
|
215
|
+
row: 0
|
|
216
|
+
};
|
|
217
|
+
this.focusActive = false;
|
|
491
218
|
}
|
|
492
219
|
handleKeydown(event) {
|
|
493
220
|
if (this.focusActive && this.mode === "browse") {
|
|
@@ -495,7 +222,7 @@ var DxGrid = class extends LitElement2 {
|
|
|
495
222
|
case "ArrowDown":
|
|
496
223
|
this.focusedCell = {
|
|
497
224
|
...this.focusedCell,
|
|
498
|
-
row:
|
|
225
|
+
row: this.focusedCell.row + 1
|
|
499
226
|
};
|
|
500
227
|
break;
|
|
501
228
|
case "ArrowUp":
|
|
@@ -507,7 +234,7 @@ var DxGrid = class extends LitElement2 {
|
|
|
507
234
|
case "ArrowRight":
|
|
508
235
|
this.focusedCell = {
|
|
509
236
|
...this.focusedCell,
|
|
510
|
-
col:
|
|
237
|
+
col: this.focusedCell.col + 1
|
|
511
238
|
};
|
|
512
239
|
break;
|
|
513
240
|
case "ArrowLeft":
|
|
@@ -519,12 +246,10 @@ var DxGrid = class extends LitElement2 {
|
|
|
519
246
|
}
|
|
520
247
|
switch (event.key) {
|
|
521
248
|
case "Enter":
|
|
522
|
-
this.
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
this.dispatchEditRequest(event.key);
|
|
527
|
-
}
|
|
249
|
+
this.dispatchEvent(new DxEditRequest({
|
|
250
|
+
cellIndex: toCellIndex(this.focusedCell),
|
|
251
|
+
cellBox: this.focusedCellBox()
|
|
252
|
+
}));
|
|
528
253
|
break;
|
|
529
254
|
}
|
|
530
255
|
switch (event.key) {
|
|
@@ -541,26 +266,20 @@ var DxGrid = class extends LitElement2 {
|
|
|
541
266
|
//
|
|
542
267
|
// Accessors
|
|
543
268
|
//
|
|
544
|
-
colSize(c
|
|
545
|
-
|
|
546
|
-
return this.colSizes?.[resolvedPlane]?.[c] ?? this.columnDefault[resolvedPlane]?.size ?? defaultColSize;
|
|
547
|
-
}
|
|
548
|
-
rowSize(r, plane) {
|
|
549
|
-
const resolvedPlane = resolveRowPlane(plane);
|
|
550
|
-
return this.rowSizes?.[resolvedPlane]?.[r] ?? this.rowDefault[resolvedPlane]?.size ?? defaultRowSize;
|
|
269
|
+
colSize(c) {
|
|
270
|
+
return this.colSizes?.[c] ?? this.columnDefault.size;
|
|
551
271
|
}
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
return this.cells?.[plane]?.[index] ?? this.initialCells?.[plane]?.[index];
|
|
272
|
+
rowSize(r) {
|
|
273
|
+
return this.rowSizes?.[r] ?? this.rowDefault.size;
|
|
555
274
|
}
|
|
556
|
-
|
|
557
|
-
return this.
|
|
275
|
+
cell(c, r) {
|
|
276
|
+
return this.cells[`${c}${separator}${r}`];
|
|
558
277
|
}
|
|
559
278
|
focusedCellBox() {
|
|
560
279
|
const cellElement = this.focusedCellElement();
|
|
561
280
|
const cellSize = {
|
|
562
|
-
inlineSize: this.colSize(this.focusedCell.col
|
|
563
|
-
blockSize: this.rowSize(this.focusedCell.row
|
|
281
|
+
inlineSize: this.colSize(this.focusedCell.col),
|
|
282
|
+
blockSize: this.rowSize(this.focusedCell.row)
|
|
564
283
|
};
|
|
565
284
|
if (!cellElement) {
|
|
566
285
|
return {
|
|
@@ -580,168 +299,60 @@ var DxGrid = class extends LitElement2 {
|
|
|
580
299
|
...cellSize
|
|
581
300
|
};
|
|
582
301
|
}
|
|
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
302
|
updateVisInline() {
|
|
596
303
|
let colIndex = 0;
|
|
597
|
-
let pxInline = this.colSize(colIndex
|
|
304
|
+
let pxInline = this.colSize(colIndex);
|
|
598
305
|
while (pxInline < this.posInline) {
|
|
599
306
|
colIndex += 1;
|
|
600
|
-
pxInline += this.colSize(colIndex
|
|
307
|
+
pxInline += this.colSize(colIndex) + gap;
|
|
601
308
|
}
|
|
602
309
|
this.visColMin = colIndex - overscanCol;
|
|
603
|
-
this.binInlineMin = pxInline - this.colSize(colIndex
|
|
310
|
+
this.binInlineMin = pxInline - this.colSize(colIndex) - gap;
|
|
604
311
|
this.binInlineMax = pxInline + gap;
|
|
605
312
|
this.overscanInline = [
|
|
606
313
|
...Array(overscanCol)
|
|
607
314
|
].reduce((acc, _, c0) => {
|
|
608
|
-
acc += this.colSize(this.visColMin + c0
|
|
315
|
+
acc += this.colSize(this.visColMin + c0);
|
|
609
316
|
return acc;
|
|
610
317
|
}, 0) + gap * (overscanCol - 1);
|
|
611
|
-
while (pxInline < this.binInlineMax + this.sizeInline
|
|
318
|
+
while (pxInline < this.binInlineMax + this.sizeInline + gap) {
|
|
612
319
|
colIndex += 1;
|
|
613
|
-
pxInline += this.colSize(colIndex
|
|
320
|
+
pxInline += this.colSize(colIndex) + gap;
|
|
614
321
|
}
|
|
615
|
-
this.visColMax =
|
|
616
|
-
this.
|
|
322
|
+
this.visColMax = colIndex + overscanCol;
|
|
323
|
+
this.templateColumns = [
|
|
617
324
|
...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(" ");
|
|
325
|
+
].map((_, c0) => `${this.colSize(this.visColMin + c0)}px`).join(" ");
|
|
625
326
|
}
|
|
626
327
|
updateVisBlock() {
|
|
627
328
|
let rowIndex = 0;
|
|
628
|
-
let pxBlock = this.rowSize(rowIndex
|
|
329
|
+
let pxBlock = this.rowSize(rowIndex);
|
|
629
330
|
while (pxBlock < this.posBlock) {
|
|
630
331
|
rowIndex += 1;
|
|
631
|
-
pxBlock += this.rowSize(rowIndex
|
|
332
|
+
pxBlock += this.rowSize(rowIndex) + gap;
|
|
632
333
|
}
|
|
633
334
|
this.visRowMin = rowIndex - overscanRow;
|
|
634
|
-
this.binBlockMin = pxBlock - this.rowSize(rowIndex
|
|
335
|
+
this.binBlockMin = pxBlock - this.rowSize(rowIndex) - gap;
|
|
635
336
|
this.binBlockMax = pxBlock + gap;
|
|
636
337
|
this.overscanBlock = [
|
|
637
338
|
...Array(overscanRow)
|
|
638
339
|
].reduce((acc, _, r0) => {
|
|
639
|
-
acc += this.rowSize(this.visRowMin + r0
|
|
340
|
+
acc += this.rowSize(this.visRowMin + r0);
|
|
640
341
|
return acc;
|
|
641
342
|
}, 0) + gap * (overscanRow - 1);
|
|
642
|
-
while (pxBlock < this.binBlockMax + this.sizeBlock
|
|
343
|
+
while (pxBlock < this.binBlockMax + this.sizeBlock) {
|
|
643
344
|
rowIndex += 1;
|
|
644
|
-
pxBlock += this.rowSize(rowIndex
|
|
345
|
+
pxBlock += this.rowSize(rowIndex) + gap;
|
|
645
346
|
}
|
|
646
|
-
this.visRowMax =
|
|
647
|
-
this.
|
|
347
|
+
this.visRowMax = rowIndex + overscanRow;
|
|
348
|
+
this.templateRows = [
|
|
648
349
|
...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(" ");
|
|
350
|
+
].map((_, r0) => `${this.rowSize(this.visRowMin + r0)}px`).join(" ");
|
|
656
351
|
}
|
|
657
352
|
updateVis() {
|
|
658
353
|
this.updateVisInline();
|
|
659
354
|
this.updateVisBlock();
|
|
660
355
|
}
|
|
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
|
-
// Focus handlers
|
|
745
356
|
handleFocus(event) {
|
|
746
357
|
const cellCoords = closestCell(event.target);
|
|
747
358
|
if (cellCoords) {
|
|
@@ -750,298 +361,136 @@ var DxGrid = class extends LitElement2 {
|
|
|
750
361
|
}
|
|
751
362
|
}
|
|
752
363
|
handleBlur(event) {
|
|
753
|
-
if (!event.relatedTarget ||
|
|
364
|
+
if (!event.relatedTarget || event.relatedTarget.closest(".dx-grid__viewport") !== this.viewportRef.value) {
|
|
754
365
|
this.focusActive = false;
|
|
755
366
|
}
|
|
756
367
|
}
|
|
757
368
|
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
|
-
}
|
|
369
|
+
return this.viewportRef.value?.querySelector(`[aria-colindex="${this.focusedCell.col}"][aria-rowindex="${this.focusedCell.row}"]`);
|
|
795
370
|
}
|
|
796
371
|
/**
|
|
797
372
|
* Moves focus to the cell with actual focus, otherwise moves focus to the viewport.
|
|
798
373
|
*/
|
|
799
|
-
refocus(increment
|
|
374
|
+
refocus(increment) {
|
|
800
375
|
switch (increment) {
|
|
801
|
-
case "
|
|
376
|
+
case "down":
|
|
802
377
|
this.focusedCell = {
|
|
803
378
|
...this.focusedCell,
|
|
804
|
-
row: this.focusedCell.row +
|
|
379
|
+
row: this.focusedCell.row + 1
|
|
805
380
|
};
|
|
806
381
|
break;
|
|
807
|
-
case "
|
|
382
|
+
case "right":
|
|
808
383
|
this.focusedCell = {
|
|
809
384
|
...this.focusedCell,
|
|
810
|
-
col: this.focusedCell.col +
|
|
385
|
+
col: this.focusedCell.col + 1
|
|
811
386
|
};
|
|
812
387
|
}
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
}
|
|
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
|
-
});
|
|
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({
|
|
389
|
+
preventScroll: true
|
|
821
390
|
});
|
|
822
391
|
}
|
|
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
|
-
}
|
|
833
392
|
/**
|
|
834
393
|
* Updates `pos` so that a cell in focus is fully within the viewport
|
|
835
394
|
*/
|
|
836
395
|
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();
|
|
396
|
+
if (this.focusedCell.col < this.visColMin || this.focusedCell.col > this.visColMax || this.focusedCell.row < this.visRowMin || this.focusedCell.row > this.visRowMax) {
|
|
397
|
+
} 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
398
|
} else {
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
399
|
+
if (this.focusedCell.col <= this.visColMin + overscanCol) {
|
|
400
|
+
this.posInline = this.binInlineMin;
|
|
401
|
+
this.updateVisInline();
|
|
402
|
+
} else if (this.focusedCell.col >= this.visColMax - overscanCol - 1) {
|
|
403
|
+
const sizeSumCol = [
|
|
404
|
+
...Array(this.focusedCell.col - this.visColMin)
|
|
405
|
+
].reduce((acc, _, c0) => {
|
|
406
|
+
acc += this.colSize(this.visColMin + overscanCol + c0) + gap;
|
|
407
|
+
return acc;
|
|
408
|
+
}, 0);
|
|
409
|
+
this.posInline = this.binInlineMin + sizeSumCol + gap * 2 - this.sizeInline;
|
|
410
|
+
this.updateVisInline();
|
|
411
|
+
}
|
|
412
|
+
if (this.focusedCell.row <= this.visRowMin + overscanRow) {
|
|
413
|
+
this.posBlock = this.binBlockMin;
|
|
414
|
+
this.updateVisBlock();
|
|
415
|
+
} else if (this.focusedCell.row >= this.visRowMax - overscanRow - 1) {
|
|
416
|
+
const sizeSumRow = [
|
|
417
|
+
...Array(this.focusedCell.row - this.visRowMin)
|
|
418
|
+
].reduce((acc, _, r0) => {
|
|
419
|
+
acc += this.rowSize(this.visRowMin + overscanRow + r0) + gap;
|
|
420
|
+
return acc;
|
|
421
|
+
}, 0);
|
|
422
|
+
this.posBlock = this.binBlockMin + sizeSumRow + gap * 2 - this.sizeBlock;
|
|
423
|
+
this.updateVisBlock();
|
|
424
|
+
}
|
|
921
425
|
}
|
|
922
426
|
}
|
|
923
427
|
//
|
|
924
428
|
// Render and other lifecycle methods
|
|
925
429
|
//
|
|
926
|
-
|
|
927
|
-
const
|
|
928
|
-
const
|
|
929
|
-
const
|
|
930
|
-
const
|
|
931
|
-
return
|
|
430
|
+
render() {
|
|
431
|
+
const visibleCols = this.visColMax - this.visColMin;
|
|
432
|
+
const visibleRows = this.visRowMax - this.visRowMin;
|
|
433
|
+
const offsetInline = gap + this.binInlineMin - this.posInline - this.overscanInline;
|
|
434
|
+
const offsetBlock = gap + this.binBlockMin - this.posBlock - this.overscanBlock;
|
|
435
|
+
return html`<div
|
|
436
|
+
role="none"
|
|
437
|
+
class="dx-grid"
|
|
438
|
+
@pointerdown=${this.handlePointerDown}
|
|
439
|
+
@pointerup=${this.handlePointerUp}
|
|
440
|
+
@pointermove=${this.handlePointerMove}
|
|
441
|
+
@focus=${this.handleFocus}
|
|
442
|
+
@blur=${this.handleBlur}
|
|
443
|
+
@keydown=${this.handleKeydown}
|
|
444
|
+
>
|
|
445
|
+
<div role="none" class="dx-grid__corner"></div>
|
|
446
|
+
<div role="none" class="dx-grid__columnheader">
|
|
447
|
+
<div
|
|
932
448
|
role="none"
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
style=${styleMap({
|
|
936
|
-
"grid-template-columns": this[`template${colPlane}`],
|
|
937
|
-
"grid-template-rows": this[`template${rowPlane}`]
|
|
938
|
-
})}
|
|
449
|
+
class="dx-grid__columnheader__content"
|
|
450
|
+
style="transform:translate3d(${offsetInline}px,0,0);grid-template-columns:${this.templateColumns};"
|
|
939
451
|
>
|
|
940
452
|
${[
|
|
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
453
|
...Array(visibleCols)
|
|
963
454
|
].map((_, c0) => {
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
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
|
-
});
|
|
455
|
+
const c = this.visColMin + c0;
|
|
456
|
+
return html`<div
|
|
457
|
+
role="columnheader"
|
|
458
|
+
?inert=${c < 0}
|
|
459
|
+
style="block-size:${this.rowDefault.size}px;grid-column:${c0 + 1}/${c0 + 2};"
|
|
460
|
+
>
|
|
461
|
+
<span id=${localChId(c0)}>${colToA1Notation(c)}</span>
|
|
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>`}
|
|
465
|
+
</div>`;
|
|
993
466
|
})}
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
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
|
-
render() {
|
|
1022
|
-
const visibleCols = this.visColMax - this.visColMin;
|
|
1023
|
-
const visibleRows = this.visRowMax - this.visRowMin;
|
|
1024
|
-
const offsetInline = this.binInlineMin - this.posInline - this.overscanInline;
|
|
1025
|
-
const offsetBlock = this.binBlockMin - this.posBlock - this.overscanBlock;
|
|
1026
|
-
const selection = selectionProps(this.selectionStart, this.selectionEnd);
|
|
1027
|
-
return html2`<div
|
|
1028
|
-
role="none"
|
|
1029
|
-
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" : ""}`
|
|
467
|
+
</div>
|
|
468
|
+
</div>
|
|
469
|
+
<div role="none" class="dx-grid__corner"></div>
|
|
470
|
+
<div role="none" class="dx-grid__rowheader">
|
|
471
|
+
<div
|
|
472
|
+
role="none"
|
|
473
|
+
class="dx-grid__rowheader__content"
|
|
474
|
+
style="transform:translate3d(0,${offsetBlock}px,0);grid-template-rows:${this.templateRows};"
|
|
475
|
+
>
|
|
476
|
+
${[
|
|
477
|
+
...Array(visibleRows)
|
|
478
|
+
].map((_, r0) => {
|
|
479
|
+
const r = this.visRowMin + r0;
|
|
480
|
+
return html`<div role="rowheader" ?inert=${r < 0} style="grid-row:${r0 + 1}/${r0 + 2}">
|
|
481
|
+
<span id=${localRhId(r0)}>${rowToA1Notation(r)}</span>
|
|
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>`}
|
|
485
|
+
</div>`;
|
|
1033
486
|
})}
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
>
|
|
1038
|
-
${this.renderFixed("fixedStartStart", selection)}${this.renderFrozenRows("frozenRowsStart", visibleCols, offsetInline, selection)}${this.renderFixed("fixedStartEnd", selection)}${this.renderFrozenColumns("frozenColsStart", visibleRows, offsetBlock, selection)}
|
|
1039
|
-
<div role="grid" class="dx-grid__plane--grid" tabindex="0" ${ref2(this.viewportRef)}>
|
|
487
|
+
</div>
|
|
488
|
+
</div>
|
|
489
|
+
<div role="grid" class="dx-grid__viewport" tabindex="0" @wheel=${this.handleWheel} ${ref(this.viewportRef)}>
|
|
1040
490
|
<div
|
|
1041
491
|
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};"
|
|
492
|
+
class="dx-grid__content"
|
|
493
|
+
style="transform:translate3d(${offsetInline}px,${offsetBlock}px,0);grid-template-columns:${this.templateColumns};grid-template-rows:${this.templateRows};"
|
|
1045
494
|
>
|
|
1046
495
|
${[
|
|
1047
496
|
...Array(visibleCols)
|
|
@@ -1051,84 +500,52 @@ var DxGrid = class extends LitElement2 {
|
|
|
1051
500
|
].map((_2, r0) => {
|
|
1052
501
|
const c = c0 + this.visColMin;
|
|
1053
502
|
const r = r0 + this.visRowMin;
|
|
1054
|
-
|
|
503
|
+
const cell = this.cell(c, r);
|
|
504
|
+
return html`<div
|
|
505
|
+
role="gridcell"
|
|
506
|
+
tabindex="0"
|
|
507
|
+
?inert=${c < 0 || r < 0}
|
|
508
|
+
aria-rowindex=${r}
|
|
509
|
+
aria-colindex=${c}
|
|
510
|
+
data-dx-grid-action="cell"
|
|
511
|
+
style="grid-column:${c0 + 1};grid-row:${r0 + 1}"
|
|
512
|
+
>
|
|
513
|
+
${cell?.value}
|
|
514
|
+
</div>`;
|
|
1055
515
|
});
|
|
1056
516
|
})}
|
|
1057
517
|
</div>
|
|
1058
518
|
</div>
|
|
1059
|
-
|
|
519
|
+
<div role="none" class="dx-grid__scrollbar" aria-orientation="vertical">
|
|
520
|
+
<div role="none" class="dx-grid__scrollbar__thumb"></div>
|
|
521
|
+
</div>
|
|
522
|
+
<div role="none" class="dx-grid__corner"></div>
|
|
523
|
+
<div role="none" class="dx-grid__scrollbar" aria-orientation="horizontal">
|
|
524
|
+
<div role="none" class="dx-grid__scrollbar__thumb"></div>
|
|
525
|
+
</div>
|
|
526
|
+
<div role="none" class="dx-grid__corner"></div>
|
|
1060
527
|
</div>`;
|
|
1061
528
|
}
|
|
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
529
|
firstUpdated() {
|
|
1077
|
-
if (this.getCells) {
|
|
1078
|
-
this.updateCells(true);
|
|
1079
|
-
}
|
|
1080
530
|
this.observer.observe(this.viewportRef.value);
|
|
1081
|
-
this.colSizes = Object.entries(this.columns).reduce((acc, [
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
}
|
|
1086
|
-
return planeAcc;
|
|
1087
|
-
}, {});
|
|
531
|
+
this.colSizes = Object.entries(this.columns).reduce((acc, [colId, colMeta]) => {
|
|
532
|
+
if (colMeta?.size) {
|
|
533
|
+
acc[colId] = colMeta.size;
|
|
534
|
+
}
|
|
1088
535
|
return acc;
|
|
1089
|
-
}, {
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
if (rowMeta?.size) {
|
|
1095
|
-
planeAcc[row] = rowMeta.size;
|
|
1096
|
-
}
|
|
1097
|
-
return planeAcc;
|
|
1098
|
-
}, {});
|
|
536
|
+
}, {});
|
|
537
|
+
this.rowSizes = Object.entries(this.rows).reduce((acc, [rowId, rowMeta]) => {
|
|
538
|
+
if (rowMeta?.size) {
|
|
539
|
+
acc[rowId] = rowMeta.size;
|
|
540
|
+
}
|
|
1099
541
|
return acc;
|
|
1100
|
-
}, {
|
|
1101
|
-
grid: {}
|
|
1102
|
-
});
|
|
1103
|
-
this.updateIntrinsicSizes();
|
|
1104
|
-
}
|
|
1105
|
-
willUpdate(changedProperties) {
|
|
1106
|
-
if (this.getCells && (changedProperties.has("initialCells") || changedProperties.has("visColMin") || changedProperties.has("visColMax") || changedProperties.has("visRowMin") || changedProperties.has("visRowMax"))) {
|
|
1107
|
-
this.updateCells();
|
|
1108
|
-
}
|
|
1109
|
-
if (changedProperties.has("rowDefault") || changedProperties.has("rows") || changedProperties.has("limitRows")) {
|
|
1110
|
-
this.updateIntrinsicBlockSize();
|
|
1111
|
-
this.updatePosBlock();
|
|
1112
|
-
this.updateVisBlock();
|
|
1113
|
-
}
|
|
1114
|
-
if (changedProperties.has("colDefault") || changedProperties.has("columns") || changedProperties.has("limitColumns")) {
|
|
1115
|
-
this.updateIntrinsicInlineSize();
|
|
1116
|
-
this.updatePosInline();
|
|
1117
|
-
this.updateVisInline();
|
|
1118
|
-
}
|
|
542
|
+
}, {});
|
|
1119
543
|
}
|
|
1120
544
|
updated(changedProperties) {
|
|
1121
545
|
if (this.focusActive && (changedProperties.has("visRowMin") || changedProperties.has("visColMin") || changedProperties.has("focusedCell"))) {
|
|
1122
546
|
this.refocus();
|
|
1123
547
|
}
|
|
1124
548
|
}
|
|
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
549
|
disconnectedCallback() {
|
|
1133
550
|
super.disconnectedCallback();
|
|
1134
551
|
if (this.viewportRef.value) {
|
|
@@ -1139,159 +556,118 @@ var DxGrid = class extends LitElement2 {
|
|
|
1139
556
|
return this;
|
|
1140
557
|
}
|
|
1141
558
|
};
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
type: String
|
|
1145
|
-
})
|
|
1146
|
-
], DxGrid.prototype, "gridId", void 0);
|
|
1147
|
-
_ts_decorate2([
|
|
1148
|
-
property2({
|
|
559
|
+
_ts_decorate([
|
|
560
|
+
property({
|
|
1149
561
|
type: Object
|
|
1150
562
|
})
|
|
1151
563
|
], DxGrid.prototype, "rowDefault", void 0);
|
|
1152
|
-
|
|
1153
|
-
|
|
564
|
+
_ts_decorate([
|
|
565
|
+
property({
|
|
1154
566
|
type: Object
|
|
1155
567
|
})
|
|
1156
568
|
], DxGrid.prototype, "columnDefault", void 0);
|
|
1157
|
-
|
|
1158
|
-
|
|
569
|
+
_ts_decorate([
|
|
570
|
+
property({
|
|
1159
571
|
type: Object
|
|
1160
572
|
})
|
|
1161
573
|
], DxGrid.prototype, "rows", void 0);
|
|
1162
|
-
|
|
1163
|
-
|
|
574
|
+
_ts_decorate([
|
|
575
|
+
property({
|
|
1164
576
|
type: Object
|
|
1165
577
|
})
|
|
1166
578
|
], DxGrid.prototype, "columns", void 0);
|
|
1167
|
-
|
|
1168
|
-
|
|
579
|
+
_ts_decorate([
|
|
580
|
+
property({
|
|
1169
581
|
type: Object
|
|
1170
582
|
})
|
|
1171
|
-
], DxGrid.prototype, "
|
|
1172
|
-
|
|
1173
|
-
|
|
583
|
+
], DxGrid.prototype, "cells", void 0);
|
|
584
|
+
_ts_decorate([
|
|
585
|
+
property({
|
|
1174
586
|
type: String
|
|
1175
587
|
})
|
|
1176
588
|
], 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([
|
|
1193
|
-
state()
|
|
1194
|
-
], DxGrid.prototype, "cells", void 0);
|
|
1195
|
-
_ts_decorate2([
|
|
589
|
+
_ts_decorate([
|
|
1196
590
|
state()
|
|
1197
591
|
], DxGrid.prototype, "posInline", void 0);
|
|
1198
|
-
|
|
592
|
+
_ts_decorate([
|
|
1199
593
|
state()
|
|
1200
594
|
], DxGrid.prototype, "posBlock", void 0);
|
|
1201
|
-
|
|
595
|
+
_ts_decorate([
|
|
1202
596
|
state()
|
|
1203
597
|
], DxGrid.prototype, "sizeInline", void 0);
|
|
1204
|
-
|
|
598
|
+
_ts_decorate([
|
|
1205
599
|
state()
|
|
1206
600
|
], DxGrid.prototype, "sizeBlock", void 0);
|
|
1207
|
-
|
|
601
|
+
_ts_decorate([
|
|
1208
602
|
state()
|
|
1209
603
|
], DxGrid.prototype, "overscanInline", void 0);
|
|
1210
|
-
|
|
604
|
+
_ts_decorate([
|
|
1211
605
|
state()
|
|
1212
606
|
], DxGrid.prototype, "overscanBlock", void 0);
|
|
1213
|
-
|
|
607
|
+
_ts_decorate([
|
|
1214
608
|
state()
|
|
1215
609
|
], DxGrid.prototype, "binInlineMin", void 0);
|
|
1216
|
-
|
|
610
|
+
_ts_decorate([
|
|
1217
611
|
state()
|
|
1218
612
|
], DxGrid.prototype, "binInlineMax", void 0);
|
|
1219
|
-
|
|
613
|
+
_ts_decorate([
|
|
1220
614
|
state()
|
|
1221
615
|
], DxGrid.prototype, "binBlockMin", void 0);
|
|
1222
|
-
|
|
616
|
+
_ts_decorate([
|
|
1223
617
|
state()
|
|
1224
618
|
], DxGrid.prototype, "binBlockMax", void 0);
|
|
1225
|
-
|
|
619
|
+
_ts_decorate([
|
|
1226
620
|
state()
|
|
1227
621
|
], DxGrid.prototype, "visColMin", void 0);
|
|
1228
|
-
|
|
622
|
+
_ts_decorate([
|
|
1229
623
|
state()
|
|
1230
624
|
], DxGrid.prototype, "visColMax", void 0);
|
|
1231
|
-
|
|
625
|
+
_ts_decorate([
|
|
1232
626
|
state()
|
|
1233
627
|
], DxGrid.prototype, "visRowMin", void 0);
|
|
1234
|
-
|
|
628
|
+
_ts_decorate([
|
|
1235
629
|
state()
|
|
1236
630
|
], 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([
|
|
1250
|
-
state()
|
|
1251
|
-
], DxGrid.prototype, "templatefrozenRowsStart", void 0);
|
|
1252
|
-
_ts_decorate2([
|
|
631
|
+
_ts_decorate([
|
|
1253
632
|
state()
|
|
1254
|
-
], DxGrid.prototype, "
|
|
1255
|
-
|
|
633
|
+
], DxGrid.prototype, "templateColumns", void 0);
|
|
634
|
+
_ts_decorate([
|
|
1256
635
|
state()
|
|
1257
|
-
], DxGrid.prototype, "
|
|
1258
|
-
|
|
636
|
+
], DxGrid.prototype, "templateRows", void 0);
|
|
637
|
+
_ts_decorate([
|
|
1259
638
|
state()
|
|
1260
639
|
], DxGrid.prototype, "colSizes", void 0);
|
|
1261
|
-
|
|
640
|
+
_ts_decorate([
|
|
1262
641
|
state()
|
|
1263
642
|
], DxGrid.prototype, "rowSizes", void 0);
|
|
1264
|
-
|
|
1265
|
-
state()
|
|
1266
|
-
], DxGrid.prototype, "focusActive", void 0);
|
|
1267
|
-
_ts_decorate2([
|
|
1268
|
-
state()
|
|
1269
|
-
], DxGrid.prototype, "focusedCell", void 0);
|
|
1270
|
-
_ts_decorate2([
|
|
1271
|
-
state()
|
|
1272
|
-
], DxGrid.prototype, "selectionStart", void 0);
|
|
1273
|
-
_ts_decorate2([
|
|
643
|
+
_ts_decorate([
|
|
1274
644
|
state()
|
|
1275
|
-
], DxGrid.prototype, "
|
|
1276
|
-
|
|
645
|
+
], DxGrid.prototype, "resizing", void 0);
|
|
646
|
+
_ts_decorate([
|
|
1277
647
|
state()
|
|
1278
|
-
], DxGrid.prototype, "
|
|
1279
|
-
|
|
648
|
+
], DxGrid.prototype, "observer", void 0);
|
|
649
|
+
_ts_decorate([
|
|
1280
650
|
state()
|
|
1281
|
-
], DxGrid.prototype, "
|
|
1282
|
-
|
|
651
|
+
], DxGrid.prototype, "focusedCell", void 0);
|
|
652
|
+
_ts_decorate([
|
|
1283
653
|
state()
|
|
1284
|
-
], DxGrid.prototype, "
|
|
1285
|
-
|
|
1286
|
-
|
|
654
|
+
], DxGrid.prototype, "focusActive", void 0);
|
|
655
|
+
_ts_decorate([
|
|
656
|
+
eventOptions({
|
|
657
|
+
capture: true
|
|
658
|
+
})
|
|
659
|
+
], DxGrid.prototype, "handleFocus", null);
|
|
660
|
+
_ts_decorate([
|
|
661
|
+
eventOptions({
|
|
662
|
+
capture: true
|
|
663
|
+
})
|
|
664
|
+
], DxGrid.prototype, "handleBlur", null);
|
|
665
|
+
DxGrid = _ts_decorate([
|
|
666
|
+
customElement("dx-grid")
|
|
1287
667
|
], DxGrid);
|
|
1288
668
|
export {
|
|
1289
669
|
DxAxisResize,
|
|
1290
|
-
DxAxisResizeInternal,
|
|
1291
670
|
DxEditRequest,
|
|
1292
|
-
DxGrid
|
|
1293
|
-
DxGridCellsSelect,
|
|
1294
|
-
colToA1Notation,
|
|
1295
|
-
rowToA1Notation
|
|
671
|
+
DxGrid
|
|
1296
672
|
};
|
|
1297
673
|
//# sourceMappingURL=index.mjs.map
|