@fileverse-dev/fortune-react 1.2.86-pinyin-5 → 1.2.86-pinyin-7
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.
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
var __assign = this && this.__assign || function () {
|
|
2
|
+
__assign = Object.assign || function (t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
6
|
+
}
|
|
7
|
+
return t;
|
|
8
|
+
};
|
|
9
|
+
return __assign.apply(this, arguments);
|
|
10
|
+
};
|
|
1
11
|
var __rest = this && this.__rest || function (s, e) {
|
|
2
12
|
var t = {};
|
|
3
13
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
@@ -15,7 +25,7 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
|
15
25
|
}
|
|
16
26
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
17
27
|
};
|
|
18
|
-
import {
|
|
28
|
+
import { defaultContext, defaultSettings, initSheetIndex, handleGlobalKeyDown, getSheetIndex, handlePaste, filterPatch, patchToOp, inverseRowColOptions, ensureSheetIndex, insertRowCol, deleteRowCol, groupValuesRefresh, insertDuneChart, getFlowdata, api, handlePasteByClick } from "@fileverse-dev/fortune-core";
|
|
19
29
|
import React, { useMemo, useState, useCallback, useEffect, useRef, useImperativeHandle } from "react";
|
|
20
30
|
import "./index.css";
|
|
21
31
|
import produce, { applyPatches, enablePatches, produceWithPatches } from "immer";
|
|
@@ -248,112 +258,20 @@ var Workbook = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
|
248
258
|
return result;
|
|
249
259
|
});
|
|
250
260
|
}, [emitOp]);
|
|
251
|
-
var repaint = function repaint() {
|
|
252
|
-
var _a, _b, _c, _d, _e;
|
|
253
|
-
console.log("repaint is calling");
|
|
254
|
-
var tableCanvas = new Canvas(refs.canvas.current, context);
|
|
255
|
-
console.log(context.config.borderInfo, "global context");
|
|
256
|
-
setContextWithProduce(function (draftCtx) {
|
|
257
|
-
console.log(draftCtx.config.borderInfo, "local context");
|
|
258
|
-
});
|
|
259
|
-
var freeze = (_a = refs.globalCache.freezen) === null || _a === void 0 ? void 0 : _a[sheet.id];
|
|
260
|
-
if (((_b = freeze === null || freeze === void 0 ? void 0 : freeze.horizontal) === null || _b === void 0 ? void 0 : _b.freezenhorizontaldata) || ((_c = freeze === null || freeze === void 0 ? void 0 : freeze.vertical) === null || _c === void 0 ? void 0 : _c.freezenverticaldata)) {
|
|
261
|
-
var horizontalData = (_d = freeze === null || freeze === void 0 ? void 0 : freeze.horizontal) === null || _d === void 0 ? void 0 : _d.freezenhorizontaldata;
|
|
262
|
-
var verticallData = (_e = freeze === null || freeze === void 0 ? void 0 : freeze.vertical) === null || _e === void 0 ? void 0 : _e.freezenverticaldata;
|
|
263
|
-
if (horizontalData && verticallData) {
|
|
264
|
-
var horizontalPx = horizontalData[0],
|
|
265
|
-
horizontalScrollTop = horizontalData[2];
|
|
266
|
-
var verticalPx = verticallData[0],
|
|
267
|
-
verticalScrollWidth = verticallData[2];
|
|
268
|
-
tableCanvas.drawMain({
|
|
269
|
-
scrollWidth: context.scrollLeft + verticalPx - verticalScrollWidth,
|
|
270
|
-
scrollHeight: context.scrollTop + horizontalPx - horizontalScrollTop,
|
|
271
|
-
offsetLeft: verticalPx - verticalScrollWidth + context.rowHeaderWidth,
|
|
272
|
-
offsetTop: horizontalPx - horizontalScrollTop + context.columnHeaderHeight,
|
|
273
|
-
clear: true
|
|
274
|
-
});
|
|
275
|
-
tableCanvas.drawMain({
|
|
276
|
-
scrollWidth: context.scrollLeft + verticalPx - verticalScrollWidth,
|
|
277
|
-
scrollHeight: horizontalScrollTop,
|
|
278
|
-
drawHeight: horizontalPx,
|
|
279
|
-
offsetLeft: verticalPx - verticalScrollWidth + context.rowHeaderWidth
|
|
280
|
-
});
|
|
281
|
-
tableCanvas.drawMain({
|
|
282
|
-
scrollWidth: verticalScrollWidth,
|
|
283
|
-
scrollHeight: context.scrollTop + horizontalPx - horizontalScrollTop,
|
|
284
|
-
drawWidth: verticalPx,
|
|
285
|
-
offsetTop: horizontalPx - horizontalScrollTop + context.columnHeaderHeight
|
|
286
|
-
});
|
|
287
|
-
tableCanvas.drawMain({
|
|
288
|
-
scrollWidth: verticalScrollWidth,
|
|
289
|
-
scrollHeight: horizontalScrollTop,
|
|
290
|
-
drawWidth: verticalPx,
|
|
291
|
-
drawHeight: horizontalPx
|
|
292
|
-
});
|
|
293
|
-
tableCanvas.drawColumnHeader(context.scrollLeft + verticalPx - verticalScrollWidth, undefined, verticalPx - verticalScrollWidth + context.rowHeaderWidth);
|
|
294
|
-
tableCanvas.drawColumnHeader(verticalScrollWidth, verticalPx);
|
|
295
|
-
tableCanvas.drawRowHeader(context.scrollTop + horizontalPx - horizontalScrollTop, undefined, horizontalPx - horizontalScrollTop + context.columnHeaderHeight);
|
|
296
|
-
tableCanvas.drawRowHeader(horizontalScrollTop, horizontalPx);
|
|
297
|
-
tableCanvas.drawFreezeLine({
|
|
298
|
-
horizontalTop: horizontalPx - horizontalScrollTop + context.columnHeaderHeight - 2,
|
|
299
|
-
verticalLeft: verticalPx - verticalScrollWidth + context.rowHeaderWidth - 2
|
|
300
|
-
});
|
|
301
|
-
} else if (horizontalData) {
|
|
302
|
-
var horizontalPx = horizontalData[0],
|
|
303
|
-
horizontalScrollTop = horizontalData[2];
|
|
304
|
-
tableCanvas.drawMain({
|
|
305
|
-
scrollWidth: context.scrollLeft,
|
|
306
|
-
scrollHeight: context.scrollTop + horizontalPx - horizontalScrollTop,
|
|
307
|
-
offsetTop: horizontalPx - horizontalScrollTop + context.columnHeaderHeight,
|
|
308
|
-
clear: true
|
|
309
|
-
});
|
|
310
|
-
tableCanvas.drawMain({
|
|
311
|
-
scrollWidth: context.scrollLeft,
|
|
312
|
-
scrollHeight: horizontalScrollTop,
|
|
313
|
-
drawHeight: horizontalPx
|
|
314
|
-
});
|
|
315
|
-
tableCanvas.drawColumnHeader(context.scrollLeft);
|
|
316
|
-
tableCanvas.drawRowHeader(context.scrollTop + horizontalPx - horizontalScrollTop, undefined, horizontalPx - horizontalScrollTop + context.columnHeaderHeight);
|
|
317
|
-
tableCanvas.drawRowHeader(horizontalScrollTop, horizontalPx);
|
|
318
|
-
tableCanvas.drawFreezeLine({
|
|
319
|
-
horizontalTop: horizontalPx - horizontalScrollTop + context.columnHeaderHeight - 2
|
|
320
|
-
});
|
|
321
|
-
} else if (verticallData) {
|
|
322
|
-
var verticalPx = verticallData[0],
|
|
323
|
-
verticalScrollWidth = verticallData[2];
|
|
324
|
-
tableCanvas.drawMain({
|
|
325
|
-
scrollWidth: context.scrollLeft + verticalPx - verticalScrollWidth,
|
|
326
|
-
scrollHeight: context.scrollTop,
|
|
327
|
-
offsetLeft: verticalPx - verticalScrollWidth + context.rowHeaderWidth
|
|
328
|
-
});
|
|
329
|
-
tableCanvas.drawMain({
|
|
330
|
-
scrollWidth: verticalScrollWidth,
|
|
331
|
-
scrollHeight: context.scrollTop,
|
|
332
|
-
drawWidth: verticalPx
|
|
333
|
-
});
|
|
334
|
-
tableCanvas.drawRowHeader(context.scrollTop);
|
|
335
|
-
tableCanvas.drawColumnHeader(context.scrollLeft + verticalPx - verticalScrollWidth, undefined, verticalPx - verticalScrollWidth + context.rowHeaderWidth);
|
|
336
|
-
tableCanvas.drawColumnHeader(verticalScrollWidth, verticalPx);
|
|
337
|
-
tableCanvas.drawFreezeLine({
|
|
338
|
-
verticalLeft: verticalPx - verticalScrollWidth + context.rowHeaderWidth - 2
|
|
339
|
-
});
|
|
340
|
-
}
|
|
341
|
-
} else {
|
|
342
|
-
tableCanvas.drawMain({
|
|
343
|
-
scrollWidth: context.scrollLeft,
|
|
344
|
-
scrollHeight: context.scrollTop,
|
|
345
|
-
clear: true
|
|
346
|
-
});
|
|
347
|
-
tableCanvas.drawColumnHeader(context.scrollLeft);
|
|
348
|
-
tableCanvas.drawRowHeader(context.scrollTop);
|
|
349
|
-
}
|
|
350
|
-
};
|
|
351
261
|
var handleUndo = useCallback(function () {
|
|
352
262
|
var history = globalCache.current.undoList.pop();
|
|
353
|
-
console.log("undo", history);
|
|
354
263
|
if (history) {
|
|
355
264
|
setContext(function (ctx_) {
|
|
356
|
-
var _a, _b, _c, _d, _e;
|
|
265
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
266
|
+
history.inversePatches.map(function (onePatch, index) {
|
|
267
|
+
if (!onePatch.value) {
|
|
268
|
+
onePatch.value = history.patches[index].value;
|
|
269
|
+
}
|
|
270
|
+
});
|
|
271
|
+
var isBorderUndo = history.patches.some(function (onePatch) {
|
|
272
|
+
var _a;
|
|
273
|
+
return (_a = onePatch.value) === null || _a === void 0 ? void 0 : _a.borderInfo;
|
|
274
|
+
});
|
|
357
275
|
if ((_a = history.options) === null || _a === void 0 ? void 0 : _a.deleteSheetOp) {
|
|
358
276
|
history.inversePatches[0].path[1] = ctx_.luckysheetfile.length;
|
|
359
277
|
var order_1 = (_c = (_b = history.options.deletedSheet) === null || _b === void 0 ? void 0 : _b.value) === null || _c === void 0 ? void 0 : _c.order;
|
|
@@ -386,19 +304,46 @@ var Workbook = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
|
386
304
|
delete inversedOptions.addSheet.value.data;
|
|
387
305
|
}
|
|
388
306
|
emitOp(newContext, history.inversePatches, inversedOptions, true);
|
|
389
|
-
|
|
307
|
+
var nw = __assign({}, newContext);
|
|
308
|
+
if (isBorderUndo) {
|
|
309
|
+
var nwborderlist = (_g = (_f = nw === null || nw === void 0 ? void 0 : nw.config) === null || _f === void 0 ? void 0 : _f.borderInfo) === null || _g === void 0 ? void 0 : _g.slice(0, -1);
|
|
310
|
+
nw = __assign(__assign({}, nw), {
|
|
311
|
+
config: __assign(__assign({}, nw.config), {
|
|
312
|
+
borderInfo: nwborderlist
|
|
313
|
+
})
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
return nw;
|
|
390
317
|
});
|
|
391
|
-
repaint();
|
|
392
318
|
}
|
|
393
319
|
}, [emitOp]);
|
|
394
320
|
var handleRedo = useCallback(function () {
|
|
395
321
|
var history = globalCache.current.redoList.pop();
|
|
396
322
|
if (history) {
|
|
397
323
|
setContext(function (ctx_) {
|
|
324
|
+
var _a, _b, _c;
|
|
325
|
+
history.inversePatches.map(function (onePatch, index) {
|
|
326
|
+
if (!onePatch.value) {
|
|
327
|
+
onePatch.value = history.patches[index].value;
|
|
328
|
+
}
|
|
329
|
+
});
|
|
398
330
|
var newContext = applyPatches(ctx_, history.patches);
|
|
331
|
+
var isBorderUndo = history.patches.some(function (onePatch) {
|
|
332
|
+
var _a;
|
|
333
|
+
return (_a = onePatch.value) === null || _a === void 0 ? void 0 : _a.borderInfo;
|
|
334
|
+
});
|
|
399
335
|
globalCache.current.undoList.push(history);
|
|
400
336
|
emitOp(newContext, history.patches, history.options);
|
|
401
|
-
|
|
337
|
+
var nw = __assign({}, newContext);
|
|
338
|
+
if (isBorderUndo) {
|
|
339
|
+
var nwborderlist = ((_b = (_a = nw === null || nw === void 0 ? void 0 : nw.config) === null || _a === void 0 ? void 0 : _a.borderInfo) !== null && _b !== void 0 ? _b : []).concat((_c = history.patches[0].value) === null || _c === void 0 ? void 0 : _c.borderInfo[0]);
|
|
340
|
+
nw = __assign(__assign({}, nw), {
|
|
341
|
+
config: __assign(__assign({}, nw.config), {
|
|
342
|
+
borderInfo: nwborderlist
|
|
343
|
+
})
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
return nw;
|
|
402
347
|
});
|
|
403
348
|
}
|
|
404
349
|
}, [emitOp]);
|
|
@@ -26,6 +26,16 @@ var _SheetList = _interopRequireDefault(require("../SheetList"));
|
|
|
26
26
|
var _DunePreview = _interopRequireDefault(require("../DunePreview/DunePreview"));
|
|
27
27
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
28
28
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
29
|
+
var __assign = void 0 && (void 0).__assign || function () {
|
|
30
|
+
__assign = Object.assign || function (t) {
|
|
31
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
32
|
+
s = arguments[i];
|
|
33
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
34
|
+
}
|
|
35
|
+
return t;
|
|
36
|
+
};
|
|
37
|
+
return __assign.apply(this, arguments);
|
|
38
|
+
};
|
|
29
39
|
var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
30
40
|
var t = {};
|
|
31
41
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
@@ -257,112 +267,20 @@ var Workbook = /*#__PURE__*/_react.default.forwardRef(function (_a, ref) {
|
|
|
257
267
|
return result;
|
|
258
268
|
});
|
|
259
269
|
}, [emitOp]);
|
|
260
|
-
var repaint = function repaint() {
|
|
261
|
-
var _a, _b, _c, _d, _e;
|
|
262
|
-
console.log("repaint is calling");
|
|
263
|
-
var tableCanvas = new _fortuneCore.Canvas(refs.canvas.current, context);
|
|
264
|
-
console.log(context.config.borderInfo, "global context");
|
|
265
|
-
setContextWithProduce(function (draftCtx) {
|
|
266
|
-
console.log(draftCtx.config.borderInfo, "local context");
|
|
267
|
-
});
|
|
268
|
-
var freeze = (_a = refs.globalCache.freezen) === null || _a === void 0 ? void 0 : _a[sheet.id];
|
|
269
|
-
if (((_b = freeze === null || freeze === void 0 ? void 0 : freeze.horizontal) === null || _b === void 0 ? void 0 : _b.freezenhorizontaldata) || ((_c = freeze === null || freeze === void 0 ? void 0 : freeze.vertical) === null || _c === void 0 ? void 0 : _c.freezenverticaldata)) {
|
|
270
|
-
var horizontalData = (_d = freeze === null || freeze === void 0 ? void 0 : freeze.horizontal) === null || _d === void 0 ? void 0 : _d.freezenhorizontaldata;
|
|
271
|
-
var verticallData = (_e = freeze === null || freeze === void 0 ? void 0 : freeze.vertical) === null || _e === void 0 ? void 0 : _e.freezenverticaldata;
|
|
272
|
-
if (horizontalData && verticallData) {
|
|
273
|
-
var horizontalPx = horizontalData[0],
|
|
274
|
-
horizontalScrollTop = horizontalData[2];
|
|
275
|
-
var verticalPx = verticallData[0],
|
|
276
|
-
verticalScrollWidth = verticallData[2];
|
|
277
|
-
tableCanvas.drawMain({
|
|
278
|
-
scrollWidth: context.scrollLeft + verticalPx - verticalScrollWidth,
|
|
279
|
-
scrollHeight: context.scrollTop + horizontalPx - horizontalScrollTop,
|
|
280
|
-
offsetLeft: verticalPx - verticalScrollWidth + context.rowHeaderWidth,
|
|
281
|
-
offsetTop: horizontalPx - horizontalScrollTop + context.columnHeaderHeight,
|
|
282
|
-
clear: true
|
|
283
|
-
});
|
|
284
|
-
tableCanvas.drawMain({
|
|
285
|
-
scrollWidth: context.scrollLeft + verticalPx - verticalScrollWidth,
|
|
286
|
-
scrollHeight: horizontalScrollTop,
|
|
287
|
-
drawHeight: horizontalPx,
|
|
288
|
-
offsetLeft: verticalPx - verticalScrollWidth + context.rowHeaderWidth
|
|
289
|
-
});
|
|
290
|
-
tableCanvas.drawMain({
|
|
291
|
-
scrollWidth: verticalScrollWidth,
|
|
292
|
-
scrollHeight: context.scrollTop + horizontalPx - horizontalScrollTop,
|
|
293
|
-
drawWidth: verticalPx,
|
|
294
|
-
offsetTop: horizontalPx - horizontalScrollTop + context.columnHeaderHeight
|
|
295
|
-
});
|
|
296
|
-
tableCanvas.drawMain({
|
|
297
|
-
scrollWidth: verticalScrollWidth,
|
|
298
|
-
scrollHeight: horizontalScrollTop,
|
|
299
|
-
drawWidth: verticalPx,
|
|
300
|
-
drawHeight: horizontalPx
|
|
301
|
-
});
|
|
302
|
-
tableCanvas.drawColumnHeader(context.scrollLeft + verticalPx - verticalScrollWidth, undefined, verticalPx - verticalScrollWidth + context.rowHeaderWidth);
|
|
303
|
-
tableCanvas.drawColumnHeader(verticalScrollWidth, verticalPx);
|
|
304
|
-
tableCanvas.drawRowHeader(context.scrollTop + horizontalPx - horizontalScrollTop, undefined, horizontalPx - horizontalScrollTop + context.columnHeaderHeight);
|
|
305
|
-
tableCanvas.drawRowHeader(horizontalScrollTop, horizontalPx);
|
|
306
|
-
tableCanvas.drawFreezeLine({
|
|
307
|
-
horizontalTop: horizontalPx - horizontalScrollTop + context.columnHeaderHeight - 2,
|
|
308
|
-
verticalLeft: verticalPx - verticalScrollWidth + context.rowHeaderWidth - 2
|
|
309
|
-
});
|
|
310
|
-
} else if (horizontalData) {
|
|
311
|
-
var horizontalPx = horizontalData[0],
|
|
312
|
-
horizontalScrollTop = horizontalData[2];
|
|
313
|
-
tableCanvas.drawMain({
|
|
314
|
-
scrollWidth: context.scrollLeft,
|
|
315
|
-
scrollHeight: context.scrollTop + horizontalPx - horizontalScrollTop,
|
|
316
|
-
offsetTop: horizontalPx - horizontalScrollTop + context.columnHeaderHeight,
|
|
317
|
-
clear: true
|
|
318
|
-
});
|
|
319
|
-
tableCanvas.drawMain({
|
|
320
|
-
scrollWidth: context.scrollLeft,
|
|
321
|
-
scrollHeight: horizontalScrollTop,
|
|
322
|
-
drawHeight: horizontalPx
|
|
323
|
-
});
|
|
324
|
-
tableCanvas.drawColumnHeader(context.scrollLeft);
|
|
325
|
-
tableCanvas.drawRowHeader(context.scrollTop + horizontalPx - horizontalScrollTop, undefined, horizontalPx - horizontalScrollTop + context.columnHeaderHeight);
|
|
326
|
-
tableCanvas.drawRowHeader(horizontalScrollTop, horizontalPx);
|
|
327
|
-
tableCanvas.drawFreezeLine({
|
|
328
|
-
horizontalTop: horizontalPx - horizontalScrollTop + context.columnHeaderHeight - 2
|
|
329
|
-
});
|
|
330
|
-
} else if (verticallData) {
|
|
331
|
-
var verticalPx = verticallData[0],
|
|
332
|
-
verticalScrollWidth = verticallData[2];
|
|
333
|
-
tableCanvas.drawMain({
|
|
334
|
-
scrollWidth: context.scrollLeft + verticalPx - verticalScrollWidth,
|
|
335
|
-
scrollHeight: context.scrollTop,
|
|
336
|
-
offsetLeft: verticalPx - verticalScrollWidth + context.rowHeaderWidth
|
|
337
|
-
});
|
|
338
|
-
tableCanvas.drawMain({
|
|
339
|
-
scrollWidth: verticalScrollWidth,
|
|
340
|
-
scrollHeight: context.scrollTop,
|
|
341
|
-
drawWidth: verticalPx
|
|
342
|
-
});
|
|
343
|
-
tableCanvas.drawRowHeader(context.scrollTop);
|
|
344
|
-
tableCanvas.drawColumnHeader(context.scrollLeft + verticalPx - verticalScrollWidth, undefined, verticalPx - verticalScrollWidth + context.rowHeaderWidth);
|
|
345
|
-
tableCanvas.drawColumnHeader(verticalScrollWidth, verticalPx);
|
|
346
|
-
tableCanvas.drawFreezeLine({
|
|
347
|
-
verticalLeft: verticalPx - verticalScrollWidth + context.rowHeaderWidth - 2
|
|
348
|
-
});
|
|
349
|
-
}
|
|
350
|
-
} else {
|
|
351
|
-
tableCanvas.drawMain({
|
|
352
|
-
scrollWidth: context.scrollLeft,
|
|
353
|
-
scrollHeight: context.scrollTop,
|
|
354
|
-
clear: true
|
|
355
|
-
});
|
|
356
|
-
tableCanvas.drawColumnHeader(context.scrollLeft);
|
|
357
|
-
tableCanvas.drawRowHeader(context.scrollTop);
|
|
358
|
-
}
|
|
359
|
-
};
|
|
360
270
|
var handleUndo = (0, _react.useCallback)(function () {
|
|
361
271
|
var history = globalCache.current.undoList.pop();
|
|
362
|
-
console.log("undo", history);
|
|
363
272
|
if (history) {
|
|
364
273
|
setContext(function (ctx_) {
|
|
365
|
-
var _a, _b, _c, _d, _e;
|
|
274
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
275
|
+
history.inversePatches.map(function (onePatch, index) {
|
|
276
|
+
if (!onePatch.value) {
|
|
277
|
+
onePatch.value = history.patches[index].value;
|
|
278
|
+
}
|
|
279
|
+
});
|
|
280
|
+
var isBorderUndo = history.patches.some(function (onePatch) {
|
|
281
|
+
var _a;
|
|
282
|
+
return (_a = onePatch.value) === null || _a === void 0 ? void 0 : _a.borderInfo;
|
|
283
|
+
});
|
|
366
284
|
if ((_a = history.options) === null || _a === void 0 ? void 0 : _a.deleteSheetOp) {
|
|
367
285
|
history.inversePatches[0].path[1] = ctx_.luckysheetfile.length;
|
|
368
286
|
var order_1 = (_c = (_b = history.options.deletedSheet) === null || _b === void 0 ? void 0 : _b.value) === null || _c === void 0 ? void 0 : _c.order;
|
|
@@ -395,19 +313,46 @@ var Workbook = /*#__PURE__*/_react.default.forwardRef(function (_a, ref) {
|
|
|
395
313
|
delete inversedOptions.addSheet.value.data;
|
|
396
314
|
}
|
|
397
315
|
emitOp(newContext, history.inversePatches, inversedOptions, true);
|
|
398
|
-
|
|
316
|
+
var nw = __assign({}, newContext);
|
|
317
|
+
if (isBorderUndo) {
|
|
318
|
+
var nwborderlist = (_g = (_f = nw === null || nw === void 0 ? void 0 : nw.config) === null || _f === void 0 ? void 0 : _f.borderInfo) === null || _g === void 0 ? void 0 : _g.slice(0, -1);
|
|
319
|
+
nw = __assign(__assign({}, nw), {
|
|
320
|
+
config: __assign(__assign({}, nw.config), {
|
|
321
|
+
borderInfo: nwborderlist
|
|
322
|
+
})
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
return nw;
|
|
399
326
|
});
|
|
400
|
-
repaint();
|
|
401
327
|
}
|
|
402
328
|
}, [emitOp]);
|
|
403
329
|
var handleRedo = (0, _react.useCallback)(function () {
|
|
404
330
|
var history = globalCache.current.redoList.pop();
|
|
405
331
|
if (history) {
|
|
406
332
|
setContext(function (ctx_) {
|
|
333
|
+
var _a, _b, _c;
|
|
334
|
+
history.inversePatches.map(function (onePatch, index) {
|
|
335
|
+
if (!onePatch.value) {
|
|
336
|
+
onePatch.value = history.patches[index].value;
|
|
337
|
+
}
|
|
338
|
+
});
|
|
407
339
|
var newContext = (0, _immer.applyPatches)(ctx_, history.patches);
|
|
340
|
+
var isBorderUndo = history.patches.some(function (onePatch) {
|
|
341
|
+
var _a;
|
|
342
|
+
return (_a = onePatch.value) === null || _a === void 0 ? void 0 : _a.borderInfo;
|
|
343
|
+
});
|
|
408
344
|
globalCache.current.undoList.push(history);
|
|
409
345
|
emitOp(newContext, history.patches, history.options);
|
|
410
|
-
|
|
346
|
+
var nw = __assign({}, newContext);
|
|
347
|
+
if (isBorderUndo) {
|
|
348
|
+
var nwborderlist = ((_b = (_a = nw === null || nw === void 0 ? void 0 : nw.config) === null || _a === void 0 ? void 0 : _a.borderInfo) !== null && _b !== void 0 ? _b : []).concat((_c = history.patches[0].value) === null || _c === void 0 ? void 0 : _c.borderInfo[0]);
|
|
349
|
+
nw = __assign(__assign({}, nw), {
|
|
350
|
+
config: __assign(__assign({}, nw.config), {
|
|
351
|
+
borderInfo: nwborderlist
|
|
352
|
+
})
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
return nw;
|
|
411
356
|
});
|
|
412
357
|
}
|
|
413
358
|
}, [emitOp]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fileverse-dev/fortune-react",
|
|
3
|
-
"version": "1.2.86-pinyin-
|
|
3
|
+
"version": "1.2.86-pinyin-7",
|
|
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.86-pinyin-
|
|
19
|
+
"@fileverse-dev/fortune-core": "1.2.86-pinyin-7",
|
|
20
20
|
"@fileverse/ui": "^4.1.7-patch-40",
|
|
21
21
|
"@tippyjs/react": "^4.2.6",
|
|
22
22
|
"@types/regenerator-runtime": "^0.13.6",
|