@fileverse-dev/fortune-react 1.2.39 → 1.2.40

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.
@@ -182,12 +182,13 @@ export var useRowDragAndDrop = function useRowDragAndDrop(containerRef, selected
182
182
  }
183
183
  };
184
184
  var handleRowDragEnd = function handleRowDragEnd(ev) {
185
+ var _a;
185
186
  if (!dragRef.current.mouseDown) return;
186
187
  dragRef.current.mouseDown = false;
187
188
  try {
188
189
  document.body.style.userSelect = dragRef.current.prevUserSelect || "";
189
190
  document.body.style.webkitUserSelect = dragRef.current.prevWebkitUserSelect || "";
190
- } catch (_a) {}
191
+ } catch (_b) {}
191
192
  if (dragRef.current.active) {
192
193
  var finalInsertionIndex_1 = computeInsertionFromPageY(ev.pageY).insertionIndex;
193
194
  var sourceIndex_1 = dragRef.current.source;
@@ -292,15 +293,22 @@ export var useRowDragAndDrop = function useRowDragAndDrop(containerRef, selected
292
293
  }
293
294
  });
294
295
  (_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
- });
296
+ });
297
+ var d = getFlowdata(context);
298
+ var colLen_1 = ((_a = d === null || d === void 0 ? void 0 : d[0]) === null || _a === void 0 ? void 0 : _a.length) || 0;
299
+ var targetIndex_1 = finalInsertionIndex_1;
300
+ if (targetIndex_1 > sourceIndex_1) targetIndex_1 -= 1;
301
+ var selData = api.getSelection(context) || [];
302
+ var sel = __spreadArray([], selData, true);
303
+ if (sel && sel[0]) {
304
+ sel[0].column = [targetIndex_1, targetIndex_1];
305
+ }
306
+ setContext(function (draftCtx) {
307
+ api.setSelection(draftCtx, [{
308
+ row: [targetIndex_1, targetIndex_1],
309
+ column: [0, colLen_1]
310
+ }], {
311
+ id: context.currentSheetId
304
312
  });
305
313
  });
306
314
  }
@@ -189,12 +189,13 @@ var useRowDragAndDrop = exports.useRowDragAndDrop = function useRowDragAndDrop(c
189
189
  }
190
190
  };
191
191
  var handleRowDragEnd = function handleRowDragEnd(ev) {
192
+ var _a;
192
193
  if (!dragRef.current.mouseDown) return;
193
194
  dragRef.current.mouseDown = false;
194
195
  try {
195
196
  document.body.style.userSelect = dragRef.current.prevUserSelect || "";
196
197
  document.body.style.webkitUserSelect = dragRef.current.prevWebkitUserSelect || "";
197
- } catch (_a) {}
198
+ } catch (_b) {}
198
199
  if (dragRef.current.active) {
199
200
  var finalInsertionIndex_1 = computeInsertionFromPageY(ev.pageY).insertionIndex;
200
201
  var sourceIndex_1 = dragRef.current.source;
@@ -299,15 +300,22 @@ var useRowDragAndDrop = exports.useRowDragAndDrop = function useRowDragAndDrop(c
299
300
  }
300
301
  });
301
302
  (_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
- });
303
+ });
304
+ var d = (0, _fortuneCore.getFlowdata)(context);
305
+ var colLen_1 = ((_a = d === null || d === void 0 ? void 0 : d[0]) === null || _a === void 0 ? void 0 : _a.length) || 0;
306
+ var targetIndex_1 = finalInsertionIndex_1;
307
+ if (targetIndex_1 > sourceIndex_1) targetIndex_1 -= 1;
308
+ var selData = _fortuneCore.api.getSelection(context) || [];
309
+ var sel = __spreadArray([], selData, true);
310
+ if (sel && sel[0]) {
311
+ sel[0].column = [targetIndex_1, targetIndex_1];
312
+ }
313
+ setContext(function (draftCtx) {
314
+ _fortuneCore.api.setSelection(draftCtx, [{
315
+ row: [targetIndex_1, targetIndex_1],
316
+ column: [0, colLen_1]
317
+ }], {
318
+ id: context.currentSheetId
311
319
  });
312
320
  });
313
321
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fileverse-dev/fortune-react",
3
- "version": "1.2.39",
3
+ "version": "1.2.40",
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.39",
19
+ "@fileverse-dev/fortune-core": "1.2.40",
20
20
  "@fileverse/ui": "^4.1.7-patch-40",
21
21
  "@tippyjs/react": "^4.2.6",
22
22
  "@types/regenerator-runtime": "^0.13.6",