@deephaven/grid 0.4.1-modules.0 → 0.5.2-beta.0
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.js +88 -40
- package/dist/CellInputField.js.map +1 -1
- package/dist/Grid.js +1484 -1449
- package/dist/Grid.js.map +1 -1
- package/dist/GridColorUtils.js +51 -18
- package/dist/GridColorUtils.js.map +1 -1
- package/dist/GridMetricCalculator.js +994 -1017
- package/dist/GridMetricCalculator.js.map +1 -1
- package/dist/GridModel.js +286 -171
- package/dist/GridModel.js.map +1 -1
- package/dist/GridMouseHandler.js +59 -39
- package/dist/GridMouseHandler.js.map +1 -1
- package/dist/GridRange.js +630 -572
- package/dist/GridRange.js.map +1 -1
- package/dist/GridRenderer.d.ts.map +1 -1
- package/dist/GridRenderer.js +1564 -1650
- package/dist/GridRenderer.js.map +1 -1
- package/dist/GridTestUtils.js +29 -15
- package/dist/GridTestUtils.js.map +1 -1
- package/dist/GridUtils.js +717 -679
- package/dist/GridUtils.js.map +1 -1
- package/dist/KeyHandler.js +18 -6
- package/dist/KeyHandler.js.map +1 -1
- package/dist/MockGridModel.js +210 -105
- package/dist/MockGridModel.js.map +1 -1
- package/dist/MockTreeGridModel.js +183 -113
- package/dist/MockTreeGridModel.js.map +1 -1
- package/dist/errors/PasteError.js +44 -5
- package/dist/errors/PasteError.js.map +1 -1
- package/dist/errors/index.js +1 -1
- package/dist/errors/index.js.map +1 -1
- package/dist/index.js +15 -15
- package/dist/index.js.map +1 -1
- package/dist/key-handlers/EditKeyHandler.js +75 -42
- package/dist/key-handlers/EditKeyHandler.js.map +1 -1
- package/dist/key-handlers/PasteKeyHandler.js +78 -42
- package/dist/key-handlers/PasteKeyHandler.js.map +1 -1
- package/dist/key-handlers/SelectionKeyHandler.js +234 -220
- package/dist/key-handlers/SelectionKeyHandler.js.map +1 -1
- package/dist/key-handlers/TreeKeyHandler.js +72 -42
- package/dist/key-handlers/TreeKeyHandler.js.map +1 -1
- package/dist/key-handlers/index.js +4 -4
- package/dist/key-handlers/index.js.map +1 -1
- package/dist/memoizeClear.js +1 -1
- package/dist/memoizeClear.js.map +1 -1
- package/dist/mouse-handlers/EditMouseHandler.js +50 -18
- package/dist/mouse-handlers/EditMouseHandler.js.map +1 -1
- package/dist/mouse-handlers/GridColumnMoveMouseHandler.js +163 -141
- package/dist/mouse-handlers/GridColumnMoveMouseHandler.js.map +1 -1
- package/dist/mouse-handlers/GridColumnSeparatorMouseHandler.js +86 -47
- package/dist/mouse-handlers/GridColumnSeparatorMouseHandler.js.map +1 -1
- package/dist/mouse-handlers/GridHorizontalScrollBarMouseHandler.d.ts.map +1 -1
- package/dist/mouse-handlers/GridHorizontalScrollBarMouseHandler.js +171 -143
- package/dist/mouse-handlers/GridHorizontalScrollBarMouseHandler.js.map +1 -1
- package/dist/mouse-handlers/GridRowMoveMouseHandler.js +147 -125
- package/dist/mouse-handlers/GridRowMoveMouseHandler.js.map +1 -1
- package/dist/mouse-handlers/GridRowSeparatorMouseHandler.js +86 -47
- package/dist/mouse-handlers/GridRowSeparatorMouseHandler.js.map +1 -1
- package/dist/mouse-handlers/GridRowTreeMouseHandler.js +76 -46
- package/dist/mouse-handlers/GridRowTreeMouseHandler.js.map +1 -1
- package/dist/mouse-handlers/GridScrollBarCornerMouseHandler.d.ts.map +1 -1
- package/dist/mouse-handlers/GridScrollBarCornerMouseHandler.js +62 -31
- package/dist/mouse-handlers/GridScrollBarCornerMouseHandler.js.map +1 -1
- package/dist/mouse-handlers/GridSelectionMouseHandler.js +222 -200
- package/dist/mouse-handlers/GridSelectionMouseHandler.js.map +1 -1
- package/dist/mouse-handlers/GridSeparatorMouseHandler.js +253 -206
- package/dist/mouse-handlers/GridSeparatorMouseHandler.js.map +1 -1
- package/dist/mouse-handlers/GridVerticalScrollBarMouseHandler.d.ts.map +1 -1
- package/dist/mouse-handlers/GridVerticalScrollBarMouseHandler.js +172 -144
- package/dist/mouse-handlers/GridVerticalScrollBarMouseHandler.js.map +1 -1
- package/dist/mouse-handlers/index.js +10 -10
- package/dist/mouse-handlers/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/mouse-handlers/GridHorizontalScrollBarMouseHandler.js"],"names":["GridMouseHandler","GridHorizontalScrollBarMouseHandler","
|
|
1
|
+
{"version":3,"sources":["../../src/mouse-handlers/GridHorizontalScrollBarMouseHandler.js"],"names":["GridMouseHandler","GridHorizontalScrollBarMouseHandler","gridPoint","grid","theme","getTheme","scrollBarSize","scrollBarHoverSize","metrics","x","y","lastLeft","lastTop","rowHeaderWidth","width","height","scrollBarWidth","barWidth","handleWidth","scrollX","isInScrollBar","mouseBarX","dragOffset","setState","isDraggingHorizontalScrollBar","rawLeft","Math","min","max","getLeftWithOffsetFromRawLeft","newLeft","left","newLeftOffset","leftOffset","setViewState","isDragging","metricCalculator","scrollSnapToColumn","round","floor","leftOffsetPercent","columnWidth","visibleColumnWidths","get","metricState","getMetricState","getVisibleColumnWidth"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAOA,gBAAP,MAA6B,qBAA7B;AAEA;;IACMC,mC;;;;;;;;;;;;;;;;iEACS,I;;6DAGJ,S;;;;;;;WAET,uBAAcC,SAAd,EAAyBC,IAAzB,EAA+B;AAC7B,UAAMC,KAAK,GAAGD,IAAI,CAACE,QAAL,EAAd;AAEA,UAAQC,aAAR,GAA8CF,KAA9C,CAAQE,aAAR;AAAA,UAAuBC,kBAAvB,GAA8CH,KAA9C,CAAuBG,kBAAvB;AACA,UAAQC,OAAR,GAAoBL,IAApB,CAAQK,OAAR;AACA,UAAQC,CAAR,GAAiBP,SAAjB,CAAQO,CAAR;AAAA,UAAWC,CAAX,GAAiBR,SAAjB,CAAWQ,CAAX;AACA,UAAQC,QAAR,GAA6DH,OAA7D,CAAQG,QAAR;AAAA,UAAkBC,OAAlB,GAA6DJ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UAAU,EAAVA;AAAR,SAAP;AACD;;AACD,UAAMF,IAAI,GAAGL,IAAI,CAACa,KAAL,CAAWd,OAAX,CAAb;AACA,UAAMe,iBAAiB,GAAGf,OAAO,GAAGM,IAApC;AACA,UAAIU,WAAW,GAAGjC,OAAO,CAACkC,mBAAR,CAA4BC,GAA5B,CAAgCZ,IAAhC,CAAlB;;AACA,UAAIU,WAAW,IAAI,IAAnB,EAAyB;AACvB,YAAMG,WAAW,GAAGzC,IAAI,CAAC0C,cAAL,EAApB;AACAJ,QAAAA,WAAW,GAAGL,gBAAgB,CAACU,qBAAjB,CAAuCf,IAAvC,EAA6Ca,WAA7C,CAAd;AACD;;AACD,UAAMX,UAAU,GAAGQ,WAAW,GAAGD,iBAAjC;AAEA,aAAO;AAAET,QAAAA,IAAI,EAAJA,IAAF;AAAQE,QAAAA,UAAU,EAAVA;AAAR,OAAP;AACD;;;;EA9I+CjC,gB;;AAiJlD,eAAeC,mCAAf","sourcesContent":["import GridMouseHandler from '../GridMouseHandler';\n\n/* eslint class-methods-use-this: \"off\" */\nclass GridHorizontalScrollBarMouseHandler extends GridMouseHandler {\n dragOffset = null;\n\n // to trigger pointer event blocking\n cursor = 'default';\n\n isInScrollBar(gridPoint, grid) {\n const theme = grid.getTheme();\n\n const { scrollBarSize, scrollBarHoverSize } = theme;\n const { metrics } = grid;\n const { x, y } = gridPoint;\n const { lastLeft, lastTop, rowHeaderWidth, width, height } = metrics;\n const scrollBarWidth = lastTop > 0 ? width - scrollBarSize : width;\n return (\n scrollBarSize > 0 &&\n lastLeft > 0 &&\n y >= height - scrollBarHoverSize &&\n y < height &&\n x > rowHeaderWidth &&\n x < scrollBarWidth\n );\n }\n\n onDown(gridPoint, grid) {\n const { metrics } = grid;\n const { x } = gridPoint;\n const {\n barWidth,\n handleWidth,\n lastLeft,\n rowHeaderWidth,\n scrollX,\n } = metrics;\n if (!this.isInScrollBar(gridPoint, grid)) {\n return false;\n }\n\n const mouseBarX = x - rowHeaderWidth;\n if (mouseBarX >= scrollX && mouseBarX <= scrollX + handleWidth) {\n // Grabbed the horizontal handle\n this.dragOffset = mouseBarX - scrollX;\n grid.setState({ isDraggingHorizontalScrollBar: true });\n } else {\n this.dragOffset = 0;\n const rawLeft = Math.min(\n Math.max(0, (mouseBarX / (barWidth - handleWidth)) * lastLeft),\n lastLeft\n );\n\n const {\n left: newLeft,\n leftOffset: newLeftOffset,\n } = GridHorizontalScrollBarMouseHandler.getLeftWithOffsetFromRawLeft(\n grid,\n rawLeft\n );\n grid.setViewState({\n left: newLeft,\n leftOffset: newLeftOffset,\n isDraggingHorizontalScrollBar: true,\n isDragging: true,\n });\n }\n\n return true;\n }\n\n onDrag(gridPoint, grid) {\n if (this.dragOffset != null) {\n const { x } = gridPoint;\n const { metrics } = grid;\n const { barWidth, handleWidth, lastLeft, rowHeaderWidth } = metrics;\n const mouseBarX = x - rowHeaderWidth;\n\n const rawLeft = Math.min(\n Math.max(\n 0,\n ((mouseBarX - this.dragOffset) / (barWidth - handleWidth)) * lastLeft\n ),\n lastLeft\n );\n\n const {\n left: newLeft,\n leftOffset: newLeftOffset,\n } = GridHorizontalScrollBarMouseHandler.getLeftWithOffsetFromRawLeft(\n grid,\n rawLeft\n );\n grid.setViewState({\n left: newLeft,\n leftOffset: newLeftOffset,\n isDraggingHorizontalScrollBar: true,\n isDragging: true,\n });\n\n return true;\n }\n return false;\n }\n\n onMove(gridPoint, grid) {\n return this.isInScrollBar(gridPoint, grid);\n }\n\n onUp(gridPoint, grid) {\n if (this.dragOffset != null) {\n this.dragOffset = null;\n grid.setState({\n isDraggingHorizontalScrollBar: false,\n isDragging: false,\n });\n }\n\n return this.isInScrollBar(gridPoint, grid);\n }\n\n onClick(gridPoint, grid) {\n return this.isInScrollBar(gridPoint, grid);\n }\n\n static getLeftWithOffsetFromRawLeft(grid, rawLeft) {\n const theme = grid.getTheme();\n const { metrics, metricCalculator } = grid;\n\n if (theme.scrollSnapToColumn) {\n const left = Math.round(rawLeft);\n const leftOffset = 0;\n\n return { left, leftOffset };\n }\n const left = Math.floor(rawLeft);\n const leftOffsetPercent = rawLeft - left;\n let columnWidth = metrics.visibleColumnWidths.get(left);\n if (columnWidth == null) {\n const metricState = grid.getMetricState();\n columnWidth = metricCalculator.getVisibleColumnWidth(left, metricState);\n }\n const leftOffset = columnWidth * leftOffsetPercent;\n\n return { left, leftOffset };\n }\n}\n\nexport default GridHorizontalScrollBarMouseHandler;\n"],"file":"GridHorizontalScrollBarMouseHandler.js"}
|
|
@@ -1,161 +1,183 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
2
|
+
|
|
3
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
4
|
+
|
|
5
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
6
|
+
|
|
7
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
8
|
+
|
|
9
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
10
|
+
|
|
11
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
12
|
+
|
|
13
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
14
|
+
|
|
15
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
16
|
+
|
|
17
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
18
|
+
|
|
19
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
20
|
+
|
|
21
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
22
|
+
|
|
1
23
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
24
|
|
|
3
|
-
import GridUtils from
|
|
4
|
-
import GridMouseHandler from
|
|
25
|
+
import GridUtils from '../GridUtils';
|
|
26
|
+
import GridMouseHandler from '../GridMouseHandler';
|
|
5
27
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
super(...arguments);
|
|
28
|
+
var GridRowMoveMouseHandler = /*#__PURE__*/function (_GridMouseHandler) {
|
|
29
|
+
_inherits(GridRowMoveMouseHandler, _GridMouseHandler);
|
|
9
30
|
|
|
10
|
-
|
|
31
|
+
var _super = _createSuper(GridRowMoveMouseHandler);
|
|
11
32
|
|
|
12
|
-
|
|
13
|
-
|
|
33
|
+
function GridRowMoveMouseHandler() {
|
|
34
|
+
var _this;
|
|
14
35
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
var {
|
|
20
|
-
x,
|
|
21
|
-
y,
|
|
22
|
-
row
|
|
23
|
-
} = gridPoint;
|
|
24
|
-
var {
|
|
25
|
-
metrics
|
|
26
|
-
} = grid;
|
|
27
|
-
var {
|
|
28
|
-
columnHeaderHeight,
|
|
29
|
-
rowHeaderWidth,
|
|
30
|
-
visibleRowYs
|
|
31
|
-
} = metrics;
|
|
32
|
-
|
|
33
|
-
if (x <= rowHeaderWidth && model.isRowMovable(row)) {
|
|
34
|
-
var rowY = visibleRowYs.get(row);
|
|
35
|
-
this.draggingOffset = y - rowY - columnHeaderHeight;
|
|
36
|
-
grid.setState({
|
|
37
|
-
draggingRowOffset: this.draggingOffset
|
|
38
|
-
});
|
|
36
|
+
_classCallCheck(this, GridRowMoveMouseHandler);
|
|
37
|
+
|
|
38
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
39
|
+
args[_key] = arguments[_key];
|
|
39
40
|
}
|
|
40
41
|
|
|
41
|
-
|
|
42
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
43
|
+
|
|
44
|
+
_defineProperty(_assertThisInitialized(_this), "cursor", 'move');
|
|
45
|
+
|
|
46
|
+
_defineProperty(_assertThisInitialized(_this), "draggingOffset", null);
|
|
47
|
+
|
|
48
|
+
return _this;
|
|
42
49
|
}
|
|
43
50
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
51
|
+
_createClass(GridRowMoveMouseHandler, [{
|
|
52
|
+
key: "onDown",
|
|
53
|
+
value: function onDown(gridPoint, grid) {
|
|
54
|
+
var model = grid.props.model;
|
|
55
|
+
var x = gridPoint.x,
|
|
56
|
+
y = gridPoint.y,
|
|
57
|
+
row = gridPoint.row;
|
|
58
|
+
var metrics = grid.metrics;
|
|
59
|
+
var columnHeaderHeight = metrics.columnHeaderHeight,
|
|
60
|
+
rowHeaderWidth = metrics.rowHeaderWidth,
|
|
61
|
+
visibleRowYs = metrics.visibleRowYs;
|
|
62
|
+
|
|
63
|
+
if (x <= rowHeaderWidth && model.isRowMovable(row)) {
|
|
64
|
+
var rowY = visibleRowYs.get(row);
|
|
65
|
+
this.draggingOffset = y - rowY - columnHeaderHeight;
|
|
66
|
+
grid.setState({
|
|
67
|
+
draggingRowOffset: this.draggingOffset
|
|
68
|
+
});
|
|
69
|
+
}
|
|
48
70
|
|
|
49
|
-
var {
|
|
50
|
-
model
|
|
51
|
-
} = grid.props;
|
|
52
|
-
var {
|
|
53
|
-
draggingRow
|
|
54
|
-
} = grid.state;
|
|
55
|
-
var {
|
|
56
|
-
mouseX,
|
|
57
|
-
mouseY
|
|
58
|
-
} = grid.state;
|
|
59
|
-
|
|
60
|
-
if (mouseX == null || mouseY == null) {
|
|
61
71
|
return false;
|
|
62
72
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
} = grid.getGridPointFromXY(mouseX, mouseY);
|
|
68
|
-
|
|
69
|
-
if (row != null && !model.isRowMovable(row)) {
|
|
73
|
+
}, {
|
|
74
|
+
key: "onDrag",
|
|
75
|
+
value: function onDrag(gridPoint, grid) {
|
|
76
|
+
if (this.draggingOffset == null) {
|
|
70
77
|
return false;
|
|
71
78
|
}
|
|
72
79
|
|
|
73
|
-
|
|
74
|
-
grid.
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
80
|
+
var model = grid.props.model;
|
|
81
|
+
var draggingRow = grid.state.draggingRow;
|
|
82
|
+
var _grid$state = grid.state,
|
|
83
|
+
mouseX = _grid$state.mouseX,
|
|
84
|
+
mouseY = _grid$state.mouseY;
|
|
78
85
|
|
|
79
|
-
if (
|
|
86
|
+
if (mouseX == null || mouseY == null) {
|
|
80
87
|
return false;
|
|
81
88
|
}
|
|
82
|
-
}
|
|
83
89
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
minY = visibleRowYs.get(topRow) + visibleRowHeights.get(topRow) * 0.5 + columnHeaderHeight;
|
|
103
|
-
}
|
|
90
|
+
if (draggingRow == null) {
|
|
91
|
+
var _grid$getGridPointFro = grid.getGridPointFromXY(mouseX, mouseY),
|
|
92
|
+
row = _grid$getGridPointFro.row;
|
|
93
|
+
|
|
94
|
+
if (row != null && !model.isRowMovable(row)) {
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
draggingRow = row;
|
|
99
|
+
grid.setState({
|
|
100
|
+
draggingRow: draggingRow,
|
|
101
|
+
isDragging: true
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
if (draggingRow == null) {
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
104
108
|
|
|
105
|
-
|
|
109
|
+
var metrics = grid.metrics;
|
|
110
|
+
var top = metrics.top,
|
|
111
|
+
lastTop = metrics.lastTop,
|
|
112
|
+
bottom = metrics.bottom,
|
|
113
|
+
bottomVisible = metrics.bottomVisible,
|
|
114
|
+
rowCount = metrics.rowCount,
|
|
115
|
+
columnHeaderHeight = metrics.columnHeaderHeight,
|
|
116
|
+
visibleRowHeights = metrics.visibleRowHeights,
|
|
117
|
+
visibleRowYs = metrics.visibleRowYs,
|
|
118
|
+
height = metrics.height;
|
|
119
|
+
var minY = columnHeaderHeight;
|
|
120
|
+
|
|
121
|
+
if (top < draggingRow) {
|
|
122
|
+
var topRow = draggingRow - 1;
|
|
123
|
+
minY = visibleRowYs.get(topRow) + visibleRowHeights.get(topRow) * 0.5 + columnHeaderHeight;
|
|
124
|
+
}
|
|
106
125
|
|
|
107
|
-
|
|
108
|
-
var bottomRow = draggingRow + 1;
|
|
109
|
-
maxY = visibleRowYs.get(bottomRow) + visibleRowHeights.get(bottomRow) * 0.5 + columnHeaderHeight;
|
|
110
|
-
}
|
|
126
|
+
var maxY = height;
|
|
111
127
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
128
|
+
if (draggingRow < bottom) {
|
|
129
|
+
var bottomRow = draggingRow + 1;
|
|
130
|
+
maxY = visibleRowYs.get(bottomRow) + visibleRowHeights.get(bottomRow) * 0.5 + columnHeaderHeight;
|
|
131
|
+
}
|
|
115
132
|
|
|
116
|
-
|
|
117
|
-
movedRows = GridUtils.moveItem(draggingRow, draggingRow - 1, movedRows);
|
|
118
|
-
draggingRow -= 1;
|
|
119
|
-
} else if (maxY < mouseY && draggingRow < rowCount - 1 && model.isRowMovable(draggingRow + 1)) {
|
|
120
|
-
movedRows = GridUtils.moveItem(draggingRow, draggingRow + 1, movedRows);
|
|
121
|
-
draggingRow += 1;
|
|
122
|
-
}
|
|
133
|
+
var movedRows = grid.state.movedRows;
|
|
123
134
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
135
|
+
if (mouseY < minY && draggingRow > 0 && model.isRowMovable(draggingRow - 1)) {
|
|
136
|
+
movedRows = GridUtils.moveItem(draggingRow, draggingRow - 1, movedRows);
|
|
137
|
+
draggingRow -= 1;
|
|
138
|
+
} else if (maxY < mouseY && draggingRow < rowCount - 1 && model.isRowMovable(draggingRow + 1)) {
|
|
139
|
+
movedRows = GridUtils.moveItem(draggingRow, draggingRow + 1, movedRows);
|
|
140
|
+
draggingRow += 1;
|
|
141
|
+
}
|
|
130
142
|
|
|
131
|
-
if (mouseY < minMoveY && top > 0) {
|
|
132
143
|
grid.setState({
|
|
133
|
-
|
|
144
|
+
movedRows: movedRows,
|
|
145
|
+
draggingRow: draggingRow
|
|
134
146
|
});
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
147
|
+
var minMoveY = columnHeaderHeight + visibleRowHeights.get(top) * 0.5;
|
|
148
|
+
var maxMoveY = columnHeaderHeight + visibleRowYs.get(bottomVisible) + visibleRowHeights.get(bottomVisible) * 0.5;
|
|
149
|
+
|
|
150
|
+
if (mouseY < minMoveY && top > 0) {
|
|
151
|
+
grid.setState({
|
|
152
|
+
top: top - 1
|
|
153
|
+
});
|
|
154
|
+
} else if (mouseY > maxMoveY && top < lastTop) {
|
|
155
|
+
grid.setState({
|
|
156
|
+
top: top + 1
|
|
157
|
+
});
|
|
158
|
+
}
|
|
143
159
|
|
|
144
|
-
onUp(_, grid) {
|
|
145
|
-
if (this.draggingOffset != null) {
|
|
146
|
-
this.draggingOffset = null;
|
|
147
|
-
grid.setState({
|
|
148
|
-
draggingRowOffset: null,
|
|
149
|
-
draggingRow: null,
|
|
150
|
-
isDragging: false
|
|
151
|
-
});
|
|
152
160
|
return true;
|
|
153
161
|
}
|
|
162
|
+
}, {
|
|
163
|
+
key: "onUp",
|
|
164
|
+
value: function onUp(_, grid) {
|
|
165
|
+
if (this.draggingOffset != null) {
|
|
166
|
+
this.draggingOffset = null;
|
|
167
|
+
grid.setState({
|
|
168
|
+
draggingRowOffset: null,
|
|
169
|
+
draggingRow: null,
|
|
170
|
+
isDragging: false
|
|
171
|
+
});
|
|
172
|
+
return true;
|
|
173
|
+
}
|
|
154
174
|
|
|
155
|
-
|
|
156
|
-
|
|
175
|
+
return false;
|
|
176
|
+
}
|
|
177
|
+
}]);
|
|
157
178
|
|
|
158
|
-
|
|
179
|
+
return GridRowMoveMouseHandler;
|
|
180
|
+
}(GridMouseHandler);
|
|
159
181
|
|
|
160
182
|
export default GridRowMoveMouseHandler;
|
|
161
183
|
//# sourceMappingURL=GridRowMoveMouseHandler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/mouse-handlers/GridRowMoveMouseHandler.js"],"names":["GridUtils","GridMouseHandler","GridRowMoveMouseHandler","
|
|
1
|
+
{"version":3,"sources":["../../src/mouse-handlers/GridRowMoveMouseHandler.js"],"names":["GridUtils","GridMouseHandler","GridRowMoveMouseHandler","gridPoint","grid","model","props","x","y","row","metrics","columnHeaderHeight","rowHeaderWidth","visibleRowYs","isRowMovable","rowY","get","draggingOffset","setState","draggingRowOffset","draggingRow","state","mouseX","mouseY","getGridPointFromXY","isDragging","top","lastTop","bottom","bottomVisible","rowCount","visibleRowHeights","height","minY","topRow","maxY","bottomRow","movedRows","moveItem","minMoveY","maxMoveY","_"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAOA,SAAP,MAAsB,cAAtB;AACA,OAAOC,gBAAP,MAA6B,qBAA7B;;IAEMC,uB;;;;;;;;;;;;;;;;6DACK,M;;qEAEQ,I;;;;;;;WAEjB,gBAAOC,SAAP,EAAkBC,IAAlB,EAAwB;AACtB,UAAQC,KAAR,GAAkBD,IAAI,CAACE,KAAvB,CAAQD,KAAR;AACA,UAAQE,CAAR,GAAsBJ,SAAtB,CAAQI,CAAR;AAAA,UAAWC,CAAX,GAAsBL,SAAtB,CAAWK,CAAX;AAAA,UAAcC,GAAd,GAAsBN,SAAtB,CAAcM,GAAd;AACA,UAAQC,OAAR,GAAoBN,IAApB,CAAQM,OAAR;AACA,UAAQC,kBAAR,GAA6DD,OAA7D,CAAQC,kBAAR;AAAA,UAA4BC,cAA5B,GAA6DF,OAA7D,CAA4BE,cAA5B;AAAA,UAA4CC,YAA5C,GAA6DH,OAA7D,CAA4CG,YAA5C;;AAEA,UAAIN,CAAC,IAAIK,cAAL,IAAuBP,KAAK,CAACS,YAAN,CAAmBL,GAAnB,CAA3B,EAAoD;AAClD,YAAMM,IAAI,GAAGF,YAAY,CAACG,GAAb,CAAiBP,GAAjB,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EAAE;AAHA,SAAd;AAKA,eAAO,IAAP;AACD;;AAED,aAAO,KAAP;AACD;;;;EAxHmCxB,gB;;AA2HtC,eAAeC,uBAAf","sourcesContent":["import GridUtils from '../GridUtils';\nimport GridMouseHandler from '../GridMouseHandler';\n\nclass GridRowMoveMouseHandler extends GridMouseHandler {\n cursor = 'move';\n\n draggingOffset = null;\n\n onDown(gridPoint, grid) {\n const { model } = grid.props;\n const { x, y, row } = gridPoint;\n const { metrics } = grid;\n const { columnHeaderHeight, rowHeaderWidth, visibleRowYs } = metrics;\n\n if (x <= rowHeaderWidth && model.isRowMovable(row)) {\n const rowY = visibleRowYs.get(row);\n this.draggingOffset = y - rowY - columnHeaderHeight;\n grid.setState({ draggingRowOffset: this.draggingOffset });\n }\n return false;\n }\n\n onDrag(gridPoint, grid) {\n if (this.draggingOffset == null) {\n return false;\n }\n\n const { model } = grid.props;\n let { draggingRow } = grid.state;\n const { mouseX, mouseY } = grid.state;\n if (mouseX == null || mouseY == null) {\n return false;\n }\n\n if (draggingRow == null) {\n const { row } = grid.getGridPointFromXY(mouseX, mouseY);\n if (row != null && !model.isRowMovable(row)) {\n return false;\n }\n\n draggingRow = row;\n\n grid.setState({ draggingRow, isDragging: true });\n\n if (draggingRow == null) {\n return false;\n }\n }\n\n const { metrics } = grid;\n const {\n top,\n lastTop,\n bottom,\n bottomVisible,\n rowCount,\n columnHeaderHeight,\n visibleRowHeights,\n visibleRowYs,\n height,\n } = metrics;\n let minY = columnHeaderHeight;\n if (top < draggingRow) {\n const topRow = draggingRow - 1;\n minY =\n visibleRowYs.get(topRow) +\n visibleRowHeights.get(topRow) * 0.5 +\n columnHeaderHeight;\n }\n\n let maxY = height;\n if (draggingRow < bottom) {\n const bottomRow = draggingRow + 1;\n maxY =\n visibleRowYs.get(bottomRow) +\n visibleRowHeights.get(bottomRow) * 0.5 +\n columnHeaderHeight;\n }\n\n let { movedRows } = grid.state;\n if (\n mouseY < minY &&\n draggingRow > 0 &&\n model.isRowMovable(draggingRow - 1)\n ) {\n movedRows = GridUtils.moveItem(draggingRow, draggingRow - 1, movedRows);\n draggingRow -= 1;\n } else if (\n maxY < mouseY &&\n draggingRow < rowCount - 1 &&\n model.isRowMovable(draggingRow + 1)\n ) {\n movedRows = GridUtils.moveItem(draggingRow, draggingRow + 1, movedRows);\n draggingRow += 1;\n }\n grid.setState({ movedRows, draggingRow });\n\n const minMoveY = columnHeaderHeight + visibleRowHeights.get(top) * 0.5;\n const maxMoveY =\n columnHeaderHeight +\n visibleRowYs.get(bottomVisible) +\n visibleRowHeights.get(bottomVisible) * 0.5;\n if (mouseY < minMoveY && top > 0) {\n grid.setState({ top: top - 1 });\n } else if (mouseY > maxMoveY && top < lastTop) {\n grid.setState({ top: top + 1 });\n }\n\n return true;\n }\n\n onUp(_, grid) {\n if (this.draggingOffset != null) {\n this.draggingOffset = null;\n grid.setState({\n draggingRowOffset: null,\n draggingRow: null,\n isDragging: false,\n });\n return true;\n }\n\n return false;\n }\n}\n\nexport default GridRowMoveMouseHandler;\n"],"file":"GridRowMoveMouseHandler.js"}
|
|
@@ -1,76 +1,115 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
2
|
+
|
|
3
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
4
|
+
|
|
5
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
6
|
+
|
|
7
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
8
|
+
|
|
9
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
10
|
+
|
|
11
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
12
|
+
|
|
13
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
14
|
+
|
|
15
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
16
|
+
|
|
17
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
18
|
+
|
|
19
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
20
|
+
|
|
21
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
22
|
+
|
|
1
23
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
24
|
|
|
3
25
|
/* eslint class-methods-use-this: "off" */
|
|
4
|
-
import GridUtils from
|
|
5
|
-
import GridSeparatorMouseHandler from
|
|
26
|
+
import GridUtils from '../GridUtils';
|
|
27
|
+
import GridSeparatorMouseHandler from './GridSeparatorMouseHandler';
|
|
6
28
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
super(...arguments);
|
|
29
|
+
var GridRowSeparatorMouseHandler = /*#__PURE__*/function (_GridSeparatorMouseHa) {
|
|
30
|
+
_inherits(GridRowSeparatorMouseHandler, _GridSeparatorMouseHa);
|
|
10
31
|
|
|
11
|
-
|
|
32
|
+
var _super = _createSuper(GridRowSeparatorMouseHandler);
|
|
12
33
|
|
|
13
|
-
|
|
34
|
+
function GridRowSeparatorMouseHandler() {
|
|
35
|
+
var _this;
|
|
14
36
|
|
|
15
|
-
|
|
37
|
+
_classCallCheck(this, GridRowSeparatorMouseHandler);
|
|
16
38
|
|
|
17
|
-
|
|
39
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
40
|
+
args[_key] = arguments[_key];
|
|
41
|
+
}
|
|
18
42
|
|
|
19
|
-
|
|
43
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
20
44
|
|
|
21
|
-
_defineProperty(
|
|
45
|
+
_defineProperty(_assertThisInitialized(_this), "hiddenCursor", 's-resize');
|
|
22
46
|
|
|
23
|
-
_defineProperty(
|
|
47
|
+
_defineProperty(_assertThisInitialized(_this), "defaultCursor", 'row-resize');
|
|
24
48
|
|
|
25
|
-
_defineProperty(
|
|
49
|
+
_defineProperty(_assertThisInitialized(_this), "pointProperty", 'y');
|
|
26
50
|
|
|
27
|
-
_defineProperty(
|
|
51
|
+
_defineProperty(_assertThisInitialized(_this), "userSizesProperty", 'userRowHeights');
|
|
28
52
|
|
|
29
|
-
_defineProperty(
|
|
53
|
+
_defineProperty(_assertThisInitialized(_this), "visibleOffsetProperty", 'visibleRowYs');
|
|
30
54
|
|
|
31
|
-
_defineProperty(
|
|
55
|
+
_defineProperty(_assertThisInitialized(_this), "visibleSizesProperty", 'visibleRowHeights');
|
|
32
56
|
|
|
33
|
-
_defineProperty(
|
|
57
|
+
_defineProperty(_assertThisInitialized(_this), "marginProperty", 'columnHeaderHeight');
|
|
34
58
|
|
|
35
|
-
_defineProperty(
|
|
59
|
+
_defineProperty(_assertThisInitialized(_this), "calculatedSizesProperty", 'calculatedRowHeights');
|
|
36
60
|
|
|
37
|
-
_defineProperty(
|
|
38
|
-
}
|
|
61
|
+
_defineProperty(_assertThisInitialized(_this), "modelIndexesProperty", 'modelRows');
|
|
39
62
|
|
|
40
|
-
|
|
41
|
-
var checkAllowResize = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
42
|
-
var theme = grid.getTheme();
|
|
63
|
+
_defineProperty(_assertThisInitialized(_this), "firstIndexProperty", 'firstRow');
|
|
43
64
|
|
|
44
|
-
|
|
45
|
-
return null;
|
|
46
|
-
}
|
|
65
|
+
_defineProperty(_assertThisInitialized(_this), "treePaddingProperty", 'treePaddingX');
|
|
47
66
|
|
|
48
|
-
|
|
49
|
-
x,
|
|
50
|
-
y
|
|
51
|
-
} = gridPoint;
|
|
52
|
-
var {
|
|
53
|
-
metrics
|
|
54
|
-
} = grid;
|
|
55
|
-
return GridUtils.getRowSeparatorIndex(x, y, metrics, theme);
|
|
56
|
-
}
|
|
67
|
+
_defineProperty(_assertThisInitialized(_this), "getHiddenItems", GridUtils.getHiddenRows);
|
|
57
68
|
|
|
58
|
-
|
|
59
|
-
metricCalculator.setRowHeight(modelIndex, size);
|
|
60
|
-
}
|
|
69
|
+
_defineProperty(_assertThisInitialized(_this), "getNextShownItem", GridUtils.getNextShownRow);
|
|
61
70
|
|
|
62
|
-
|
|
63
|
-
metricCalculator.setRowHeight(modelIndex);
|
|
64
|
-
}
|
|
71
|
+
_defineProperty(_assertThisInitialized(_this), "getSeparatorIndex", GridRowSeparatorMouseHandler.getRowSeparatorIndex);
|
|
65
72
|
|
|
66
|
-
|
|
67
|
-
grid.setState({
|
|
68
|
-
draggingRowSeparator: separatorIndex,
|
|
69
|
-
isDragging: !!separatorIndex
|
|
70
|
-
});
|
|
73
|
+
return _this;
|
|
71
74
|
}
|
|
72
75
|
|
|
73
|
-
|
|
76
|
+
_createClass(GridRowSeparatorMouseHandler, [{
|
|
77
|
+
key: "setSize",
|
|
78
|
+
value: function setSize(metricCalculator, modelIndex, size) {
|
|
79
|
+
metricCalculator.setRowHeight(modelIndex, size);
|
|
80
|
+
}
|
|
81
|
+
}, {
|
|
82
|
+
key: "resetSize",
|
|
83
|
+
value: function resetSize(metricCalculator, modelIndex) {
|
|
84
|
+
metricCalculator.setRowHeight(modelIndex);
|
|
85
|
+
}
|
|
86
|
+
}, {
|
|
87
|
+
key: "updateSeparator",
|
|
88
|
+
value: function updateSeparator(grid, separatorIndex) {
|
|
89
|
+
grid.setState({
|
|
90
|
+
draggingRowSeparator: separatorIndex,
|
|
91
|
+
isDragging: !!separatorIndex
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
}], [{
|
|
95
|
+
key: "getRowSeparatorIndex",
|
|
96
|
+
value: function getRowSeparatorIndex(gridPoint, grid) {
|
|
97
|
+
var checkAllowResize = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
98
|
+
var theme = grid.getTheme();
|
|
99
|
+
|
|
100
|
+
if (checkAllowResize && !theme.allowRowResize) {
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
var x = gridPoint.x,
|
|
105
|
+
y = gridPoint.y;
|
|
106
|
+
var metrics = grid.metrics;
|
|
107
|
+
return GridUtils.getRowSeparatorIndex(x, y, metrics, theme);
|
|
108
|
+
}
|
|
109
|
+
}]);
|
|
110
|
+
|
|
111
|
+
return GridRowSeparatorMouseHandler;
|
|
112
|
+
}(GridSeparatorMouseHandler);
|
|
74
113
|
|
|
75
114
|
export default GridRowSeparatorMouseHandler;
|
|
76
115
|
//# sourceMappingURL=GridRowSeparatorMouseHandler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/mouse-handlers/GridRowSeparatorMouseHandler.js"],"names":["GridUtils","GridSeparatorMouseHandler","GridRowSeparatorMouseHandler","getHiddenRows","getNextShownRow","getRowSeparatorIndex","
|
|
1
|
+
{"version":3,"sources":["../../src/mouse-handlers/GridRowSeparatorMouseHandler.js"],"names":["GridUtils","GridSeparatorMouseHandler","GridRowSeparatorMouseHandler","getHiddenRows","getNextShownRow","getRowSeparatorIndex","metricCalculator","modelIndex","size","setRowHeight","grid","separatorIndex","setState","draggingRowSeparator","isDragging","gridPoint","checkAllowResize","theme","getTheme","allowRowResize","x","y","metrics"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA,OAAOA,SAAP,MAAsB,cAAtB;AACA,OAAOC,yBAAP,MAAsC,6BAAtC;;IAEMC,4B;;;;;;;;;;;;;;;;mEAaW,U;;oEAEC,Y;;oEAEA,G;;wEAEI,gB;;4EAEI,c;;2EAED,mB;;qEAEN,oB;;8EAES,sB;;2EAEH,W;;yEAEF,U;;0EAEC,c;;qEAELF,SAAS,CAACG,a;;uEAERH,SAAS,CAACI,e;;wEAiBTF,4BAA4B,CAACG,oB;;;;;;;WAfjD,iBAAQC,gBAAR,EAA0BC,UAA1B,EAAsCC,IAAtC,EAA4C;AAC1CF,MAAAA,gBAAgB,CAACG,YAAjB,CAA8BF,UAA9B,EAA0CC,IAA1C;AACD;;;WAED,mBAAUF,gBAAV,EAA4BC,UAA5B,EAAwC;AACtCD,MAAAA,gBAAgB,CAACG,YAAjB,CAA8BF,UAA9B;AACD;;;WAED,yBAAgBG,IAAhB,EAAsBC,cAAtB,EAAsC;AACpCD,MAAAA,IAAI,CAACE,QAAL,CAAc;AACZC,QAAAA,oBAAoB,EAAEF,cADV;AAEZG,QAAAA,UAAU,EAAE,CAAC,CAACH;AAFF,OAAd;AAID;;;WAnDD,8BAA4BI,SAA5B,EAAuCL,IAAvC,EAAsE;AAAA,UAAzBM,gBAAyB,uEAAN,IAAM;AACpE,UAAMC,KAAK,GAAGP,IAAI,CAACQ,QAAL,EAAd;;AACA,UAAIF,gBAAgB,IAAI,CAACC,KAAK,CAACE,cAA/B,EAA+C;AAC7C,eAAO,IAAP;AACD;;AAED,UAAQC,CAAR,GAAiBL,SAAjB,CAAQK,CAAR;AAAA,UAAWC,CAAX,GAAiBN,SAAjB,CAAWM,CAAX;AACA,UAAQC,OAAR,GAAoBZ,IAApB,CAAQY,OAAR;AAEA,aAAOtB,SAAS,CAACK,oBAAV,CAA+Be,CAA/B,EAAkCC,CAAlC,EAAqCC,OAArC,EAA8CL,KAA9C,CAAP;AACD;;;;EAXwChB,yB;;AAyD3C,eAAeC,4BAAf","sourcesContent":["/* eslint class-methods-use-this: \"off\" */\nimport GridUtils from '../GridUtils';\nimport GridSeparatorMouseHandler from './GridSeparatorMouseHandler';\n\nclass GridRowSeparatorMouseHandler extends GridSeparatorMouseHandler {\n static getRowSeparatorIndex(gridPoint, grid, checkAllowResize = true) {\n const theme = grid.getTheme();\n if (checkAllowResize && !theme.allowRowResize) {\n return null;\n }\n\n const { x, y } = gridPoint;\n const { metrics } = grid;\n\n return GridUtils.getRowSeparatorIndex(x, y, metrics, theme);\n }\n\n hiddenCursor = 's-resize';\n\n defaultCursor = 'row-resize';\n\n pointProperty = 'y';\n\n userSizesProperty = 'userRowHeights';\n\n visibleOffsetProperty = 'visibleRowYs';\n\n visibleSizesProperty = 'visibleRowHeights';\n\n marginProperty = 'columnHeaderHeight';\n\n calculatedSizesProperty = 'calculatedRowHeights';\n\n modelIndexesProperty = 'modelRows';\n\n firstIndexProperty = 'firstRow';\n\n treePaddingProperty = 'treePaddingX';\n\n getHiddenItems = GridUtils.getHiddenRows;\n\n getNextShownItem = GridUtils.getNextShownRow;\n\n setSize(metricCalculator, modelIndex, size) {\n metricCalculator.setRowHeight(modelIndex, size);\n }\n\n resetSize(metricCalculator, modelIndex) {\n metricCalculator.setRowHeight(modelIndex);\n }\n\n updateSeparator(grid, separatorIndex) {\n grid.setState({\n draggingRowSeparator: separatorIndex,\n isDragging: !!separatorIndex,\n });\n }\n\n getSeparatorIndex = GridRowSeparatorMouseHandler.getRowSeparatorIndex;\n}\n\nexport default GridRowSeparatorMouseHandler;\n"],"file":"GridRowSeparatorMouseHandler.js"}
|