@fileverse-dev/fortune-react 1.2.35 → 1.2.37

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.
@@ -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
- if (isColDoubleClicked(clickedColIndex)) {
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
- } else {
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
- if (isRowDoubleClicked(clickedRowIndex)) {
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
- } else {
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
  };
@@ -1,5 +1,14 @@
1
+ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
2
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
3
+ if (ar || !(i in from)) {
4
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
5
+ ar[i] = from[i];
6
+ }
7
+ }
8
+ return to.concat(ar || Array.prototype.slice.call(from));
9
+ };
1
10
  import { useContext, useRef } from "react";
2
- import { fixPositionOnFrozenCells, getSheetIndex, getFlowdata, colLocation, colLocationByIndex, updateContextWithSheetData } from "@fileverse-dev/fortune-core";
11
+ import { fixPositionOnFrozenCells, getSheetIndex, getFlowdata, colLocation, colLocationByIndex, updateContextWithSheetData, api } from "@fileverse-dev/fortune-core";
3
12
  import WorkbookContext from "../../../context";
4
13
  export function numberToColumnName(num) {
5
14
  var columnName = "";
@@ -302,6 +311,16 @@ export var useColumnDragAndDrop = function useColumnDragAndDrop(containerRef, se
302
311
  }
303
312
  });
304
313
  (_d = window === null || window === void 0 ? void 0 : window.updateDataBlockCalcFunctionAfterRowDrag) === null || _d === void 0 ? void 0 : _d.call(window, sourceIndex_1, targetIndex, "column", context.currentSheetId);
314
+ var selData = api.getSelection(context) || [];
315
+ var sel = __spreadArray([], selData, true);
316
+ if (sel && sel[0]) {
317
+ sel[0].column = [targetIndex, targetIndex];
318
+ }
319
+ setContext(function (draftCtx) {
320
+ api.setSelection(draftCtx, sel, {
321
+ id: context.currentSheetId
322
+ });
323
+ });
305
324
  });
306
325
  }
307
326
  }
@@ -326,6 +345,7 @@ export var useColumnDragAndDrop = function useColumnDragAndDrop(containerRef, se
326
345
  return {
327
346
  initiateDrag: initiateDrag,
328
347
  getColIndexClicked: getColIndexClicked,
329
- isColDoubleClicked: isColDoubleClicked
348
+ isColDoubleClicked: isColDoubleClicked,
349
+ mouseDown: dragRef.current.mouseDown
330
350
  };
331
351
  };
@@ -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
  };
@@ -1,5 +1,14 @@
1
+ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
2
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
3
+ if (ar || !(i in from)) {
4
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
5
+ ar[i] = from[i];
6
+ }
7
+ }
8
+ return to.concat(ar || Array.prototype.slice.call(from));
9
+ };
1
10
  import { useContext, useRef } from "react";
2
- import { fixPositionOnFrozenCells, getSheetIndex, rowLocation, getFlowdata, rowLocationByIndex, updateContextWithSheetData } from "@fileverse-dev/fortune-core";
11
+ import { fixPositionOnFrozenCells, getSheetIndex, rowLocation, getFlowdata, rowLocationByIndex, updateContextWithSheetData, api } from "@fileverse-dev/fortune-core";
3
12
  import WorkbookContext from "../../../context";
4
13
  export var useRowDragAndDrop = function useRowDragAndDrop(containerRef, selectedLocationRef) {
5
14
  var DOUBLE_MS = 300;
@@ -283,6 +292,16 @@ export var useRowDragAndDrop = function useRowDragAndDrop(containerRef, selected
283
292
  }
284
293
  });
285
294
  (_b = window === null || window === void 0 ? void 0 : window.updateDataBlockCalcFunctionAfterRowDrag) === null || _b === void 0 ? void 0 : _b.call(window, sourceIndex_1, targetIndex, "row", context.currentSheetId);
295
+ var selData = api.getSelection(context) || [];
296
+ var sel = __spreadArray([], selData, true);
297
+ if (sel && sel[0]) {
298
+ sel[0].row = [targetIndex, targetIndex];
299
+ }
300
+ setContext(function (draftCtx) {
301
+ api.setSelection(draftCtx, sel, {
302
+ id: context.currentSheetId
303
+ });
304
+ });
286
305
  });
287
306
  }
288
307
  }
@@ -307,6 +326,7 @@ export var useRowDragAndDrop = function useRowDragAndDrop(containerRef, selected
307
326
  return {
308
327
  initiateDrag: initiateDrag,
309
328
  getRowIndexClicked: getRowIndexClicked,
310
- isRowDoubleClicked: isRowDoubleClicked
329
+ isRowDoubleClicked: isRowDoubleClicked,
330
+ mouseDown: dragRef.current.mouseDown
311
331
  };
312
332
  };
