@deephaven/grid 0.7.3-beta.8 → 0.8.2-beta.1
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/CellInputField.d.ts +4 -4
- package/dist/CellInputField.d.ts.map +1 -1
- package/dist/CellInputField.js +10 -11
- package/dist/CellInputField.js.map +1 -1
- package/dist/EditableGridModel.d.ts +70 -0
- package/dist/EditableGridModel.d.ts.map +1 -0
- package/dist/EditableGridModel.js +13 -0
- package/dist/EditableGridModel.js.map +1 -0
- package/dist/EventHandlerResult.d.ts +17 -0
- package/dist/EventHandlerResult.d.ts.map +1 -0
- package/dist/EventHandlerResult.js +2 -0
- package/dist/EventHandlerResult.js.map +1 -0
- package/dist/ExpandableGridModel.d.ts +34 -0
- package/dist/ExpandableGridModel.d.ts.map +1 -0
- package/dist/ExpandableGridModel.js +7 -0
- package/dist/ExpandableGridModel.js.map +1 -0
- package/dist/Grid.d.ts +283 -234
- package/dist/Grid.d.ts.map +1 -1
- package/dist/Grid.js +371 -165
- package/dist/Grid.js.map +1 -1
- package/dist/GridColorUtils.d.ts +22 -12
- package/dist/GridColorUtils.d.ts.map +1 -1
- package/dist/GridColorUtils.js +26 -21
- package/dist/GridColorUtils.js.map +1 -1
- package/dist/GridMetricCalculator.d.ts.map +1 -1
- package/dist/GridMetricCalculator.js +8 -41
- package/dist/GridMetricCalculator.js.map +1 -1
- package/dist/GridModel.d.ts +54 -60
- package/dist/GridModel.d.ts.map +1 -1
- package/dist/GridModel.js +54 -122
- package/dist/GridModel.js.map +1 -1
- package/dist/GridMouseHandler.d.ts +23 -24
- package/dist/GridMouseHandler.d.ts.map +1 -1
- package/dist/GridMouseHandler.js +6 -14
- package/dist/GridMouseHandler.js.map +1 -1
- package/dist/GridRange.d.ts +2 -2
- package/dist/GridRange.d.ts.map +1 -1
- package/dist/GridRange.js +1 -9
- package/dist/GridRange.js.map +1 -1
- package/dist/GridRenderer.d.ts +117 -69
- package/dist/GridRenderer.d.ts.map +1 -1
- package/dist/GridRenderer.js +183 -168
- package/dist/GridRenderer.js.map +1 -1
- package/dist/GridUtils.d.ts +4 -4
- package/dist/GridUtils.js +4 -4
- package/dist/GridUtils.js.map +1 -1
- package/dist/KeyHandler.d.ts +10 -7
- package/dist/KeyHandler.d.ts.map +1 -1
- package/dist/KeyHandler.js +6 -10
- package/dist/KeyHandler.js.map +1 -1
- package/dist/MockGridData.d.ts +1 -1
- package/dist/MockGridData.d.ts.map +1 -1
- package/dist/MockGridData.js.map +1 -1
- package/dist/MockGridModel.d.ts +39 -12
- package/dist/MockGridModel.d.ts.map +1 -1
- package/dist/MockGridModel.js +24 -10
- package/dist/MockGridModel.js.map +1 -1
- package/dist/MockTreeGridModel.d.ts +37 -22
- package/dist/MockTreeGridModel.d.ts.map +1 -1
- package/dist/MockTreeGridModel.js +32 -20
- package/dist/MockTreeGridModel.js.map +1 -1
- package/dist/errors/AssertionError.d.ts +5 -0
- package/dist/errors/AssertionError.d.ts.map +1 -0
- package/dist/errors/AssertionError.js +12 -0
- package/dist/errors/AssertionError.js.map +1 -0
- package/dist/errors/PasteError.d.ts +1 -1
- package/dist/errors/PasteError.d.ts.map +1 -1
- package/dist/errors/PasteError.js +1 -2
- package/dist/errors/PasteError.js.map +1 -1
- package/dist/errors/assertIsDefined.d.ts +3 -0
- package/dist/errors/assertIsDefined.d.ts.map +1 -0
- package/dist/errors/assertIsDefined.js +8 -0
- package/dist/errors/assertIsDefined.js.map +1 -0
- package/dist/errors/index.d.ts +2 -0
- package/dist/errors/index.d.ts.map +1 -1
- package/dist/errors/index.js +2 -1
- package/dist/errors/index.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/key-handlers/EditKeyHandler.d.ts +3 -2
- package/dist/key-handlers/EditKeyHandler.d.ts.map +1 -1
- package/dist/key-handlers/EditKeyHandler.js +10 -9
- package/dist/key-handlers/EditKeyHandler.js.map +1 -1
- package/dist/key-handlers/PasteKeyHandler.d.ts +3 -5
- package/dist/key-handlers/PasteKeyHandler.d.ts.map +1 -1
- package/dist/key-handlers/PasteKeyHandler.js +3 -3
- package/dist/key-handlers/PasteKeyHandler.js.map +1 -1
- package/dist/key-handlers/SelectionKeyHandler.d.ts +5 -5
- package/dist/key-handlers/SelectionKeyHandler.d.ts.map +1 -1
- package/dist/key-handlers/SelectionKeyHandler.js +16 -15
- package/dist/key-handlers/SelectionKeyHandler.js.map +1 -1
- package/dist/key-handlers/TreeKeyHandler.d.ts +2 -2
- package/dist/key-handlers/TreeKeyHandler.d.ts.map +1 -1
- package/dist/key-handlers/TreeKeyHandler.js +14 -12
- package/dist/key-handlers/TreeKeyHandler.js.map +1 -1
- package/dist/memoizeClear.d.ts +13 -3
- package/dist/memoizeClear.d.ts.map +1 -1
- package/dist/memoizeClear.js +7 -7
- package/dist/memoizeClear.js.map +1 -1
- package/dist/mouse-handlers/EditMouseHandler.d.ts +3 -4
- package/dist/mouse-handlers/EditMouseHandler.d.ts.map +1 -1
- package/dist/mouse-handlers/EditMouseHandler.js +3 -2
- package/dist/mouse-handlers/EditMouseHandler.js.map +1 -1
- package/dist/mouse-handlers/GridColumnMoveMouseHandler.d.ts +12 -5
- package/dist/mouse-handlers/GridColumnMoveMouseHandler.d.ts.map +1 -1
- package/dist/mouse-handlers/GridColumnMoveMouseHandler.js +11 -12
- package/dist/mouse-handlers/GridColumnMoveMouseHandler.js.map +1 -1
- package/dist/mouse-handlers/GridColumnSeparatorMouseHandler.d.ts +24 -3
- package/dist/mouse-handlers/GridColumnSeparatorMouseHandler.d.ts.map +1 -1
- package/dist/mouse-handlers/GridColumnSeparatorMouseHandler.js +2 -1
- package/dist/mouse-handlers/GridColumnSeparatorMouseHandler.js.map +1 -1
- package/dist/mouse-handlers/GridHorizontalScrollBarMouseHandler.d.ts +16 -6
- package/dist/mouse-handlers/GridHorizontalScrollBarMouseHandler.d.ts.map +1 -1
- package/dist/mouse-handlers/GridHorizontalScrollBarMouseHandler.js +40 -38
- package/dist/mouse-handlers/GridHorizontalScrollBarMouseHandler.js.map +1 -1
- package/dist/mouse-handlers/GridRowMoveMouseHandler.d.ts +10 -3
- package/dist/mouse-handlers/GridRowMoveMouseHandler.d.ts.map +1 -1
- package/dist/mouse-handlers/GridRowMoveMouseHandler.js +13 -12
- package/dist/mouse-handlers/GridRowMoveMouseHandler.js.map +1 -1
- package/dist/mouse-handlers/GridRowSeparatorMouseHandler.d.ts +24 -3
- package/dist/mouse-handlers/GridRowSeparatorMouseHandler.d.ts.map +1 -1
- package/dist/mouse-handlers/GridRowSeparatorMouseHandler.js +4 -3
- package/dist/mouse-handlers/GridRowSeparatorMouseHandler.js.map +1 -1
- package/dist/mouse-handlers/GridRowTreeMouseHandler.d.ts +8 -3
- package/dist/mouse-handlers/GridRowTreeMouseHandler.d.ts.map +1 -1
- package/dist/mouse-handlers/GridRowTreeMouseHandler.js +12 -7
- package/dist/mouse-handlers/GridRowTreeMouseHandler.js.map +1 -1
- package/dist/mouse-handlers/GridScrollBarCornerMouseHandler.d.ts +9 -3
- package/dist/mouse-handlers/GridScrollBarCornerMouseHandler.d.ts.map +1 -1
- package/dist/mouse-handlers/GridScrollBarCornerMouseHandler.js +2 -1
- package/dist/mouse-handlers/GridScrollBarCornerMouseHandler.js.map +1 -1
- package/dist/mouse-handlers/GridSelectionMouseHandler.d.ts +15 -9
- package/dist/mouse-handlers/GridSelectionMouseHandler.d.ts.map +1 -1
- package/dist/mouse-handlers/GridSelectionMouseHandler.js +22 -20
- package/dist/mouse-handlers/GridSelectionMouseHandler.js.map +1 -1
- package/dist/mouse-handlers/GridSeparatorMouseHandler.d.ts +46 -28
- package/dist/mouse-handlers/GridSeparatorMouseHandler.d.ts.map +1 -1
- package/dist/mouse-handlers/GridSeparatorMouseHandler.js +45 -86
- package/dist/mouse-handlers/GridSeparatorMouseHandler.js.map +1 -1
- package/dist/mouse-handlers/GridVerticalScrollBarMouseHandler.d.ts +16 -6
- package/dist/mouse-handlers/GridVerticalScrollBarMouseHandler.d.ts.map +1 -1
- package/dist/mouse-handlers/GridVerticalScrollBarMouseHandler.js +40 -38
- package/dist/mouse-handlers/GridVerticalScrollBarMouseHandler.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
package/dist/Grid.js
CHANGED
|
@@ -12,21 +12,21 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
12
12
|
import React, { PureComponent } from 'react';
|
|
13
13
|
import classNames from 'classnames';
|
|
14
14
|
import memoize from 'memoize-one';
|
|
15
|
-
import PropTypes from 'prop-types';
|
|
16
15
|
import clamp from 'lodash.clamp';
|
|
17
16
|
import GridMetricCalculator from "./GridMetricCalculator.js";
|
|
18
|
-
import GridModel from "./GridModel.js";
|
|
19
|
-
import GridMouseHandler from "./GridMouseHandler.js";
|
|
20
17
|
import GridTheme from "./GridTheme.js";
|
|
21
|
-
import GridRange from "./GridRange.js";
|
|
18
|
+
import GridRange, { SELECTION_DIRECTION } from "./GridRange.js";
|
|
22
19
|
import GridRenderer from "./GridRenderer.js";
|
|
23
20
|
import GridUtils from "./GridUtils.js";
|
|
24
21
|
import { GridSelectionMouseHandler, GridColumnMoveMouseHandler, GridColumnSeparatorMouseHandler, GridHorizontalScrollBarMouseHandler, GridRowMoveMouseHandler, GridRowSeparatorMouseHandler, GridRowTreeMouseHandler, GridScrollBarCornerMouseHandler, GridVerticalScrollBarMouseHandler, EditMouseHandler } from "./mouse-handlers/index.js";
|
|
25
22
|
import "./Grid.css";
|
|
26
|
-
import KeyHandler from "./KeyHandler.js";
|
|
27
23
|
import { EditKeyHandler, PasteKeyHandler, SelectionKeyHandler, TreeKeyHandler } from "./key-handlers/index.js";
|
|
28
24
|
import CellInputField from "./CellInputField.js";
|
|
29
25
|
import PasteError from "./errors/PasteError.js";
|
|
26
|
+
import { isExpandableGridModel } from "./ExpandableGridModel.js";
|
|
27
|
+
import { assertIsEditableGridModel, isEditableGridModel } from "./EditableGridModel.js";
|
|
28
|
+
import { assertIsDefined } from "./errors/index.js";
|
|
29
|
+
|
|
30
30
|
/**
|
|
31
31
|
* High performance, extendible, themeable grid component.
|
|
32
32
|
* Architectured to be fast and handle billions of rows/columns by default.
|
|
@@ -41,20 +41,37 @@ import PasteError from "./errors/PasteError.js";
|
|
|
41
41
|
* Add an onViewChanged callback to page in/out data as user moves around the grid
|
|
42
42
|
* Can also add onClick and onContextMenu handlers to add custom functionality and menus.
|
|
43
43
|
*/
|
|
44
|
-
|
|
45
44
|
class Grid extends PureComponent {
|
|
46
45
|
// use same constant as chrome source for windows
|
|
47
46
|
// https://github.com/chromium/chromium/blob/973af9d461b6b5dc60208c8d3d66adc27e53da78/ui/events/blink/web_input_event_builders_win.cc#L285
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* On some devices there may be different scaling required for high DPI. Get the scale required for the canvas.
|
|
50
|
+
* @param context The canvas context
|
|
51
|
+
* @returns The scale to use
|
|
52
|
+
*/
|
|
48
53
|
static getScale(context) {
|
|
49
|
-
var devicePixelRatio = window.devicePixelRatio || 1;
|
|
50
|
-
|
|
54
|
+
var devicePixelRatio = window.devicePixelRatio || 1; // backingStorePixelRatio is deprecated, but check it just in case
|
|
55
|
+
|
|
56
|
+
var legacyContext = context;
|
|
57
|
+
var backingStorePixelRatio = legacyContext.webkitBackingStorePixelRatio || legacyContext.mozBackingStorePixelRatio || legacyContext.msBackingStorePixelRatio || legacyContext.oBackingStorePixelRatio || legacyContext.backingStorePixelRatio || 1;
|
|
51
58
|
return devicePixelRatio / backingStorePixelRatio;
|
|
52
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* Get the class name from the cursor provided
|
|
62
|
+
* @param cursor The grid cursor to use
|
|
63
|
+
* @returns Class name with the grid-cursor prefix or null if no cursor provided
|
|
64
|
+
*/
|
|
65
|
+
|
|
53
66
|
|
|
54
67
|
static getCursorClassName(cursor) {
|
|
55
68
|
return cursor ? "grid-cursor-".concat(cursor) : null;
|
|
56
|
-
}
|
|
69
|
+
} // Need to disable react/sort-comp so I can put the fields here
|
|
70
|
+
|
|
71
|
+
/* eslint-disable react/sort-comp */
|
|
57
72
|
|
|
73
|
+
|
|
74
|
+
/* eslint-enable react/sort-comp */
|
|
58
75
|
constructor(props) {
|
|
59
76
|
super(props);
|
|
60
77
|
|
|
@@ -148,11 +165,13 @@ class Grid extends PureComponent {
|
|
|
148
165
|
}
|
|
149
166
|
|
|
150
167
|
componentDidMount() {
|
|
168
|
+
var _this$canvas;
|
|
169
|
+
|
|
151
170
|
this.initContext(); // Need to explicitly add wheel event to canvas so we can preventDefault/avoid passive listener issue
|
|
152
171
|
// Otherwise React attaches listener at doc level and you can't prevent default
|
|
153
172
|
// https://github.com/facebook/react/issues/14856
|
|
154
173
|
|
|
155
|
-
this.canvas.addEventListener('wheel', this.handleWheel, {
|
|
174
|
+
(_this$canvas = this.canvas) === null || _this$canvas === void 0 ? void 0 : _this$canvas.addEventListener('wheel', this.handleWheel, {
|
|
156
175
|
passive: false
|
|
157
176
|
});
|
|
158
177
|
window.addEventListener('resize', this.handleResize);
|
|
@@ -167,20 +186,25 @@ class Grid extends PureComponent {
|
|
|
167
186
|
movedColumns,
|
|
168
187
|
movedRows,
|
|
169
188
|
onMovedColumnsChanged,
|
|
170
|
-
onMoveColumnComplete
|
|
189
|
+
onMoveColumnComplete,
|
|
190
|
+
onMovedRowsChanged,
|
|
191
|
+
onMoveRowComplete
|
|
171
192
|
} = this.props;
|
|
172
193
|
var {
|
|
173
194
|
isStickyBottom: prevIsStickyBottom,
|
|
174
195
|
isStickyRight: prevIsStickyRight,
|
|
175
196
|
movedColumns: prevPropMovedColumns,
|
|
176
|
-
movedRows:
|
|
197
|
+
movedRows: prevPropMovedRows
|
|
177
198
|
} = prevProps;
|
|
178
199
|
var {
|
|
179
|
-
movedColumns: prevStateMovedColumns
|
|
200
|
+
movedColumns: prevStateMovedColumns,
|
|
201
|
+
movedRows: prevStateMovedRows
|
|
180
202
|
} = prevState;
|
|
181
203
|
var {
|
|
182
204
|
draggingColumn,
|
|
183
|
-
|
|
205
|
+
draggingRow,
|
|
206
|
+
movedColumns: currentStateMovedColumns,
|
|
207
|
+
movedRows: currentStateMovedRows
|
|
184
208
|
} = this.state;
|
|
185
209
|
|
|
186
210
|
if (prevPropMovedColumns !== movedColumns) {
|
|
@@ -189,7 +213,7 @@ class Grid extends PureComponent {
|
|
|
189
213
|
});
|
|
190
214
|
}
|
|
191
215
|
|
|
192
|
-
if (
|
|
216
|
+
if (prevPropMovedRows !== movedRows) {
|
|
193
217
|
this.setState({
|
|
194
218
|
movedRows
|
|
195
219
|
});
|
|
@@ -203,6 +227,14 @@ class Grid extends PureComponent {
|
|
|
203
227
|
onMoveColumnComplete(currentStateMovedColumns);
|
|
204
228
|
}
|
|
205
229
|
|
|
230
|
+
if (prevStateMovedRows !== currentStateMovedRows) {
|
|
231
|
+
onMovedRowsChanged(currentStateMovedRows);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
if (prevState.draggingRow != null && draggingRow == null) {
|
|
235
|
+
onMoveRowComplete(currentStateMovedRows);
|
|
236
|
+
}
|
|
237
|
+
|
|
206
238
|
if (isStickyBottom !== prevIsStickyBottom) {
|
|
207
239
|
this.isStuckToBottom = false;
|
|
208
240
|
}
|
|
@@ -262,13 +294,13 @@ class Grid extends PureComponent {
|
|
|
262
294
|
}
|
|
263
295
|
|
|
264
296
|
componentWillUnmount() {
|
|
297
|
+
var _this$canvas2;
|
|
298
|
+
|
|
265
299
|
if (this.animationFrame != null) {
|
|
266
300
|
cancelAnimationFrame(this.animationFrame);
|
|
267
301
|
}
|
|
268
302
|
|
|
269
|
-
this.canvas.removeEventListener('wheel', this.handleWheel
|
|
270
|
-
passive: false
|
|
271
|
-
});
|
|
303
|
+
(_this$canvas2 = this.canvas) === null || _this$canvas2 === void 0 ? void 0 : _this$canvas2.removeEventListener('wheel', this.handleWheel);
|
|
272
304
|
window.removeEventListener('mousemove', this.handleMouseDrag, true);
|
|
273
305
|
window.removeEventListener('mouseup', this.handleMouseUp, true);
|
|
274
306
|
window.removeEventListener('resize', this.handleResize);
|
|
@@ -283,6 +315,7 @@ class Grid extends PureComponent {
|
|
|
283
315
|
}
|
|
284
316
|
|
|
285
317
|
getGridPointFromEvent(event) {
|
|
318
|
+
assertIsDefined(this.canvas);
|
|
286
319
|
var rect = this.canvas.getBoundingClientRect();
|
|
287
320
|
var x = event.clientX - rect.left;
|
|
288
321
|
var y = event.clientY - rect.top;
|
|
@@ -290,6 +323,7 @@ class Grid extends PureComponent {
|
|
|
290
323
|
}
|
|
291
324
|
|
|
292
325
|
getGridPointFromXY(x, y) {
|
|
326
|
+
if (!this.metrics) throw new Error('metrics must be set');
|
|
293
327
|
return GridUtils.getGridPointFromXY(x, y, this.metrics);
|
|
294
328
|
}
|
|
295
329
|
|
|
@@ -300,6 +334,11 @@ class Grid extends PureComponent {
|
|
|
300
334
|
model,
|
|
301
335
|
stateOverride
|
|
302
336
|
} = this.props;
|
|
337
|
+
|
|
338
|
+
if (!this.canvasContext || !this.canvas) {
|
|
339
|
+
throw new Error('Canvas and context must be defined to get metrics');
|
|
340
|
+
}
|
|
341
|
+
|
|
303
342
|
var context = this.canvasContext;
|
|
304
343
|
var width = this.canvas.clientWidth;
|
|
305
344
|
var height = this.canvas.clientHeight;
|
|
@@ -343,33 +382,56 @@ class Grid extends PureComponent {
|
|
|
343
382
|
} = this.props;
|
|
344
383
|
return this.getCachedMouseHandlers(mouseHandlers);
|
|
345
384
|
}
|
|
385
|
+
/**
|
|
386
|
+
* Translate from the provided visible index to the model index
|
|
387
|
+
* @param columnIndex The column index to get the model for
|
|
388
|
+
* @returns The model index
|
|
389
|
+
*/
|
|
390
|
+
|
|
346
391
|
|
|
347
392
|
getModelColumn(columnIndex) {
|
|
348
393
|
var _this$metrics, _this$metrics$modelCo;
|
|
349
394
|
|
|
350
|
-
|
|
395
|
+
var modelIndex = (_this$metrics = this.metrics) === null || _this$metrics === void 0 ? void 0 : (_this$metrics$modelCo = _this$metrics.modelColumns) === null || _this$metrics$modelCo === void 0 ? void 0 : _this$metrics$modelCo.get(columnIndex);
|
|
396
|
+
|
|
397
|
+
if (modelIndex === undefined) {
|
|
398
|
+
throw new Error("Unable to get ModelIndex for column ".concat(columnIndex));
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
return modelIndex;
|
|
351
402
|
}
|
|
403
|
+
/**
|
|
404
|
+
* Translate from the provided visible index to the model index
|
|
405
|
+
* @param rowIndex The row index to get the model for
|
|
406
|
+
* @returns The model index
|
|
407
|
+
*/
|
|
408
|
+
|
|
352
409
|
|
|
353
410
|
getModelRow(rowIndex) {
|
|
354
411
|
var _this$metrics2, _this$metrics2$modelR;
|
|
355
412
|
|
|
356
|
-
|
|
413
|
+
var modelIndex = (_this$metrics2 = this.metrics) === null || _this$metrics2 === void 0 ? void 0 : (_this$metrics2$modelR = _this$metrics2.modelRows) === null || _this$metrics2$modelR === void 0 ? void 0 : _this$metrics2$modelR.get(rowIndex);
|
|
414
|
+
|
|
415
|
+
if (modelIndex === undefined) {
|
|
416
|
+
throw new Error("Unable to get ModelIndex for row ".concat(rowIndex));
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
return modelIndex;
|
|
357
420
|
}
|
|
421
|
+
/**
|
|
422
|
+
* Toggle a row between expanded and collapsed states
|
|
423
|
+
* @param row The row to toggle expansion for
|
|
424
|
+
*/
|
|
425
|
+
|
|
358
426
|
|
|
359
427
|
toggleRowExpanded(row) {
|
|
360
|
-
var
|
|
361
|
-
metrics
|
|
362
|
-
} = this;
|
|
363
|
-
var {
|
|
364
|
-
modelRows
|
|
365
|
-
} = metrics;
|
|
366
|
-
var modelRow = modelRows.get(row);
|
|
428
|
+
var modelRow = this.getModelRow(row);
|
|
367
429
|
var {
|
|
368
430
|
model
|
|
369
431
|
} = this.props; // We only want to set expansion if the row is expandable
|
|
370
432
|
// If it's not, still move the cursor to that position, as it may be outside of the current viewport and we don't know if it's expandable yet
|
|
371
433
|
|
|
372
|
-
if (model.isRowExpandable(modelRow)) {
|
|
434
|
+
if (isExpandableGridModel(model) && model.isRowExpandable(modelRow)) {
|
|
373
435
|
model.setRowExpanded(modelRow, !model.isRowExpanded(modelRow));
|
|
374
436
|
}
|
|
375
437
|
|
|
@@ -380,7 +442,11 @@ class Grid extends PureComponent {
|
|
|
380
442
|
this.commitSelection();
|
|
381
443
|
this.isStuckToBottom = false;
|
|
382
444
|
}
|
|
383
|
-
/**
|
|
445
|
+
/**
|
|
446
|
+
* Allows the selected ranges to be set programatically
|
|
447
|
+
* Will update the cursor and selection start/end based on the new ranges
|
|
448
|
+
* @param gridRanges The new selected ranges to set
|
|
449
|
+
*/
|
|
384
450
|
|
|
385
451
|
|
|
386
452
|
setSelectedRanges(gridRanges) {
|
|
@@ -431,6 +497,7 @@ class Grid extends PureComponent {
|
|
|
431
497
|
var {
|
|
432
498
|
canvasOptions
|
|
433
499
|
} = this.props;
|
|
500
|
+
if (!canvas) throw new Error('Canvas not set');
|
|
434
501
|
this.canvasContext = canvas.getContext('2d', canvasOptions);
|
|
435
502
|
}
|
|
436
503
|
|
|
@@ -441,6 +508,7 @@ class Grid extends PureComponent {
|
|
|
441
508
|
|
|
442
509
|
this.animationFrame = requestAnimationFrame(() => {
|
|
443
510
|
this.animationFrame = null;
|
|
511
|
+
if (!this.metrics) throw new Error('Metrics not set');
|
|
444
512
|
this.updateCanvas(this.metrics);
|
|
445
513
|
});
|
|
446
514
|
}
|
|
@@ -460,6 +528,9 @@ class Grid extends PureComponent {
|
|
|
460
528
|
canvas,
|
|
461
529
|
canvasContext
|
|
462
530
|
} = this;
|
|
531
|
+
if (!canvas) throw new Error('canvas not set');
|
|
532
|
+
if (!canvasContext) throw new Error('canvasContext not set');
|
|
533
|
+
if (!canvas.parentElement) throw new Error('Canvas has no parent element');
|
|
463
534
|
var scale = Grid.getScale(canvasContext); // the parent wrapper has 100% width/height, and is used for determining size
|
|
464
535
|
// we don't want to stretch the canvas to 100%, to avoid fractional pixels.
|
|
465
536
|
// A wrapper element must be used for sizing, and canvas size must be
|
|
@@ -486,6 +557,11 @@ class Grid extends PureComponent {
|
|
|
486
557
|
this.metrics = metricCalculator.getMetrics(metricState);
|
|
487
558
|
return this.metrics;
|
|
488
559
|
}
|
|
560
|
+
/**
|
|
561
|
+
* Check if the selection state has changed, and call the onSelectionChanged callback if they have
|
|
562
|
+
* @param prevState The previous grid state
|
|
563
|
+
*/
|
|
564
|
+
|
|
489
565
|
|
|
490
566
|
checkSelectionChange(prevState) {
|
|
491
567
|
var {
|
|
@@ -502,6 +578,11 @@ class Grid extends PureComponent {
|
|
|
502
578
|
onSelectionChanged(selectedRanges);
|
|
503
579
|
}
|
|
504
580
|
}
|
|
581
|
+
/**
|
|
582
|
+
* Validate the current selection, and reset if it is invalid
|
|
583
|
+
* @returns True if the selection is valid, false if the selection was invalid and has been reset
|
|
584
|
+
*/
|
|
585
|
+
|
|
505
586
|
|
|
506
587
|
validateSelection() {
|
|
507
588
|
var {
|
|
@@ -530,6 +611,10 @@ class Grid extends PureComponent {
|
|
|
530
611
|
|
|
531
612
|
return true;
|
|
532
613
|
}
|
|
614
|
+
/**
|
|
615
|
+
* Clears all selected ranges
|
|
616
|
+
*/
|
|
617
|
+
|
|
533
618
|
|
|
534
619
|
clearSelectedRanges() {
|
|
535
620
|
var {
|
|
@@ -554,6 +639,12 @@ class Grid extends PureComponent {
|
|
|
554
639
|
});
|
|
555
640
|
}
|
|
556
641
|
}
|
|
642
|
+
/**
|
|
643
|
+
* Begin a selection operation at the provided location
|
|
644
|
+
* @param column Column where the selection is beginning
|
|
645
|
+
* @param row Row where the selection is beginning
|
|
646
|
+
*/
|
|
647
|
+
|
|
557
648
|
|
|
558
649
|
beginSelection(column, row) {
|
|
559
650
|
this.setState({
|
|
@@ -567,10 +658,10 @@ class Grid extends PureComponent {
|
|
|
567
658
|
}
|
|
568
659
|
/**
|
|
569
660
|
* Moves the selection to the cell specified
|
|
570
|
-
* @param
|
|
571
|
-
* @param
|
|
572
|
-
* @param
|
|
573
|
-
* @param
|
|
661
|
+
* @param column The column index to move the cursor to
|
|
662
|
+
* @param row The row index to move the cursor to
|
|
663
|
+
* @param extendSelection Whether to extend the current selection (eg. holding Shift)
|
|
664
|
+
* @param maximizePreviousRange When true, maximize/add to the previous range only, ignoring where the selection was started.
|
|
574
665
|
*/
|
|
575
666
|
|
|
576
667
|
|
|
@@ -599,10 +690,12 @@ class Grid extends PureComponent {
|
|
|
599
690
|
var bottom = null;
|
|
600
691
|
|
|
601
692
|
if (maximizePreviousRange) {
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
693
|
+
var _lastSelectedRange$st, _lastSelectedRange$st2, _lastSelectedRange$en, _lastSelectedRange$en2;
|
|
694
|
+
|
|
695
|
+
left = autoSelectRow ? null : Math.min(column !== null && column !== void 0 ? column : 0, (_lastSelectedRange$st = lastSelectedRange.startColumn) !== null && _lastSelectedRange$st !== void 0 ? _lastSelectedRange$st : 0);
|
|
696
|
+
top = autoSelectColumn ? null : Math.min(row !== null && row !== void 0 ? row : 0, (_lastSelectedRange$st2 = lastSelectedRange.startRow) !== null && _lastSelectedRange$st2 !== void 0 ? _lastSelectedRange$st2 : 0);
|
|
697
|
+
right = autoSelectRow ? null : Math.max(column !== null && column !== void 0 ? column : 0, (_lastSelectedRange$en = lastSelectedRange.endColumn) !== null && _lastSelectedRange$en !== void 0 ? _lastSelectedRange$en : 0);
|
|
698
|
+
bottom = autoSelectColumn ? null : Math.max(row !== null && row !== void 0 ? row : 0, (_lastSelectedRange$en2 = lastSelectedRange.endRow) !== null && _lastSelectedRange$en2 !== void 0 ? _lastSelectedRange$en2 : 0);
|
|
606
699
|
} else {
|
|
607
700
|
left = lastSelectedRange.startColumn;
|
|
608
701
|
top = lastSelectedRange.startRow;
|
|
@@ -627,8 +720,7 @@ class Grid extends PureComponent {
|
|
|
627
720
|
return null;
|
|
628
721
|
}
|
|
629
722
|
|
|
630
|
-
var _newRanges = []
|
|
631
|
-
|
|
723
|
+
var _newRanges = [...selectedRanges];
|
|
632
724
|
_newRanges[_newRanges.length - 1] = selectedRange;
|
|
633
725
|
return {
|
|
634
726
|
selectedRanges: _newRanges,
|
|
@@ -637,7 +729,7 @@ class Grid extends PureComponent {
|
|
|
637
729
|
};
|
|
638
730
|
}
|
|
639
731
|
|
|
640
|
-
var newRanges = []
|
|
732
|
+
var newRanges = [...selectedRanges];
|
|
641
733
|
var selectedColumn = autoSelectRow ? null : column;
|
|
642
734
|
var selectedRow = autoSelectColumn ? null : row;
|
|
643
735
|
newRanges.push(GridRange.makeNormalized(selectedColumn, selectedRow, selectedColumn, selectedRow));
|
|
@@ -676,7 +768,9 @@ class Grid extends PureComponent {
|
|
|
676
768
|
// For if we click on one cell multiple times.
|
|
677
769
|
return {
|
|
678
770
|
selectedRanges: [],
|
|
679
|
-
lastSelectedRanges: []
|
|
771
|
+
lastSelectedRanges: [],
|
|
772
|
+
cursorColumn,
|
|
773
|
+
cursorRow
|
|
680
774
|
};
|
|
681
775
|
}
|
|
682
776
|
|
|
@@ -736,6 +830,10 @@ class Grid extends PureComponent {
|
|
|
736
830
|
};
|
|
737
831
|
});
|
|
738
832
|
}
|
|
833
|
+
/**
|
|
834
|
+
* Set the selection to the entire grid
|
|
835
|
+
*/
|
|
836
|
+
|
|
739
837
|
|
|
740
838
|
selectAll() {
|
|
741
839
|
var {
|
|
@@ -752,6 +850,13 @@ class Grid extends PureComponent {
|
|
|
752
850
|
var right = autoSelectRow ? null : model.columnCount - 1;
|
|
753
851
|
this.setSelectedRanges([new GridRange(left, top, right, bottom)]);
|
|
754
852
|
}
|
|
853
|
+
/**
|
|
854
|
+
* Move the cursor in relation to the current cursor position
|
|
855
|
+
* @param deltaColumn Number of columns to move the cursor
|
|
856
|
+
* @param deltaRow Number of rows to move the cursor
|
|
857
|
+
* @param extendSelection True if the current selection should be extended, false to start a new selection
|
|
858
|
+
*/
|
|
859
|
+
|
|
755
860
|
|
|
756
861
|
moveCursor(deltaColumn, deltaRow, extendSelection) {
|
|
757
862
|
var {
|
|
@@ -787,7 +892,7 @@ class Grid extends PureComponent {
|
|
|
787
892
|
}
|
|
788
893
|
/**
|
|
789
894
|
* Move the cursor in the provided selection direction
|
|
790
|
-
* @param
|
|
895
|
+
* @param direction The direction to move the cursor in
|
|
791
896
|
*/
|
|
792
897
|
|
|
793
898
|
|
|
@@ -843,11 +948,11 @@ class Grid extends PureComponent {
|
|
|
843
948
|
}
|
|
844
949
|
/**
|
|
845
950
|
* Move a cursor to the specified position in the grid.
|
|
846
|
-
* @param
|
|
847
|
-
* @param
|
|
848
|
-
* @param
|
|
849
|
-
* @param
|
|
850
|
-
* @param
|
|
951
|
+
* @param column The column index to move the cursor to
|
|
952
|
+
* @param row The row index to move the cursor to
|
|
953
|
+
* @param extendSelection Whether to extend the current selection (eg. holding Shift)
|
|
954
|
+
* @param keepCursorInView Whether to move the viewport so that the cursor is in view
|
|
955
|
+
* @param maximizePreviousRange With this and `extendSelection` true, it will maximize/add to the previous range only, ignoring where the selection was started
|
|
851
956
|
*/
|
|
852
957
|
|
|
853
958
|
|
|
@@ -869,12 +974,13 @@ class Grid extends PureComponent {
|
|
|
869
974
|
/**
|
|
870
975
|
* Moves the view to make the specified cell visible
|
|
871
976
|
*
|
|
872
|
-
* @param
|
|
873
|
-
* @param
|
|
977
|
+
* @param column The column index to bring into view
|
|
978
|
+
* @param row The row index to bring into view
|
|
874
979
|
*/
|
|
875
980
|
|
|
876
981
|
|
|
877
982
|
moveViewToCell(column, row) {
|
|
983
|
+
if (!this.metrics) throw new Error('metrics not set');
|
|
878
984
|
var {
|
|
879
985
|
metricCalculator
|
|
880
986
|
} = this;
|
|
@@ -922,13 +1028,14 @@ class Grid extends PureComponent {
|
|
|
922
1028
|
/**
|
|
923
1029
|
* Checks the `top` and `left` properties that are set and updates the isStuckToBottom/Right properties
|
|
924
1030
|
* Should be called when user interaction occurs
|
|
925
|
-
* @param
|
|
926
|
-
* @param
|
|
1031
|
+
* @param viewState New state properties to set.
|
|
1032
|
+
* @param forceUpdate Whether to force an update.
|
|
927
1033
|
*/
|
|
928
1034
|
|
|
929
1035
|
|
|
930
1036
|
setViewState(viewState) {
|
|
931
1037
|
var forceUpdate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
1038
|
+
if (!this.metrics) throw new Error('metrics not set');
|
|
932
1039
|
var {
|
|
933
1040
|
isStickyBottom,
|
|
934
1041
|
isStickyRight
|
|
@@ -959,21 +1066,22 @@ class Grid extends PureComponent {
|
|
|
959
1066
|
/**
|
|
960
1067
|
* Start editing the data at the given index
|
|
961
1068
|
*
|
|
962
|
-
* @param
|
|
963
|
-
* @param
|
|
964
|
-
* @param
|
|
965
|
-
* @param
|
|
966
|
-
* @param
|
|
1069
|
+
* @param column The visible column index to start editing
|
|
1070
|
+
* @param row The visible row index to start editing
|
|
1071
|
+
* @param isQuickEdit If this is a quick edit (the arrow keys can commit)
|
|
1072
|
+
* @param selectionRange The tuple [start,end] text selection range of the value to select when editing
|
|
1073
|
+
* @param value The value to start with in the edit field. Leave undefined to use the current value.
|
|
967
1074
|
*/
|
|
968
1075
|
|
|
969
1076
|
|
|
970
1077
|
startEditing(column, row) {
|
|
971
1078
|
var isQuickEdit = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
972
|
-
var selectionRange = arguments.length > 3
|
|
973
|
-
var value = arguments.length > 4
|
|
1079
|
+
var selectionRange = arguments.length > 3 ? arguments[3] : undefined;
|
|
1080
|
+
var value = arguments.length > 4 ? arguments[4] : undefined;
|
|
974
1081
|
var {
|
|
975
1082
|
model
|
|
976
1083
|
} = this.props;
|
|
1084
|
+
if (!isEditableGridModel(model)) throw new Error('model is not editable');
|
|
977
1085
|
var modelColumn = this.getModelColumn(column);
|
|
978
1086
|
var modelRow = this.getModelRow(row);
|
|
979
1087
|
var cell = {
|
|
@@ -990,6 +1098,14 @@ class Grid extends PureComponent {
|
|
|
990
1098
|
});
|
|
991
1099
|
this.moveViewToCell(column, row);
|
|
992
1100
|
}
|
|
1101
|
+
/**
|
|
1102
|
+
* Check if a value is valid for a specific cell
|
|
1103
|
+
* @param column Column index of the cell to check
|
|
1104
|
+
* @param row Row index of the cell to check
|
|
1105
|
+
* @param value Value to check
|
|
1106
|
+
* @returns True if the value is valid for the provided cell, false otherwise
|
|
1107
|
+
*/
|
|
1108
|
+
|
|
993
1109
|
|
|
994
1110
|
isValidForCell(column, row, value) {
|
|
995
1111
|
var {
|
|
@@ -997,13 +1113,13 @@ class Grid extends PureComponent {
|
|
|
997
1113
|
} = this.props;
|
|
998
1114
|
var modelColumn = this.getModelColumn(column);
|
|
999
1115
|
var modelRow = this.getModelRow(row);
|
|
1000
|
-
return model.isValidForCell(modelColumn, modelRow, value);
|
|
1116
|
+
return isEditableGridModel(model) && model.isValidForCell(modelColumn, modelRow, value);
|
|
1001
1117
|
}
|
|
1002
1118
|
/**
|
|
1003
1119
|
* Paste a value with the current selection
|
|
1004
1120
|
* It first needs to validate that the pasted table is valid for the given selection.
|
|
1005
1121
|
* Also may update selection if single cells are selected and a table is pasted.
|
|
1006
|
-
* @param
|
|
1122
|
+
* @param value Table or a string that is being pasted
|
|
1007
1123
|
*/
|
|
1008
1124
|
|
|
1009
1125
|
|
|
@@ -1021,6 +1137,8 @@ class Grid extends PureComponent {
|
|
|
1021
1137
|
} = _this.state;
|
|
1022
1138
|
|
|
1023
1139
|
try {
|
|
1140
|
+
assertIsEditableGridModel(model);
|
|
1141
|
+
|
|
1024
1142
|
if (!model.isEditable || !selectedRanges.every(range => model.isEditableRange(range))) {
|
|
1025
1143
|
throw new PasteError("Can't paste in to read-only area.");
|
|
1026
1144
|
}
|
|
@@ -1033,10 +1151,10 @@ class Grid extends PureComponent {
|
|
|
1033
1151
|
// Just paste the value into all the selected cells
|
|
1034
1152
|
var _edits = [];
|
|
1035
1153
|
var modelRanges = GridUtils.getModelRanges(selectedRanges, movedColumns, movedRows);
|
|
1036
|
-
GridRange.forEachCell(modelRanges, (
|
|
1154
|
+
GridRange.forEachCell(modelRanges, (column, row) => {
|
|
1037
1155
|
_edits.push({
|
|
1038
|
-
|
|
1039
|
-
|
|
1156
|
+
column,
|
|
1157
|
+
row,
|
|
1040
1158
|
text: value
|
|
1041
1159
|
});
|
|
1042
1160
|
});
|
|
@@ -1051,31 +1169,43 @@ class Grid extends PureComponent {
|
|
|
1051
1169
|
columnCount,
|
|
1052
1170
|
rowCount
|
|
1053
1171
|
} = model;
|
|
1054
|
-
var
|
|
1172
|
+
var _ranges = selectedRanges; // If each cell is a single selection, we need to update the selection to map to the newly pasted data
|
|
1173
|
+
|
|
1174
|
+
if (_ranges.every(range => {
|
|
1175
|
+
var _range$startColumn, _range$startRow;
|
|
1055
1176
|
|
|
1056
|
-
|
|
1177
|
+
return GridRange.cellCount([range]) === 1 && ((_range$startColumn = range.startColumn) !== null && _range$startColumn !== void 0 ? _range$startColumn : 0) + tableWidth <= columnCount && ((_range$startRow = range.startRow) !== null && _range$startRow !== void 0 ? _range$startRow : 0) + tableHeight <= rowCount;
|
|
1178
|
+
})) {
|
|
1057
1179
|
// Remap the selected ranges
|
|
1058
|
-
|
|
1180
|
+
_ranges = _ranges.map(range => {
|
|
1181
|
+
var _range$startColumn2, _range$startRow2;
|
|
1059
1182
|
|
|
1060
|
-
|
|
1183
|
+
return new GridRange(range.startColumn, range.startRow, ((_range$startColumn2 = range.startColumn) !== null && _range$startColumn2 !== void 0 ? _range$startColumn2 : 0) + tableWidth - 1, ((_range$startRow2 = range.startRow) !== null && _range$startRow2 !== void 0 ? _range$startRow2 : 0) + tableHeight - 1);
|
|
1184
|
+
});
|
|
1185
|
+
|
|
1186
|
+
_this.setSelectedRanges(_ranges);
|
|
1061
1187
|
}
|
|
1062
1188
|
|
|
1063
|
-
if (!
|
|
1189
|
+
if (!_ranges.every(range => GridRange.rowCount([range]) === tableHeight && GridRange.columnCount([range]) === tableWidth)) {
|
|
1064
1190
|
throw new PasteError('Copy and paste area are not same size.');
|
|
1065
1191
|
}
|
|
1066
1192
|
|
|
1067
1193
|
var edits = [];
|
|
1068
|
-
|
|
1194
|
+
|
|
1195
|
+
_ranges.forEach(range => {
|
|
1069
1196
|
for (var x = 0; x < tableWidth; x += 1) {
|
|
1070
1197
|
for (var y = 0; y < tableHeight; y += 1) {
|
|
1198
|
+
var _range$startColumn3, _range$startRow3;
|
|
1199
|
+
|
|
1071
1200
|
edits.push({
|
|
1072
|
-
|
|
1073
|
-
|
|
1201
|
+
column: ((_range$startColumn3 = range.startColumn) !== null && _range$startColumn3 !== void 0 ? _range$startColumn3 : 0) + x,
|
|
1202
|
+
row: ((_range$startRow3 = range.startRow) !== null && _range$startRow3 !== void 0 ? _range$startRow3 : 0) + y,
|
|
1074
1203
|
text: value[y][x]
|
|
1075
1204
|
});
|
|
1076
1205
|
}
|
|
1077
1206
|
}
|
|
1078
1207
|
});
|
|
1208
|
+
|
|
1079
1209
|
yield model.setValues(edits);
|
|
1080
1210
|
} catch (e) {
|
|
1081
1211
|
var {
|
|
@@ -1085,18 +1215,36 @@ class Grid extends PureComponent {
|
|
|
1085
1215
|
}
|
|
1086
1216
|
})();
|
|
1087
1217
|
}
|
|
1218
|
+
/**
|
|
1219
|
+
* Set a value to a specific cell. If the value is not valid for that cell, do not set it
|
|
1220
|
+
* @param column Column index to set the value for
|
|
1221
|
+
* @param row Row index to set the value for
|
|
1222
|
+
* @param value Value to set at that cell
|
|
1223
|
+
* @returns true If the value was valid and attempted to be set, false is it was not valid
|
|
1224
|
+
*/
|
|
1225
|
+
|
|
1088
1226
|
|
|
1089
1227
|
setValueForCell(column, row, value) {
|
|
1090
1228
|
var {
|
|
1091
1229
|
model
|
|
1092
1230
|
} = this.props;
|
|
1231
|
+
assertIsEditableGridModel(model);
|
|
1093
1232
|
var modelColumn = this.getModelColumn(column);
|
|
1094
1233
|
var modelRow = this.getModelRow(row);
|
|
1095
1234
|
|
|
1096
1235
|
if (model.isValidForCell(modelColumn, modelRow, value)) {
|
|
1097
1236
|
model.setValueForCell(modelColumn, modelRow, value);
|
|
1237
|
+
return true;
|
|
1098
1238
|
}
|
|
1239
|
+
|
|
1240
|
+
return false;
|
|
1099
1241
|
}
|
|
1242
|
+
/**
|
|
1243
|
+
* Set a value on all the ranges provided
|
|
1244
|
+
* @param ranges Ranges to set
|
|
1245
|
+
* @param value The value to set on all the ranges
|
|
1246
|
+
*/
|
|
1247
|
+
|
|
1100
1248
|
|
|
1101
1249
|
setValueForRanges(ranges, value) {
|
|
1102
1250
|
var {
|
|
@@ -1107,8 +1255,18 @@ class Grid extends PureComponent {
|
|
|
1107
1255
|
movedRows
|
|
1108
1256
|
} = this.state;
|
|
1109
1257
|
var modelRanges = GridUtils.getModelRanges(ranges, movedColumns, movedRows);
|
|
1110
|
-
|
|
1258
|
+
|
|
1259
|
+
if (isEditableGridModel(model)) {
|
|
1260
|
+
model.setValueForRanges(modelRanges, value);
|
|
1261
|
+
}
|
|
1111
1262
|
}
|
|
1263
|
+
/**
|
|
1264
|
+
* Check if a given cell is within the current selection
|
|
1265
|
+
* @param row Row to check
|
|
1266
|
+
* @param column Column to check
|
|
1267
|
+
* @returns True if the cell is in the current selection, false otherwise
|
|
1268
|
+
*/
|
|
1269
|
+
|
|
1112
1270
|
|
|
1113
1271
|
isSelected(row, column) {
|
|
1114
1272
|
var {
|
|
@@ -1116,9 +1274,11 @@ class Grid extends PureComponent {
|
|
|
1116
1274
|
} = this.state;
|
|
1117
1275
|
|
|
1118
1276
|
for (var i = 0; i < selectedRanges.length; i += 1) {
|
|
1277
|
+
var _selectedRange$endRow, _selectedRange$endCol;
|
|
1278
|
+
|
|
1119
1279
|
var selectedRange = selectedRanges[i];
|
|
1120
|
-
var rowSelected = selectedRange.startRow === null || selectedRange.startRow <= row && row <= selectedRange.endRow;
|
|
1121
|
-
var columnSelected = selectedRange.startColumn === null || selectedRange.startColumn <= column && column <= selectedRange.endColumn;
|
|
1280
|
+
var rowSelected = selectedRange.startRow === null || selectedRange.startRow <= row && row <= ((_selectedRange$endRow = selectedRange.endRow) !== null && _selectedRange$endRow !== void 0 ? _selectedRange$endRow : 0);
|
|
1281
|
+
var columnSelected = selectedRange.startColumn === null || selectedRange.startColumn <= column && column <= ((_selectedRange$endCol = selectedRange.endColumn) !== null && _selectedRange$endCol !== void 0 ? _selectedRange$endCol : 0);
|
|
1122
1282
|
|
|
1123
1283
|
if (rowSelected && columnSelected) {
|
|
1124
1284
|
return true;
|
|
@@ -1131,9 +1291,17 @@ class Grid extends PureComponent {
|
|
|
1131
1291
|
addDocumentCursor() {
|
|
1132
1292
|
var cursor = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
1133
1293
|
if (this.documentCursor === Grid.getCursorClassName(cursor)) return;
|
|
1134
|
-
|
|
1294
|
+
|
|
1295
|
+
if (this.documentCursor) {
|
|
1296
|
+
document.documentElement.classList.remove(this.documentCursor);
|
|
1297
|
+
}
|
|
1298
|
+
|
|
1135
1299
|
this.documentCursor = Grid.getCursorClassName(cursor);
|
|
1136
|
-
|
|
1300
|
+
|
|
1301
|
+
if (this.documentCursor) {
|
|
1302
|
+
document.documentElement.classList.add(this.documentCursor);
|
|
1303
|
+
}
|
|
1304
|
+
|
|
1137
1305
|
document.documentElement.classList.add('grid-block-events');
|
|
1138
1306
|
}
|
|
1139
1307
|
|
|
@@ -1147,7 +1315,7 @@ class Grid extends PureComponent {
|
|
|
1147
1315
|
|
|
1148
1316
|
startDragTimer(event) {
|
|
1149
1317
|
this.stopDragTimer();
|
|
1150
|
-
var mouseEvent = new MouseEvent('custom', event);
|
|
1318
|
+
var mouseEvent = new MouseEvent('custom', event.nativeEvent);
|
|
1151
1319
|
this.dragTimer = setTimeout(() => {
|
|
1152
1320
|
this.handleMouseDrag(mouseEvent);
|
|
1153
1321
|
}, Grid.dragTimeout);
|
|
@@ -1160,13 +1328,17 @@ class Grid extends PureComponent {
|
|
|
1160
1328
|
}
|
|
1161
1329
|
}
|
|
1162
1330
|
/**
|
|
1331
|
+
* Draw the grid with the metrics provided
|
|
1163
1332
|
* When scrolling you've have to re-draw the whole canvas. As a consequence, all these drawing methods
|
|
1164
1333
|
* must be very quick.
|
|
1334
|
+
* @param metrics Metrics to use for rendering the grid
|
|
1165
1335
|
*/
|
|
1166
1336
|
|
|
1167
1337
|
|
|
1168
1338
|
drawCanvas() {
|
|
1169
1339
|
var metrics = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.updateMetrics();
|
|
1340
|
+
if (!this.canvas) throw new Error('canvas is not set');
|
|
1341
|
+
if (!this.canvasContext) throw new Error('context not set');
|
|
1170
1342
|
var {
|
|
1171
1343
|
left,
|
|
1172
1344
|
top,
|
|
@@ -1228,16 +1400,35 @@ class Grid extends PureComponent {
|
|
|
1228
1400
|
renderer.drawCanvas(renderState);
|
|
1229
1401
|
context.restore();
|
|
1230
1402
|
}
|
|
1403
|
+
/**
|
|
1404
|
+
* Set focus to this grid element
|
|
1405
|
+
*/
|
|
1406
|
+
|
|
1231
1407
|
|
|
1232
1408
|
focus() {
|
|
1233
|
-
|
|
1409
|
+
var _this$canvas3;
|
|
1410
|
+
|
|
1411
|
+
(_this$canvas3 = this.canvas) === null || _this$canvas3 === void 0 ? void 0 : _this$canvas3.focus();
|
|
1234
1412
|
}
|
|
1413
|
+
/**
|
|
1414
|
+
* Check if this grid is currently focused
|
|
1415
|
+
* @returns True if the active element is this grid
|
|
1416
|
+
*/
|
|
1417
|
+
|
|
1235
1418
|
|
|
1236
1419
|
isFocused() {
|
|
1237
1420
|
return document.activeElement === this.canvas;
|
|
1238
1421
|
}
|
|
1422
|
+
/**
|
|
1423
|
+
* Handle a mouse click event. Pass the event to the registered mouse handlers until one handles it.
|
|
1424
|
+
* Focuses the grid after the click.
|
|
1425
|
+
* @param event The mouse event
|
|
1426
|
+
*/
|
|
1427
|
+
|
|
1239
1428
|
|
|
1240
1429
|
handleClick(event) {
|
|
1430
|
+
var _this$canvas4;
|
|
1431
|
+
|
|
1241
1432
|
var gridPoint = this.getGridPointFromEvent(event);
|
|
1242
1433
|
var mouseHandlers = this.getMouseHandlers();
|
|
1243
1434
|
|
|
@@ -1251,8 +1442,13 @@ class Grid extends PureComponent {
|
|
|
1251
1442
|
}
|
|
1252
1443
|
}
|
|
1253
1444
|
|
|
1254
|
-
this.canvas.focus();
|
|
1445
|
+
(_this$canvas4 = this.canvas) === null || _this$canvas4 === void 0 ? void 0 : _this$canvas4.focus();
|
|
1255
1446
|
}
|
|
1447
|
+
/**
|
|
1448
|
+
* Handle a mouse context menu event. Pass the event to the registered mouse handlers until one handles it.
|
|
1449
|
+
* @param event The mouse event triggering the context menu
|
|
1450
|
+
*/
|
|
1451
|
+
|
|
1256
1452
|
|
|
1257
1453
|
handleContextMenu(event) {
|
|
1258
1454
|
var gridPoint = this.getGridPointFromEvent(event);
|
|
@@ -1268,29 +1464,35 @@ class Grid extends PureComponent {
|
|
|
1268
1464
|
}
|
|
1269
1465
|
}
|
|
1270
1466
|
}
|
|
1467
|
+
/**
|
|
1468
|
+
* Handle a key down event from the keyboard. Pass the event to the registered keyboard handlers until one handles it.
|
|
1469
|
+
* @param event Keyboard event
|
|
1470
|
+
*/
|
|
1471
|
+
|
|
1271
1472
|
|
|
1272
|
-
handleKeyDown(
|
|
1473
|
+
handleKeyDown(event) {
|
|
1273
1474
|
var keyHandlers = this.getKeyHandlers();
|
|
1274
1475
|
|
|
1275
1476
|
for (var i = 0; i < keyHandlers.length; i += 1) {
|
|
1276
1477
|
var keyHandler = keyHandlers[i];
|
|
1277
|
-
var result = keyHandler.onDown(
|
|
1478
|
+
var result = keyHandler.onDown(event, this);
|
|
1278
1479
|
|
|
1279
1480
|
if (result) {
|
|
1280
|
-
var
|
|
1481
|
+
var _options$stopPropagat, _options$preventDefau;
|
|
1281
1482
|
|
|
1282
|
-
|
|
1283
|
-
if ((
|
|
1483
|
+
var options = result;
|
|
1484
|
+
if ((_options$stopPropagat = options === null || options === void 0 ? void 0 : options.stopPropagation) !== null && _options$stopPropagat !== void 0 ? _options$stopPropagat : true) event.stopPropagation();
|
|
1485
|
+
if ((_options$preventDefau = options === null || options === void 0 ? void 0 : options.preventDefault) !== null && _options$preventDefau !== void 0 ? _options$preventDefau : true) event.preventDefault();
|
|
1284
1486
|
break;
|
|
1285
1487
|
}
|
|
1286
1488
|
}
|
|
1287
1489
|
}
|
|
1288
1490
|
/**
|
|
1289
1491
|
* Notify all of the mouse handlers for this grid of a mouse event.
|
|
1290
|
-
* @param
|
|
1291
|
-
* @param
|
|
1292
|
-
* @param
|
|
1293
|
-
* @param
|
|
1492
|
+
* @param functionName The name of the function in the mouse handler to call
|
|
1493
|
+
* @param event The mouse event to notify
|
|
1494
|
+
* @param updateCoordinates Whether to update the mouse coordinates
|
|
1495
|
+
* @param addCursorToDocument Whether to add a cursor overlay or not (for dragging)
|
|
1294
1496
|
*/
|
|
1295
1497
|
|
|
1296
1498
|
|
|
@@ -1306,7 +1508,7 @@ class Grid extends PureComponent {
|
|
|
1306
1508
|
var result = mouseHandler[functionName] && mouseHandler[functionName](gridPoint, this, event);
|
|
1307
1509
|
|
|
1308
1510
|
if (result) {
|
|
1309
|
-
var
|
|
1511
|
+
var _options$stopPropagat2, _options$preventDefau2;
|
|
1310
1512
|
|
|
1311
1513
|
if (mouseHandler.cursor != null) {
|
|
1312
1514
|
({
|
|
@@ -1319,8 +1521,9 @@ class Grid extends PureComponent {
|
|
|
1319
1521
|
} // result is bool or object, events are stopped by default
|
|
1320
1522
|
|
|
1321
1523
|
|
|
1322
|
-
|
|
1323
|
-
if ((
|
|
1524
|
+
var options = result;
|
|
1525
|
+
if ((_options$stopPropagat2 = options === null || options === void 0 ? void 0 : options.stopPropagation) !== null && _options$stopPropagat2 !== void 0 ? _options$stopPropagat2 : true) event.stopPropagation();
|
|
1526
|
+
if ((_options$preventDefau2 = options === null || options === void 0 ? void 0 : options.preventDefault) !== null && _options$preventDefau2 !== void 0 ? _options$preventDefau2 : true) event.preventDefault();
|
|
1324
1527
|
break;
|
|
1325
1528
|
}
|
|
1326
1529
|
}
|
|
@@ -1349,20 +1552,20 @@ class Grid extends PureComponent {
|
|
|
1349
1552
|
return;
|
|
1350
1553
|
}
|
|
1351
1554
|
|
|
1352
|
-
this.notifyMouseHandlers(
|
|
1555
|
+
this.notifyMouseHandlers('onDown', event);
|
|
1353
1556
|
this.startDragTimer(event);
|
|
1354
1557
|
}
|
|
1355
1558
|
|
|
1356
1559
|
handleDoubleClick(event) {
|
|
1357
|
-
this.notifyMouseHandlers(
|
|
1560
|
+
this.notifyMouseHandlers('onDoubleClick', event);
|
|
1358
1561
|
}
|
|
1359
1562
|
|
|
1360
1563
|
handleMouseMove(event) {
|
|
1361
|
-
this.notifyMouseHandlers(
|
|
1564
|
+
this.notifyMouseHandlers('onMove', event);
|
|
1362
1565
|
}
|
|
1363
1566
|
|
|
1364
1567
|
handleMouseLeave(event) {
|
|
1365
|
-
this.notifyMouseHandlers(
|
|
1568
|
+
this.notifyMouseHandlers('onLeave', event, false);
|
|
1366
1569
|
this.setState({
|
|
1367
1570
|
mouseX: null,
|
|
1368
1571
|
mouseY: null
|
|
@@ -1373,7 +1576,7 @@ class Grid extends PureComponent {
|
|
|
1373
1576
|
this.setState({
|
|
1374
1577
|
isDragging: true
|
|
1375
1578
|
});
|
|
1376
|
-
this.notifyMouseHandlers(
|
|
1579
|
+
this.notifyMouseHandlers('onDrag', event, true, true);
|
|
1377
1580
|
this.stopDragTimer();
|
|
1378
1581
|
}
|
|
1379
1582
|
|
|
@@ -1385,7 +1588,7 @@ class Grid extends PureComponent {
|
|
|
1385
1588
|
return;
|
|
1386
1589
|
}
|
|
1387
1590
|
|
|
1388
|
-
this.notifyMouseHandlers(
|
|
1591
|
+
this.notifyMouseHandlers('onUp', event, false);
|
|
1389
1592
|
this.stopDragTimer();
|
|
1390
1593
|
this.removeDocumentCursor();
|
|
1391
1594
|
}
|
|
@@ -1403,10 +1606,10 @@ class Grid extends PureComponent {
|
|
|
1403
1606
|
this.forceUpdate();
|
|
1404
1607
|
}
|
|
1405
1608
|
|
|
1406
|
-
handleWheel(
|
|
1407
|
-
this.notifyMouseHandlers(
|
|
1609
|
+
handleWheel(event) {
|
|
1610
|
+
this.notifyMouseHandlers('onWheel', event);
|
|
1408
1611
|
|
|
1409
|
-
if (
|
|
1612
|
+
if (event.defaultPrevented) {
|
|
1410
1613
|
return;
|
|
1411
1614
|
}
|
|
1412
1615
|
|
|
@@ -1415,6 +1618,7 @@ class Grid extends PureComponent {
|
|
|
1415
1618
|
metrics
|
|
1416
1619
|
} = this;
|
|
1417
1620
|
var metricState = this.getMetricState();
|
|
1621
|
+
if (!metrics) throw new Error('metrics not set');
|
|
1418
1622
|
var {
|
|
1419
1623
|
lastTop,
|
|
1420
1624
|
lastLeft
|
|
@@ -1429,7 +1633,7 @@ class Grid extends PureComponent {
|
|
|
1429
1633
|
var {
|
|
1430
1634
|
deltaX,
|
|
1431
1635
|
deltaY
|
|
1432
|
-
} = GridUtils.getScrollDelta(
|
|
1636
|
+
} = GridUtils.getScrollDelta(event, metrics.barWidth, metrics.barHeight, metrics.rowHeight, metrics.rowHeight); // iterate through each column to determine column width and figure out how far to scroll
|
|
1433
1637
|
// get column width of next column to scroll to, and subract it from the remaining distance to travel
|
|
1434
1638
|
|
|
1435
1639
|
while (deltaX !== 0) {
|
|
@@ -1532,9 +1736,13 @@ class Grid extends PureComponent {
|
|
|
1532
1736
|
leftOffset,
|
|
1533
1737
|
topOffset
|
|
1534
1738
|
});
|
|
1535
|
-
|
|
1536
|
-
|
|
1739
|
+
event.stopPropagation();
|
|
1740
|
+
event.preventDefault();
|
|
1537
1741
|
}
|
|
1742
|
+
/**
|
|
1743
|
+
* Handle cancelling the cell edit action
|
|
1744
|
+
*/
|
|
1745
|
+
|
|
1538
1746
|
|
|
1539
1747
|
handleEditCellCancel() {
|
|
1540
1748
|
this.setState({
|
|
@@ -1542,34 +1750,60 @@ class Grid extends PureComponent {
|
|
|
1542
1750
|
});
|
|
1543
1751
|
this.focus();
|
|
1544
1752
|
}
|
|
1753
|
+
/**
|
|
1754
|
+
* Handle a change in the value in an editing cell
|
|
1755
|
+
* @param value New value set
|
|
1756
|
+
*/
|
|
1757
|
+
|
|
1545
1758
|
|
|
1546
1759
|
handleEditCellChange(value) {
|
|
1547
1760
|
this.setState(_ref => {
|
|
1548
1761
|
var {
|
|
1549
1762
|
editingCell
|
|
1550
1763
|
} = _ref;
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1764
|
+
|
|
1765
|
+
try {
|
|
1766
|
+
assertIsDefined(editingCell);
|
|
1767
|
+
return {
|
|
1768
|
+
editingCell: _objectSpread(_objectSpread({}, editingCell), {}, {
|
|
1769
|
+
value
|
|
1770
|
+
})
|
|
1771
|
+
};
|
|
1772
|
+
} catch (e) {
|
|
1773
|
+
// This case should _never_ happen, since the editingCell shouldn't be null if this method is called
|
|
1774
|
+
var {
|
|
1775
|
+
onError
|
|
1776
|
+
} = this.props;
|
|
1777
|
+
onError(e);
|
|
1778
|
+
return null;
|
|
1779
|
+
}
|
|
1556
1780
|
});
|
|
1557
1781
|
}
|
|
1782
|
+
/**
|
|
1783
|
+
* Commit an edit for the currently editing cell
|
|
1784
|
+
* @param value Value that was committed
|
|
1785
|
+
* @param options Options for committing
|
|
1786
|
+
*/
|
|
1787
|
+
|
|
1558
1788
|
|
|
1559
1789
|
handleEditCellCommit(value) {
|
|
1560
1790
|
var {
|
|
1561
|
-
direction =
|
|
1791
|
+
direction = SELECTION_DIRECTION.DOWN,
|
|
1562
1792
|
fillRange = false
|
|
1563
1793
|
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1564
1794
|
var {
|
|
1565
|
-
|
|
1566
|
-
cursorRow: row,
|
|
1795
|
+
editingCell,
|
|
1567
1796
|
selectedRanges
|
|
1568
1797
|
} = this.state;
|
|
1798
|
+
if (!editingCell) throw new Error('editingCell not set');
|
|
1799
|
+
var {
|
|
1800
|
+
column,
|
|
1801
|
+
row
|
|
1802
|
+
} = editingCell;
|
|
1569
1803
|
|
|
1570
1804
|
if (!this.isValidForCell(column, row, value)) {
|
|
1571
1805
|
// Don't allow an invalid value to be commited, the editing cell should show an error
|
|
1572
|
-
if (direction
|
|
1806
|
+
if (direction === null) {
|
|
1573
1807
|
// If they clicked off of the editing cell, just remove focus
|
|
1574
1808
|
this.setState({
|
|
1575
1809
|
editingCell: null
|
|
@@ -1585,7 +1819,7 @@ class Grid extends PureComponent {
|
|
|
1585
1819
|
this.setValueForCell(column, row, value);
|
|
1586
1820
|
}
|
|
1587
1821
|
|
|
1588
|
-
if (direction
|
|
1822
|
+
if (direction !== null) {
|
|
1589
1823
|
this.moveCursorInDirection(direction);
|
|
1590
1824
|
}
|
|
1591
1825
|
|
|
@@ -1606,19 +1840,19 @@ class Grid extends PureComponent {
|
|
|
1606
1840
|
metrics
|
|
1607
1841
|
} = this;
|
|
1608
1842
|
|
|
1609
|
-
if (editingCell == null || metrics == null) {
|
|
1843
|
+
if (editingCell == null || metrics == null || !isEditableGridModel(model)) {
|
|
1610
1844
|
return null;
|
|
1611
1845
|
}
|
|
1612
1846
|
|
|
1613
1847
|
var {
|
|
1614
|
-
selectionRange
|
|
1848
|
+
selectionRange,
|
|
1615
1849
|
value,
|
|
1616
1850
|
isQuickEdit
|
|
1617
1851
|
} = editingCell;
|
|
1618
1852
|
var {
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
} =
|
|
1853
|
+
column,
|
|
1854
|
+
row
|
|
1855
|
+
} = editingCell;
|
|
1622
1856
|
var {
|
|
1623
1857
|
gridX,
|
|
1624
1858
|
gridY,
|
|
@@ -1630,10 +1864,9 @@ class Grid extends PureComponent {
|
|
|
1630
1864
|
var x = visibleColumnXs.get(column);
|
|
1631
1865
|
var y = visibleRowYs.get(row);
|
|
1632
1866
|
var w = visibleColumnWidths.get(column);
|
|
1633
|
-
var h = visibleRowHeights.get(row);
|
|
1634
|
-
var isVisible = x != null && y != null && w != null && h != null; // If the cell isn't visible, we still need to display an invisible cell for focus purposes
|
|
1867
|
+
var h = visibleRowHeights.get(row); // If the cell isn't visible, we still need to display an invisible cell for focus purposes
|
|
1635
1868
|
|
|
1636
|
-
var wrapperStyle =
|
|
1869
|
+
var wrapperStyle = x != null && y != null && w != null && h != null ? {
|
|
1637
1870
|
position: 'absolute',
|
|
1638
1871
|
left: gridX + x,
|
|
1639
1872
|
top: gridY + y,
|
|
@@ -1646,7 +1879,7 @@ class Grid extends PureComponent {
|
|
|
1646
1879
|
var modelRow = this.getModelRow(row);
|
|
1647
1880
|
var inputStyle = modelColumn != null && modelRow != null ? {
|
|
1648
1881
|
textAlign: model.textAlignForCell(modelColumn, modelRow)
|
|
1649
|
-
} :
|
|
1882
|
+
} : undefined;
|
|
1650
1883
|
var isValid = model.isValidForCell(modelColumn, modelRow, value);
|
|
1651
1884
|
return /*#__PURE__*/React.createElement("div", {
|
|
1652
1885
|
style: wrapperStyle
|
|
@@ -1687,62 +1920,35 @@ class Grid extends PureComponent {
|
|
|
1687
1920
|
|
|
1688
1921
|
}
|
|
1689
1922
|
|
|
1690
|
-
_defineProperty(Grid, "
|
|
1691
|
-
|
|
1692
|
-
_defineProperty(Grid, "dragTimeout", 1000);
|
|
1693
|
-
|
|
1694
|
-
_defineProperty(Grid, "getTheme", memoize(userTheme => _objectSpread(_objectSpread({}, GridTheme), userTheme)));
|
|
1695
|
-
|
|
1696
|
-
Grid.propTypes = {
|
|
1697
|
-
canvasOptions: PropTypes.shape({}),
|
|
1698
|
-
isStickyBottom: PropTypes.bool,
|
|
1699
|
-
isStickyRight: PropTypes.bool,
|
|
1700
|
-
metricCalculator: PropTypes.instanceOf(GridMetricCalculator),
|
|
1701
|
-
model: PropTypes.instanceOf(GridModel).isRequired,
|
|
1702
|
-
keyHandlers: PropTypes.arrayOf(PropTypes.instanceOf(KeyHandler)),
|
|
1703
|
-
mouseHandlers: PropTypes.arrayOf(PropTypes.instanceOf(GridMouseHandler)),
|
|
1704
|
-
movedColumns: PropTypes.arrayOf(PropTypes.shape({
|
|
1705
|
-
from: PropTypes.number.isRequired,
|
|
1706
|
-
to: PropTypes.number.isRequired
|
|
1707
|
-
})),
|
|
1708
|
-
movedRows: PropTypes.arrayOf(PropTypes.shape({
|
|
1709
|
-
from: PropTypes.number.isRequired,
|
|
1710
|
-
to: PropTypes.number.isRequired
|
|
1711
|
-
})),
|
|
1712
|
-
onError: PropTypes.func,
|
|
1713
|
-
onSelectionChanged: PropTypes.func,
|
|
1714
|
-
onMovedColumnsChanged: PropTypes.func,
|
|
1715
|
-
onMoveColumnComplete: PropTypes.func,
|
|
1716
|
-
onViewChanged: PropTypes.func,
|
|
1717
|
-
renderer: PropTypes.instanceOf(GridRenderer),
|
|
1718
|
-
stateOverride: PropTypes.shape({}),
|
|
1719
|
-
theme: PropTypes.shape({
|
|
1720
|
-
autoSelectColumn: PropTypes.bool,
|
|
1721
|
-
autoSelectRow: PropTypes.bool
|
|
1722
|
-
})
|
|
1723
|
-
};
|
|
1724
|
-
Grid.defaultProps = {
|
|
1923
|
+
_defineProperty(Grid, "defaultProps", {
|
|
1725
1924
|
canvasOptions: {
|
|
1726
1925
|
alpha: false
|
|
1727
1926
|
},
|
|
1728
1927
|
isStickyBottom: false,
|
|
1729
1928
|
isStickyRight: false,
|
|
1730
|
-
metricCalculator: null,
|
|
1731
1929
|
keyHandlers: [],
|
|
1732
1930
|
mouseHandlers: [],
|
|
1733
1931
|
movedColumns: [],
|
|
1734
1932
|
movedRows: [],
|
|
1735
|
-
onError: () =>
|
|
1736
|
-
onSelectionChanged: () =>
|
|
1737
|
-
onMovedColumnsChanged: () =>
|
|
1738
|
-
onMoveColumnComplete: () =>
|
|
1739
|
-
|
|
1740
|
-
|
|
1933
|
+
onError: () => undefined,
|
|
1934
|
+
onSelectionChanged: () => undefined,
|
|
1935
|
+
onMovedColumnsChanged: () => undefined,
|
|
1936
|
+
onMoveColumnComplete: () => undefined,
|
|
1937
|
+
onMovedRowsChanged: () => undefined,
|
|
1938
|
+
onMoveRowComplete: () => undefined,
|
|
1939
|
+
onViewChanged: () => undefined,
|
|
1741
1940
|
stateOverride: {},
|
|
1742
1941
|
theme: {
|
|
1743
1942
|
autoSelectColumn: false,
|
|
1744
1943
|
autoSelectRow: false
|
|
1745
1944
|
}
|
|
1746
|
-
};
|
|
1945
|
+
});
|
|
1946
|
+
|
|
1947
|
+
_defineProperty(Grid, "pixelsPerLine", 100 / 3);
|
|
1948
|
+
|
|
1949
|
+
_defineProperty(Grid, "dragTimeout", 1000);
|
|
1950
|
+
|
|
1951
|
+
_defineProperty(Grid, "getTheme", memoize(userTheme => _objectSpread(_objectSpread({}, GridTheme), userTheme)));
|
|
1952
|
+
|
|
1747
1953
|
export default Grid;
|
|
1748
1954
|
//# sourceMappingURL=Grid.js.map
|