@fileverse-dev/fortune-react 1.2.35 → 1.2.36
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/es/components/SheetOverlay/ColumnHeader.js +26 -4
- package/es/components/SheetOverlay/RowHeader.js +28 -6
- package/es/components/SheetOverlay/drag_and_drop/column-helpers.d.ts +1 -0
- package/es/components/SheetOverlay/drag_and_drop/column-helpers.js +2 -1
- package/es/components/SheetOverlay/drag_and_drop/row-helpers.d.ts +1 -0
- package/es/components/SheetOverlay/drag_and_drop/row-helpers.js +2 -1
- package/lib/components/SheetOverlay/ColumnHeader.js +26 -4
- package/lib/components/SheetOverlay/RowHeader.js +27 -5
- package/lib/components/SheetOverlay/drag_and_drop/column-helpers.d.ts +1 -0
- package/lib/components/SheetOverlay/drag_and_drop/column-helpers.js +2 -1
- package/lib/components/SheetOverlay/drag_and_drop/row-helpers.d.ts +1 -0
- package/lib/components/SheetOverlay/drag_and_drop/row-helpers.js +2 -1
- package/package.json +2 -2
|
@@ -42,7 +42,8 @@ var ColumnHeader = function ColumnHeader() {
|
|
|
42
42
|
var _f = useColumnDragAndDrop(containerRef, selectedLocationRef),
|
|
43
43
|
initiateDrag = _f.initiateDrag,
|
|
44
44
|
getColIndexClicked = _f.getColIndexClicked,
|
|
45
|
-
isColDoubleClicked = _f.isColDoubleClicked
|
|
45
|
+
isColDoubleClicked = _f.isColDoubleClicked,
|
|
46
|
+
mouseDown = _f.mouseDown;
|
|
46
47
|
var onMouseMove = useCallback(function (e) {
|
|
47
48
|
var _a;
|
|
48
49
|
if (context.luckysheet_cols_change_size) {
|
|
@@ -73,6 +74,7 @@ var ColumnHeader = function ColumnHeader() {
|
|
|
73
74
|
}]);
|
|
74
75
|
}, [context, hoverLocation.col_index, refs.globalCache.freezen]);
|
|
75
76
|
var onMouseDown = useCallback(function (e) {
|
|
77
|
+
var _a, _b, _c, _d;
|
|
76
78
|
if (e.button === 0 && e.target.tagName === "use" || e.button === 2) {
|
|
77
79
|
var nativeEvent_1 = e.nativeEvent;
|
|
78
80
|
setContext(function (draft) {
|
|
@@ -86,11 +88,17 @@ var ColumnHeader = function ColumnHeader() {
|
|
|
86
88
|
if (!headerEl) return;
|
|
87
89
|
var clickedColIndex = getColIndexClicked(e.pageX, headerEl);
|
|
88
90
|
if (clickedColIndex < 0) return;
|
|
89
|
-
|
|
91
|
+
var sel = api.getSelection(context);
|
|
92
|
+
var lastSelectedRow = (_a = sel === null || sel === void 0 ? void 0 : sel[0].row) === null || _a === void 0 ? void 0 : _a[1];
|
|
93
|
+
var data = getFlowdata(context);
|
|
94
|
+
if (!data) data = [];
|
|
95
|
+
var allColSel = lastSelectedRow === (data === null || data === void 0 ? void 0 : data.length) - 1;
|
|
96
|
+
if (allColSel) {
|
|
90
97
|
setContext(function (draft) {
|
|
91
98
|
draft.luckysheet_scroll_status = true;
|
|
92
99
|
});
|
|
93
|
-
}
|
|
100
|
+
}
|
|
101
|
+
if (!allColSel || allColSel && sel && clickedColIndex < ((_b = sel === null || sel === void 0 ? void 0 : sel[0].column) === null || _b === void 0 ? void 0 : _b[0]) || clickedColIndex > ((_d = (_c = sel === null || sel === void 0 ? void 0 : sel[0]) === null || _c === void 0 ? void 0 : _c.column) === null || _d === void 0 ? void 0 : _d[1])) {
|
|
94
102
|
var nativeEvent_2 = e.nativeEvent;
|
|
95
103
|
setContext(function (draft) {
|
|
96
104
|
handleColumnHeaderMouseDown(draft, refs.globalCache, nativeEvent_2, containerRef.current, refs.cellInput.current, refs.fxInput.current);
|
|
@@ -229,6 +237,19 @@ var ColumnHeader = function ColumnHeader() {
|
|
|
229
237
|
useEffect(function () {
|
|
230
238
|
containerRef.current.scrollLeft = context.scrollLeft;
|
|
231
239
|
}, [context.scrollLeft]);
|
|
240
|
+
var getCursor = function getCursor(colIndex) {
|
|
241
|
+
var _a;
|
|
242
|
+
if (mouseDown) return "grabbing";
|
|
243
|
+
var sel = api.getSelection(context);
|
|
244
|
+
var lastSelectedRow = (_a = sel === null || sel === void 0 ? void 0 : sel[0].row) === null || _a === void 0 ? void 0 : _a[1];
|
|
245
|
+
var data = getFlowdata(context);
|
|
246
|
+
if (!data) data = [];
|
|
247
|
+
var allColSel = lastSelectedRow === (data === null || data === void 0 ? void 0 : data.length) - 1;
|
|
248
|
+
if (allColSel && sel && colIndex >= (sel === null || sel === void 0 ? void 0 : sel[0].column[0]) && colIndex <= (sel === null || sel === void 0 ? void 0 : sel[0].column[1])) {
|
|
249
|
+
return "grab";
|
|
250
|
+
}
|
|
251
|
+
return "default";
|
|
252
|
+
};
|
|
232
253
|
return /*#__PURE__*/React.createElement("div", {
|
|
233
254
|
ref: containerRef,
|
|
234
255
|
className: "fortune-col-header",
|
|
@@ -301,7 +322,8 @@ var ColumnHeader = function ColumnHeader() {
|
|
|
301
322
|
style: _.assign({
|
|
302
323
|
left: hoverLocation.col_pre,
|
|
303
324
|
width: hoverLocation.col - hoverLocation.col_pre - 1,
|
|
304
|
-
display: "block"
|
|
325
|
+
display: "block",
|
|
326
|
+
cursor: getCursor(hoverLocation.col_index)
|
|
305
327
|
}, fixColumnStyleOverflowInFreeze(context, hoverLocation.col_index, hoverLocation.col_index, (_a = refs.globalCache.freezen) === null || _a === void 0 ? void 0 : _a[context.currentSheetId]))
|
|
306
328
|
}, allowEditRef.current && (/*#__PURE__*/React.createElement("span", {
|
|
307
329
|
className: "header-arrow mr-2",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { rowLocation, rowLocationByIndex, selectTitlesMap, selectTitlesRange, handleContextMenu, handleRowHeaderMouseDown, handleRowSizeHandleMouseDown, fixRowStyleOverflowInFreeze, handleRowFreezeHandleMouseDown, getSheetIndex, showSelected, fixPositionOnFrozenCells, api } from "@fileverse-dev/fortune-core";
|
|
1
|
+
import { rowLocation, rowLocationByIndex, selectTitlesMap, selectTitlesRange, handleContextMenu, handleRowHeaderMouseDown, handleRowSizeHandleMouseDown, fixRowStyleOverflowInFreeze, handleRowFreezeHandleMouseDown, getSheetIndex, showSelected, fixPositionOnFrozenCells, getFlowdata, api } from "@fileverse-dev/fortune-core";
|
|
2
2
|
import _ from "lodash";
|
|
3
3
|
import React, { useContext, useState, useRef, useCallback, useEffect, useMemo } from "react";
|
|
4
4
|
import WorkbookContext from "../../context";
|
|
@@ -65,8 +65,10 @@ var RowHeader = function RowHeader() {
|
|
|
65
65
|
var _f = useRowDragAndDrop(containerRef, selectedLocationRef),
|
|
66
66
|
initiateDrag = _f.initiateDrag,
|
|
67
67
|
getRowIndexClicked = _f.getRowIndexClicked,
|
|
68
|
-
isRowDoubleClicked = _f.isRowDoubleClicked
|
|
68
|
+
isRowDoubleClicked = _f.isRowDoubleClicked,
|
|
69
|
+
mouseDown = _f.mouseDown;
|
|
69
70
|
var onMouseDown = useCallback(function (e) {
|
|
71
|
+
var _a, _b;
|
|
70
72
|
if (e.button === 0 && e.target.tagName === "use" || e.button === 2) {
|
|
71
73
|
var nativeEvent_1 = e.nativeEvent;
|
|
72
74
|
setContext(function (draft) {
|
|
@@ -80,11 +82,17 @@ var RowHeader = function RowHeader() {
|
|
|
80
82
|
if (!headerEl) return;
|
|
81
83
|
var clickedRowIndex = getRowIndexClicked(e.pageY, headerEl);
|
|
82
84
|
if (clickedRowIndex < 0) return;
|
|
83
|
-
|
|
85
|
+
var sel = api.getSelection(context);
|
|
86
|
+
var lastSelectedCol = (_a = sel === null || sel === void 0 ? void 0 : sel[0].column) === null || _a === void 0 ? void 0 : _a[1];
|
|
87
|
+
var data = getFlowdata(context);
|
|
88
|
+
if (!data) data = [];
|
|
89
|
+
var allRowSel = lastSelectedCol === ((_b = data === null || data === void 0 ? void 0 : data[0]) === null || _b === void 0 ? void 0 : _b.length) - 1;
|
|
90
|
+
if (allRowSel) {
|
|
84
91
|
setContext(function (draft) {
|
|
85
92
|
draft.luckysheet_scroll_status = true;
|
|
86
93
|
});
|
|
87
|
-
}
|
|
94
|
+
}
|
|
95
|
+
if (!allRowSel || allRowSel && sel && clickedRowIndex < (sel === null || sel === void 0 ? void 0 : sel[0].row[0]) || clickedRowIndex > (sel === null || sel === void 0 ? void 0 : sel[0].row[1])) {
|
|
88
96
|
var nativeEvent_2 = e.nativeEvent;
|
|
89
97
|
setContext(function (draft) {
|
|
90
98
|
handleRowHeaderMouseDown(draft, refs.globalCache, nativeEvent_2, containerRef.current, refs.cellInput.current, refs.fxInput.current);
|
|
@@ -94,7 +102,7 @@ var RowHeader = function RowHeader() {
|
|
|
94
102
|
e.preventDefault();
|
|
95
103
|
e.stopPropagation();
|
|
96
104
|
initiateDrag(clickedRowIndex, e.pageY);
|
|
97
|
-
}, [refs.globalCache, context.visibledatarow, context.currentSheetId, setContext]);
|
|
105
|
+
}, [refs.globalCache, context.visibledatarow, context.currentSheetId, setContext, getRowIndexClicked, isRowDoubleClicked, initiateDrag]);
|
|
98
106
|
var onMouseLeave = useCallback(function () {
|
|
99
107
|
if (context.luckysheet_rows_change_size) return;
|
|
100
108
|
setHoverLocation({
|
|
@@ -228,6 +236,19 @@ var RowHeader = function RowHeader() {
|
|
|
228
236
|
useEffect(function () {
|
|
229
237
|
containerRef.current.scrollTop = context.scrollTop;
|
|
230
238
|
}, [context.scrollTop]);
|
|
239
|
+
var getCursor = function getCursor(rowIndex) {
|
|
240
|
+
var _a, _b, _c, _d;
|
|
241
|
+
if (mouseDown) return "grabbing";
|
|
242
|
+
var sel = api.getSelection(context);
|
|
243
|
+
var lastSelectedCol = (_a = sel === null || sel === void 0 ? void 0 : sel[0].column) === null || _a === void 0 ? void 0 : _a[1];
|
|
244
|
+
var data = getFlowdata(context);
|
|
245
|
+
if (!data) data = [];
|
|
246
|
+
var allColSel = lastSelectedCol === ((_b = data === null || data === void 0 ? void 0 : data[0]) === null || _b === void 0 ? void 0 : _b.length) - 1;
|
|
247
|
+
if (allColSel && sel && rowIndex >= ((_c = sel === null || sel === void 0 ? void 0 : sel[0].row) === null || _c === void 0 ? void 0 : _c[0]) && rowIndex <= ((_d = sel === null || sel === void 0 ? void 0 : sel[0].row) === null || _d === void 0 ? void 0 : _d[1])) {
|
|
248
|
+
return "grab";
|
|
249
|
+
}
|
|
250
|
+
return "default";
|
|
251
|
+
};
|
|
231
252
|
return /*#__PURE__*/React.createElement("div", {
|
|
232
253
|
ref: containerRef,
|
|
233
254
|
className: "fortune-row-header",
|
|
@@ -291,7 +312,8 @@ var RowHeader = function RowHeader() {
|
|
|
291
312
|
style: _.assign({
|
|
292
313
|
top: hoverLocation.row_pre,
|
|
293
314
|
height: hoverLocation.row - hoverLocation.row_pre - 1,
|
|
294
|
-
display: "block"
|
|
315
|
+
display: "block",
|
|
316
|
+
cursor: getCursor(hoverLocation.row_index)
|
|
295
317
|
}, fixRowStyleOverflowInFreeze(context, hoverLocation.row_index, hoverLocation.row_index, (_a = refs.globalCache.freezen) === null || _a === void 0 ? void 0 : _a[context.currentSheetId]))
|
|
296
318
|
})) : null, selectedLocation.map(function (_a, i) {
|
|
297
319
|
var _b;
|
|
@@ -4,4 +4,5 @@ export declare const useColumnDragAndDrop: (containerRef: RefObject<HTMLDivEleme
|
|
|
4
4
|
initiateDrag: (clickedColIndex: number, startX: number) => void;
|
|
5
5
|
getColIndexClicked: (pageX: number, headerEl: HTMLDivElement) => number;
|
|
6
6
|
isColDoubleClicked: (clickedColIndex: number) => boolean;
|
|
7
|
+
mouseDown: boolean;
|
|
7
8
|
};
|
|
@@ -326,6 +326,7 @@ export var useColumnDragAndDrop = function useColumnDragAndDrop(containerRef, se
|
|
|
326
326
|
return {
|
|
327
327
|
initiateDrag: initiateDrag,
|
|
328
328
|
getColIndexClicked: getColIndexClicked,
|
|
329
|
-
isColDoubleClicked: isColDoubleClicked
|
|
329
|
+
isColDoubleClicked: isColDoubleClicked,
|
|
330
|
+
mouseDown: dragRef.current.mouseDown
|
|
330
331
|
};
|
|
331
332
|
};
|
|
@@ -3,4 +3,5 @@ export declare const useRowDragAndDrop: (containerRef: RefObject<HTMLDivElement
|
|
|
3
3
|
initiateDrag: (clickedRowIndex: number, startY: number) => void;
|
|
4
4
|
getRowIndexClicked: (pageY: number, headerEl: HTMLDivElement) => number;
|
|
5
5
|
isRowDoubleClicked: (clickedRowIndex: number) => boolean;
|
|
6
|
+
mouseDown: boolean;
|
|
6
7
|
};
|
|
@@ -307,6 +307,7 @@ export var useRowDragAndDrop = function useRowDragAndDrop(containerRef, selected
|
|
|
307
307
|
return {
|
|
308
308
|
initiateDrag: initiateDrag,
|
|
309
309
|
getRowIndexClicked: getRowIndexClicked,
|
|
310
|
-
isRowDoubleClicked: isRowDoubleClicked
|
|
310
|
+
isRowDoubleClicked: isRowDoubleClicked,
|
|
311
|
+
mouseDown: dragRef.current.mouseDown
|
|
311
312
|
};
|
|
312
313
|
};
|
|
@@ -51,7 +51,8 @@ var ColumnHeader = function ColumnHeader() {
|
|
|
51
51
|
var _f = (0, _columnHelpers.useColumnDragAndDrop)(containerRef, selectedLocationRef),
|
|
52
52
|
initiateDrag = _f.initiateDrag,
|
|
53
53
|
getColIndexClicked = _f.getColIndexClicked,
|
|
54
|
-
isColDoubleClicked = _f.isColDoubleClicked
|
|
54
|
+
isColDoubleClicked = _f.isColDoubleClicked,
|
|
55
|
+
mouseDown = _f.mouseDown;
|
|
55
56
|
var onMouseMove = (0, _react.useCallback)(function (e) {
|
|
56
57
|
var _a;
|
|
57
58
|
if (context.luckysheet_cols_change_size) {
|
|
@@ -82,6 +83,7 @@ var ColumnHeader = function ColumnHeader() {
|
|
|
82
83
|
}]);
|
|
83
84
|
}, [context, hoverLocation.col_index, refs.globalCache.freezen]);
|
|
84
85
|
var onMouseDown = (0, _react.useCallback)(function (e) {
|
|
86
|
+
var _a, _b, _c, _d;
|
|
85
87
|
if (e.button === 0 && e.target.tagName === "use" || e.button === 2) {
|
|
86
88
|
var nativeEvent_1 = e.nativeEvent;
|
|
87
89
|
setContext(function (draft) {
|
|
@@ -95,11 +97,17 @@ var ColumnHeader = function ColumnHeader() {
|
|
|
95
97
|
if (!headerEl) return;
|
|
96
98
|
var clickedColIndex = getColIndexClicked(e.pageX, headerEl);
|
|
97
99
|
if (clickedColIndex < 0) return;
|
|
98
|
-
|
|
100
|
+
var sel = _fortuneCore.api.getSelection(context);
|
|
101
|
+
var lastSelectedRow = (_a = sel === null || sel === void 0 ? void 0 : sel[0].row) === null || _a === void 0 ? void 0 : _a[1];
|
|
102
|
+
var data = (0, _fortuneCore.getFlowdata)(context);
|
|
103
|
+
if (!data) data = [];
|
|
104
|
+
var allColSel = lastSelectedRow === (data === null || data === void 0 ? void 0 : data.length) - 1;
|
|
105
|
+
if (allColSel) {
|
|
99
106
|
setContext(function (draft) {
|
|
100
107
|
draft.luckysheet_scroll_status = true;
|
|
101
108
|
});
|
|
102
|
-
}
|
|
109
|
+
}
|
|
110
|
+
if (!allColSel || allColSel && sel && clickedColIndex < ((_b = sel === null || sel === void 0 ? void 0 : sel[0].column) === null || _b === void 0 ? void 0 : _b[0]) || clickedColIndex > ((_d = (_c = sel === null || sel === void 0 ? void 0 : sel[0]) === null || _c === void 0 ? void 0 : _c.column) === null || _d === void 0 ? void 0 : _d[1])) {
|
|
103
111
|
var nativeEvent_2 = e.nativeEvent;
|
|
104
112
|
setContext(function (draft) {
|
|
105
113
|
(0, _fortuneCore.handleColumnHeaderMouseDown)(draft, refs.globalCache, nativeEvent_2, containerRef.current, refs.cellInput.current, refs.fxInput.current);
|
|
@@ -238,6 +246,19 @@ var ColumnHeader = function ColumnHeader() {
|
|
|
238
246
|
(0, _react.useEffect)(function () {
|
|
239
247
|
containerRef.current.scrollLeft = context.scrollLeft;
|
|
240
248
|
}, [context.scrollLeft]);
|
|
249
|
+
var getCursor = function getCursor(colIndex) {
|
|
250
|
+
var _a;
|
|
251
|
+
if (mouseDown) return "grabbing";
|
|
252
|
+
var sel = _fortuneCore.api.getSelection(context);
|
|
253
|
+
var lastSelectedRow = (_a = sel === null || sel === void 0 ? void 0 : sel[0].row) === null || _a === void 0 ? void 0 : _a[1];
|
|
254
|
+
var data = (0, _fortuneCore.getFlowdata)(context);
|
|
255
|
+
if (!data) data = [];
|
|
256
|
+
var allColSel = lastSelectedRow === (data === null || data === void 0 ? void 0 : data.length) - 1;
|
|
257
|
+
if (allColSel && sel && colIndex >= (sel === null || sel === void 0 ? void 0 : sel[0].column[0]) && colIndex <= (sel === null || sel === void 0 ? void 0 : sel[0].column[1])) {
|
|
258
|
+
return "grab";
|
|
259
|
+
}
|
|
260
|
+
return "default";
|
|
261
|
+
};
|
|
241
262
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
242
263
|
ref: containerRef,
|
|
243
264
|
className: "fortune-col-header",
|
|
@@ -310,7 +331,8 @@ var ColumnHeader = function ColumnHeader() {
|
|
|
310
331
|
style: _lodash.default.assign({
|
|
311
332
|
left: hoverLocation.col_pre,
|
|
312
333
|
width: hoverLocation.col - hoverLocation.col_pre - 1,
|
|
313
|
-
display: "block"
|
|
334
|
+
display: "block",
|
|
335
|
+
cursor: getCursor(hoverLocation.col_index)
|
|
314
336
|
}, (0, _fortuneCore.fixColumnStyleOverflowInFreeze)(context, hoverLocation.col_index, hoverLocation.col_index, (_a = refs.globalCache.freezen) === null || _a === void 0 ? void 0 : _a[context.currentSheetId]))
|
|
315
337
|
}, allowEditRef.current && (/*#__PURE__*/_react.default.createElement("span", {
|
|
316
338
|
className: "header-arrow mr-2",
|
|
@@ -74,8 +74,10 @@ var RowHeader = function RowHeader() {
|
|
|
74
74
|
var _f = (0, _rowHelpers.useRowDragAndDrop)(containerRef, selectedLocationRef),
|
|
75
75
|
initiateDrag = _f.initiateDrag,
|
|
76
76
|
getRowIndexClicked = _f.getRowIndexClicked,
|
|
77
|
-
isRowDoubleClicked = _f.isRowDoubleClicked
|
|
77
|
+
isRowDoubleClicked = _f.isRowDoubleClicked,
|
|
78
|
+
mouseDown = _f.mouseDown;
|
|
78
79
|
var onMouseDown = (0, _react.useCallback)(function (e) {
|
|
80
|
+
var _a, _b;
|
|
79
81
|
if (e.button === 0 && e.target.tagName === "use" || e.button === 2) {
|
|
80
82
|
var nativeEvent_1 = e.nativeEvent;
|
|
81
83
|
setContext(function (draft) {
|
|
@@ -89,11 +91,17 @@ var RowHeader = function RowHeader() {
|
|
|
89
91
|
if (!headerEl) return;
|
|
90
92
|
var clickedRowIndex = getRowIndexClicked(e.pageY, headerEl);
|
|
91
93
|
if (clickedRowIndex < 0) return;
|
|
92
|
-
|
|
94
|
+
var sel = _fortuneCore.api.getSelection(context);
|
|
95
|
+
var lastSelectedCol = (_a = sel === null || sel === void 0 ? void 0 : sel[0].column) === null || _a === void 0 ? void 0 : _a[1];
|
|
96
|
+
var data = (0, _fortuneCore.getFlowdata)(context);
|
|
97
|
+
if (!data) data = [];
|
|
98
|
+
var allRowSel = lastSelectedCol === ((_b = data === null || data === void 0 ? void 0 : data[0]) === null || _b === void 0 ? void 0 : _b.length) - 1;
|
|
99
|
+
if (allRowSel) {
|
|
93
100
|
setContext(function (draft) {
|
|
94
101
|
draft.luckysheet_scroll_status = true;
|
|
95
102
|
});
|
|
96
|
-
}
|
|
103
|
+
}
|
|
104
|
+
if (!allRowSel || allRowSel && sel && clickedRowIndex < (sel === null || sel === void 0 ? void 0 : sel[0].row[0]) || clickedRowIndex > (sel === null || sel === void 0 ? void 0 : sel[0].row[1])) {
|
|
97
105
|
var nativeEvent_2 = e.nativeEvent;
|
|
98
106
|
setContext(function (draft) {
|
|
99
107
|
(0, _fortuneCore.handleRowHeaderMouseDown)(draft, refs.globalCache, nativeEvent_2, containerRef.current, refs.cellInput.current, refs.fxInput.current);
|
|
@@ -103,7 +111,7 @@ var RowHeader = function RowHeader() {
|
|
|
103
111
|
e.preventDefault();
|
|
104
112
|
e.stopPropagation();
|
|
105
113
|
initiateDrag(clickedRowIndex, e.pageY);
|
|
106
|
-
}, [refs.globalCache, context.visibledatarow, context.currentSheetId, setContext]);
|
|
114
|
+
}, [refs.globalCache, context.visibledatarow, context.currentSheetId, setContext, getRowIndexClicked, isRowDoubleClicked, initiateDrag]);
|
|
107
115
|
var onMouseLeave = (0, _react.useCallback)(function () {
|
|
108
116
|
if (context.luckysheet_rows_change_size) return;
|
|
109
117
|
setHoverLocation({
|
|
@@ -237,6 +245,19 @@ var RowHeader = function RowHeader() {
|
|
|
237
245
|
(0, _react.useEffect)(function () {
|
|
238
246
|
containerRef.current.scrollTop = context.scrollTop;
|
|
239
247
|
}, [context.scrollTop]);
|
|
248
|
+
var getCursor = function getCursor(rowIndex) {
|
|
249
|
+
var _a, _b, _c, _d;
|
|
250
|
+
if (mouseDown) return "grabbing";
|
|
251
|
+
var sel = _fortuneCore.api.getSelection(context);
|
|
252
|
+
var lastSelectedCol = (_a = sel === null || sel === void 0 ? void 0 : sel[0].column) === null || _a === void 0 ? void 0 : _a[1];
|
|
253
|
+
var data = (0, _fortuneCore.getFlowdata)(context);
|
|
254
|
+
if (!data) data = [];
|
|
255
|
+
var allColSel = lastSelectedCol === ((_b = data === null || data === void 0 ? void 0 : data[0]) === null || _b === void 0 ? void 0 : _b.length) - 1;
|
|
256
|
+
if (allColSel && sel && rowIndex >= ((_c = sel === null || sel === void 0 ? void 0 : sel[0].row) === null || _c === void 0 ? void 0 : _c[0]) && rowIndex <= ((_d = sel === null || sel === void 0 ? void 0 : sel[0].row) === null || _d === void 0 ? void 0 : _d[1])) {
|
|
257
|
+
return "grab";
|
|
258
|
+
}
|
|
259
|
+
return "default";
|
|
260
|
+
};
|
|
240
261
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
241
262
|
ref: containerRef,
|
|
242
263
|
className: "fortune-row-header",
|
|
@@ -300,7 +321,8 @@ var RowHeader = function RowHeader() {
|
|
|
300
321
|
style: _lodash.default.assign({
|
|
301
322
|
top: hoverLocation.row_pre,
|
|
302
323
|
height: hoverLocation.row - hoverLocation.row_pre - 1,
|
|
303
|
-
display: "block"
|
|
324
|
+
display: "block",
|
|
325
|
+
cursor: getCursor(hoverLocation.row_index)
|
|
304
326
|
}, (0, _fortuneCore.fixRowStyleOverflowInFreeze)(context, hoverLocation.row_index, hoverLocation.row_index, (_a = refs.globalCache.freezen) === null || _a === void 0 ? void 0 : _a[context.currentSheetId]))
|
|
305
327
|
})) : null, selectedLocation.map(function (_a, i) {
|
|
306
328
|
var _b;
|
|
@@ -4,4 +4,5 @@ export declare const useColumnDragAndDrop: (containerRef: RefObject<HTMLDivEleme
|
|
|
4
4
|
initiateDrag: (clickedColIndex: number, startX: number) => void;
|
|
5
5
|
getColIndexClicked: (pageX: number, headerEl: HTMLDivElement) => number;
|
|
6
6
|
isColDoubleClicked: (clickedColIndex: number) => boolean;
|
|
7
|
+
mouseDown: boolean;
|
|
7
8
|
};
|
|
@@ -334,6 +334,7 @@ var useColumnDragAndDrop = exports.useColumnDragAndDrop = function useColumnDrag
|
|
|
334
334
|
return {
|
|
335
335
|
initiateDrag: initiateDrag,
|
|
336
336
|
getColIndexClicked: getColIndexClicked,
|
|
337
|
-
isColDoubleClicked: isColDoubleClicked
|
|
337
|
+
isColDoubleClicked: isColDoubleClicked,
|
|
338
|
+
mouseDown: dragRef.current.mouseDown
|
|
338
339
|
};
|
|
339
340
|
};
|
|
@@ -3,4 +3,5 @@ export declare const useRowDragAndDrop: (containerRef: RefObject<HTMLDivElement
|
|
|
3
3
|
initiateDrag: (clickedRowIndex: number, startY: number) => void;
|
|
4
4
|
getRowIndexClicked: (pageY: number, headerEl: HTMLDivElement) => number;
|
|
5
5
|
isRowDoubleClicked: (clickedRowIndex: number) => boolean;
|
|
6
|
+
mouseDown: boolean;
|
|
6
7
|
};
|
|
@@ -314,6 +314,7 @@ var useRowDragAndDrop = exports.useRowDragAndDrop = function useRowDragAndDrop(c
|
|
|
314
314
|
return {
|
|
315
315
|
initiateDrag: initiateDrag,
|
|
316
316
|
getRowIndexClicked: getRowIndexClicked,
|
|
317
|
-
isRowDoubleClicked: isRowDoubleClicked
|
|
317
|
+
isRowDoubleClicked: isRowDoubleClicked,
|
|
318
|
+
mouseDown: dragRef.current.mouseDown
|
|
318
319
|
};
|
|
319
320
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fileverse-dev/fortune-react",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.36",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"types": "lib/index.d.ts",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"tsc": "tsc"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@fileverse-dev/fortune-core": "1.2.
|
|
19
|
+
"@fileverse-dev/fortune-core": "1.2.36",
|
|
20
20
|
"@fileverse/ui": "^4.1.7-patch-40",
|
|
21
21
|
"@tippyjs/react": "^4.2.6",
|
|
22
22
|
"@types/regenerator-runtime": "^0.13.6",
|