@@ -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
- if (isColDoubleClicked(clickedColIndex)) {
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
- } else {
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
- if (isRowDoubleClicked(clickedRowIndex)) {
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
- } else {
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
  };
@@ -9,6 +9,15 @@ var _react = require("react");
9
9
  var _fortuneCore = require("@fileverse-dev/fortune-core");
10
10
  var _context = _interopRequireDefault(require("../../../context"));
11
11
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
+ var __spreadArray = void 0 && (void 0).__spreadArray || function (to, from, pack) {
13
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
14
+ if (ar || !(i in from)) {
15
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
16
+ ar[i] = from[i];
17
+ }
18
+ }
19
+ return to.concat(ar || Array.prototype.slice.call(from));
20
+ };
12
21
  function numberToColumnName(num) {
13
22
  var columnName = "";
14
23
  while (num >= 0) {
@@ -310,6 +319,16 @@ var useColumnDragAndDrop = exports.useColumnDragAndDrop = function useColumnDrag
310
319
  }
311
320
  });
312
321
  (_d = window === null || window === void 0 ? void 0 : window.updateDataBlockCalcFunctionAfterRowDrag) === null || _d === void 0 ? void 0 : _d.call(window, sourceIndex_1, targetIndex, "column", context.currentSheetId);
322
+ var selData = _fortuneCore.api.getSelection(context) || [];
323
+ var sel = __spreadArray([], selData, true);
324
+ if (sel && sel[0]) {
325
+ sel[0].column = [targetIndex, targetIndex];
326
+ }
327
+ setContext(function (draftCtx) {
328
+ _fortuneCore.api.setSelection(draftCtx, sel, {
329
+ id: context.currentSheetId
330
+ });
331
+ });
313
332
  });
314
333
  }
315
334
  }
@@ -334,6 +353,7 @@ var useColumnDragAndDrop = exports.useColumnDragAndDrop = function useColumnDrag
334
353
  return {
335
354
  initiateDrag: initiateDrag,
336
355
  getColIndexClicked: getColIndexClicked,
337
- isColDoubleClicked: isColDoubleClicked
356
+ isColDoubleClicked: isColDoubleClicked,
357
+ mouseDown: dragRef.current.mouseDown
338
358
  };
339
359
  };
@@ -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
  };
@@ -8,6 +8,15 @@ var _react = require("react");
8
8
  var _fortuneCore = require("@fileverse-dev/fortune-core");
9
9
  var _context = _interopRequireDefault(require("../../../context"));
10
10
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
+ var __spreadArray = void 0 && (void 0).__spreadArray || function (to, from, pack) {
12
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
13
+ if (ar || !(i in from)) {
14
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
15
+ ar[i] = from[i];
16
+ }
17
+ }
18
+ return to.concat(ar || Array.prototype.slice.call(from));
19
+ };
11
20
  var useRowDragAndDrop = exports.useRowDragAndDrop = function useRowDragAndDrop(containerRef, selectedLocationRef) {
12
21
  var DOUBLE_MS = 300;
13
22
  var START_DRAG_THRESHOLD_PX = 6;
@@ -290,6 +299,16 @@ var useRowDragAndDrop = exports.useRowDragAndDrop = function useRowDragAndDrop(c
290
299
  }
291
300
  });
292
301
  (_b = window === null || window === void 0 ? void 0 : window.updateDataBlockCalcFunctionAfterRowDrag) === null || _b === void 0 ? void 0 : _b.call(window, sourceIndex_1, targetIndex, "row", context.currentSheetId);
302
+ var selData = _fortuneCore.api.getSelection(context) || [];
303
+ var sel = __spreadArray([], selData, true);
304
+ if (sel && sel[0]) {
305
+ sel[0].row = [targetIndex, targetIndex];
306
+ }
307
+ setContext(function (draftCtx) {
308
+ _fortuneCore.api.setSelection(draftCtx, sel, {
309
+ id: context.currentSheetId
310
+ });
311
+ });
293
312
  });
294
313
  }
295
314
  }
@@ -314,6 +333,7 @@ var useRowDragAndDrop = exports.useRowDragAndDrop = function useRowDragAndDrop(c
314
333
  return {
315
334
  initiateDrag: initiateDrag,
316
335
  getRowIndexClicked: getRowIndexClicked,
317
- isRowDoubleClicked: isRowDoubleClicked
336
+ isRowDoubleClicked: isRowDoubleClicked,
337
+ mouseDown: dragRef.current.mouseDown
318
338
  };
319
339
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fileverse-dev/fortune-react",
3
- "version": "1.2.35",
3
+ "version": "1.2.37",
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.35",
19
+ "@fileverse-dev/fortune-core": "1.2.37",
20
20
  "@fileverse/ui": "^4.1.7-patch-40",
21
21
  "@tippyjs/react": "^4.2.6",
22
22
  "@types/regenerator-runtime": "^0.13.6",