@fileverse-dev/fortune-react 1.3.10-yjs → 1.3.10-yjs-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/components/SheetOverlay/drag_and_drop/column-helpers.js +20 -17
- package/es/components/SheetOverlay/drag_and_drop/row-helpers.js +23 -20
- package/lib/components/SheetOverlay/drag_and_drop/column-helpers.js +20 -17
- package/lib/components/SheetOverlay/drag_and_drop/row-helpers.js +23 -20
- package/package.json +2 -2
|
@@ -375,23 +375,26 @@ export var useColumnDragAndDrop = function useColumnDragAndDrop(containerRef, se
|
|
|
375
375
|
});
|
|
376
376
|
(_g = window === null || window === void 0 ? void 0 : window.updateDataBlockCalcFunctionAfterRowDrag) === null || _g === void 0 ? void 0 : _g.call(window, selectedSourceCol, selectedTargetCol, "column", context.currentSheetId, sourceIndex_1, targetIndex);
|
|
377
377
|
var cellChanges = [];
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
378
|
+
var affectedColStart = Math.min(sourceIndex_1, targetIndex);
|
|
379
|
+
var affectedColEnd = Math.max(sourceIndex_1, targetIndex) + selectedSourceCol.length - 1;
|
|
380
|
+
var numRows = rows.length;
|
|
381
|
+
for (var r = 0; r < numRows; r += 1) {
|
|
382
|
+
var row = rows[r];
|
|
383
|
+
for (var c = affectedColStart; c <= affectedColEnd; c += 1) {
|
|
384
|
+
var cell = row === null || row === void 0 ? void 0 : row[c];
|
|
385
|
+
cellChanges.push({
|
|
386
|
+
sheetId: draft.currentSheetId,
|
|
387
|
+
path: ["celldata"],
|
|
388
|
+
value: {
|
|
389
|
+
r: r,
|
|
390
|
+
c: c,
|
|
391
|
+
v: cell !== null && cell !== void 0 ? cell : null
|
|
392
|
+
},
|
|
393
|
+
key: "".concat(r, "_").concat(c),
|
|
394
|
+
type: "update"
|
|
395
|
+
});
|
|
396
|
+
}
|
|
397
|
+
}
|
|
395
398
|
if (cellChanges.length > 0 && ((_h = draft.hooks) === null || _h === void 0 ? void 0 : _h.updateCellYdoc)) {
|
|
396
399
|
draft.hooks.updateCellYdoc(cellChanges);
|
|
397
400
|
}
|
|
@@ -207,7 +207,7 @@ export var useRowDragAndDrop = function useRowDragAndDrop(containerRef, selected
|
|
|
207
207
|
var sheetIdx_1 = getSheetIndex(context, context.currentSheetId);
|
|
208
208
|
if (sheetIdx_1 != null && sourceIndex_1 >= 0 && Number.isFinite(finalInsertionIndex_1) && finalInsertionIndex_1 >= 0) {
|
|
209
209
|
setContext(function (draft) {
|
|
210
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
210
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
211
211
|
var _sheet = draft.luckysheetfile[sheetIdx_1];
|
|
212
212
|
if (!(_sheet === null || _sheet === void 0 ? void 0 : _sheet.data)) return;
|
|
213
213
|
var rows = _sheet.data;
|
|
@@ -365,27 +365,30 @@ export var useRowDragAndDrop = function useRowDragAndDrop(containerRef, selected
|
|
|
365
365
|
});
|
|
366
366
|
(_e = window === null || window === void 0 ? void 0 : window.updateDataBlockCalcFunctionAfterRowDrag) === null || _e === void 0 ? void 0 : _e.call(window, sourceIndex_1, targetIndex, "row", context.currentSheetId);
|
|
367
367
|
var cellChanges = [];
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
368
|
+
var affectedRowStart = Math.min(sourceIndex_1, targetIndex);
|
|
369
|
+
var affectedRowEnd = Math.max(sourceIndex_1, targetIndex) + selectedSourceRow.length - 1;
|
|
370
|
+
var numCols = (_g = (_f = d === null || d === void 0 ? void 0 : d[0]) === null || _f === void 0 ? void 0 : _f.length) !== null && _g !== void 0 ? _g : 0;
|
|
371
|
+
for (var r = affectedRowStart; r <= affectedRowEnd; r += 1) {
|
|
372
|
+
var row = rows[r];
|
|
373
|
+
for (var c = 0; c < numCols; c += 1) {
|
|
374
|
+
var cell = row === null || row === void 0 ? void 0 : row[c];
|
|
375
|
+
cellChanges.push({
|
|
376
|
+
sheetId: draft.currentSheetId,
|
|
377
|
+
path: ["celldata"],
|
|
378
|
+
value: {
|
|
379
|
+
r: r,
|
|
380
|
+
c: c,
|
|
381
|
+
v: cell !== null && cell !== void 0 ? cell : null
|
|
382
|
+
},
|
|
383
|
+
key: "".concat(r, "_").concat(c),
|
|
384
|
+
type: "update"
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
if (cellChanges.length > 0 && ((_h = draft.hooks) === null || _h === void 0 ? void 0 : _h.updateCellYdoc)) {
|
|
386
389
|
draft.hooks.updateCellYdoc(cellChanges);
|
|
387
390
|
}
|
|
388
|
-
var colLen = ((
|
|
391
|
+
var colLen = ((_j = d === null || d === void 0 ? void 0 : d[0]) === null || _j === void 0 ? void 0 : _j.length) || 0;
|
|
389
392
|
api.setSelection(draft, [{
|
|
390
393
|
row: [selectedTargetRow[0], selectedTargetRow[selectedTargetRow.length - 1]],
|
|
391
394
|
column: [0, colLen]
|
|
@@ -383,23 +383,26 @@ var useColumnDragAndDrop = exports.useColumnDragAndDrop = function useColumnDrag
|
|
|
383
383
|
});
|
|
384
384
|
(_g = window === null || window === void 0 ? void 0 : window.updateDataBlockCalcFunctionAfterRowDrag) === null || _g === void 0 ? void 0 : _g.call(window, selectedSourceCol, selectedTargetCol, "column", context.currentSheetId, sourceIndex_1, targetIndex);
|
|
385
385
|
var cellChanges = [];
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
386
|
+
var affectedColStart = Math.min(sourceIndex_1, targetIndex);
|
|
387
|
+
var affectedColEnd = Math.max(sourceIndex_1, targetIndex) + selectedSourceCol.length - 1;
|
|
388
|
+
var numRows = rows.length;
|
|
389
|
+
for (var r = 0; r < numRows; r += 1) {
|
|
390
|
+
var row = rows[r];
|
|
391
|
+
for (var c = affectedColStart; c <= affectedColEnd; c += 1) {
|
|
392
|
+
var cell = row === null || row === void 0 ? void 0 : row[c];
|
|
393
|
+
cellChanges.push({
|
|
394
|
+
sheetId: draft.currentSheetId,
|
|
395
|
+
path: ["celldata"],
|
|
396
|
+
value: {
|
|
397
|
+
r: r,
|
|
398
|
+
c: c,
|
|
399
|
+
v: cell !== null && cell !== void 0 ? cell : null
|
|
400
|
+
},
|
|
401
|
+
key: "".concat(r, "_").concat(c),
|
|
402
|
+
type: "update"
|
|
403
|
+
});
|
|
404
|
+
}
|
|
405
|
+
}
|
|
403
406
|
if (cellChanges.length > 0 && ((_h = draft.hooks) === null || _h === void 0 ? void 0 : _h.updateCellYdoc)) {
|
|
404
407
|
draft.hooks.updateCellYdoc(cellChanges);
|
|
405
408
|
}
|
|
@@ -214,7 +214,7 @@ var useRowDragAndDrop = exports.useRowDragAndDrop = function useRowDragAndDrop(c
|
|
|
214
214
|
var sheetIdx_1 = (0, _fortuneCore.getSheetIndex)(context, context.currentSheetId);
|
|
215
215
|
if (sheetIdx_1 != null && sourceIndex_1 >= 0 && Number.isFinite(finalInsertionIndex_1) && finalInsertionIndex_1 >= 0) {
|
|
216
216
|
setContext(function (draft) {
|
|
217
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
217
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
218
218
|
var _sheet = draft.luckysheetfile[sheetIdx_1];
|
|
219
219
|
if (!(_sheet === null || _sheet === void 0 ? void 0 : _sheet.data)) return;
|
|
220
220
|
var rows = _sheet.data;
|
|
@@ -372,27 +372,30 @@ var useRowDragAndDrop = exports.useRowDragAndDrop = function useRowDragAndDrop(c
|
|
|
372
372
|
});
|
|
373
373
|
(_e = window === null || window === void 0 ? void 0 : window.updateDataBlockCalcFunctionAfterRowDrag) === null || _e === void 0 ? void 0 : _e.call(window, sourceIndex_1, targetIndex, "row", context.currentSheetId);
|
|
374
374
|
var cellChanges = [];
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
375
|
+
var affectedRowStart = Math.min(sourceIndex_1, targetIndex);
|
|
376
|
+
var affectedRowEnd = Math.max(sourceIndex_1, targetIndex) + selectedSourceRow.length - 1;
|
|
377
|
+
var numCols = (_g = (_f = d === null || d === void 0 ? void 0 : d[0]) === null || _f === void 0 ? void 0 : _f.length) !== null && _g !== void 0 ? _g : 0;
|
|
378
|
+
for (var r = affectedRowStart; r <= affectedRowEnd; r += 1) {
|
|
379
|
+
var row = rows[r];
|
|
380
|
+
for (var c = 0; c < numCols; c += 1) {
|
|
381
|
+
var cell = row === null || row === void 0 ? void 0 : row[c];
|
|
382
|
+
cellChanges.push({
|
|
383
|
+
sheetId: draft.currentSheetId,
|
|
384
|
+
path: ["celldata"],
|
|
385
|
+
value: {
|
|
386
|
+
r: r,
|
|
387
|
+
c: c,
|
|
388
|
+
v: cell !== null && cell !== void 0 ? cell : null
|
|
389
|
+
},
|
|
390
|
+
key: "".concat(r, "_").concat(c),
|
|
391
|
+
type: "update"
|
|
392
|
+
});
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
if (cellChanges.length > 0 && ((_h = draft.hooks) === null || _h === void 0 ? void 0 : _h.updateCellYdoc)) {
|
|
393
396
|
draft.hooks.updateCellYdoc(cellChanges);
|
|
394
397
|
}
|
|
395
|
-
var colLen = ((
|
|
398
|
+
var colLen = ((_j = d === null || d === void 0 ? void 0 : d[0]) === null || _j === void 0 ? void 0 : _j.length) || 0;
|
|
396
399
|
_fortuneCore.api.setSelection(draft, [{
|
|
397
400
|
row: [selectedTargetRow[0], selectedTargetRow[selectedTargetRow.length - 1]],
|
|
398
401
|
column: [0, colLen]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fileverse-dev/fortune-react",
|
|
3
|
-
"version": "1.3.10-yjs",
|
|
3
|
+
"version": "1.3.10-yjs-1",
|
|
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.3.10-yjs",
|
|
19
|
+
"@fileverse-dev/fortune-core": "1.3.10-yjs-1",
|
|
20
20
|
"@fileverse/ui": "5.0.0",
|
|
21
21
|
"@tippyjs/react": "^4.2.6",
|
|
22
22
|
"@types/regenerator-runtime": "^0.13.6",
|