@fileverse-dev/fortune-react 1.0.2-mod-13 → 1.0.2-mod-14
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/dist/components/Workbook/api.d.ts +1 -0
- package/dist/components/Workbook/index.d.ts +1 -0
- package/dist/index.esm.js +23 -66
- package/dist/index.js +22 -65
- package/dist/index.umd.js +159 -782
- package/dist/index.umd.min.js +2 -2
- package/package.json +2 -2
|
@@ -6,6 +6,7 @@ export declare function generateAPIs(context: Context, setContext: (recipe: (ctx
|
|
|
6
6
|
type?: keyof Cell;
|
|
7
7
|
}) => any;
|
|
8
8
|
onboardingActiveCell: (functionName: string) => void;
|
|
9
|
+
initializeComment: (row: number, column: number) => void;
|
|
9
10
|
setCellValue: (row: number, column: number, value: any, options?: api.CommonOptions & {
|
|
10
11
|
type?: keyof Cell;
|
|
11
12
|
}) => void;
|
|
@@ -13,6 +13,7 @@ declare const Workbook: React.ForwardRefExoticComponent<Settings & AdditionalPro
|
|
|
13
13
|
type?: "v" | "m" | "mc" | "f" | "ct" | "qp" | "spl" | "bg" | "lo" | "rt" | "ps" | "hl" | keyof import("@fileverse-dev/fortune-core").CellStyle | undefined;
|
|
14
14
|
}) => any;
|
|
15
15
|
onboardingActiveCell: (functionName: string) => void;
|
|
16
|
+
initializeComment: (row: number, column: number) => void;
|
|
16
17
|
setCellValue: (row: number, column: number, value: any, options?: import("@fileverse-dev/fortune-core/dist/api").CommonOptions & {
|
|
17
18
|
type?: "v" | "m" | "mc" | "f" | "ct" | "qp" | "spl" | "bg" | "lo" | "rt" | "ps" | "hl" | keyof import("@fileverse-dev/fortune-core").CellStyle | undefined;
|
|
18
19
|
}) => void;
|
package/dist/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defaultContext, defaultSettings, getSheetIndex, colLocationByIndex, fixPositionOnFrozenCells, colLocation, getFlowdata, isAllowEdit, handleColumnHeaderMouseDown, handleColSizeHandleMouseDown, handleColFreezeHandleMouseDown, handleContextMenu, selectTitlesMap, selectTitlesRange, fixColumnStyleOverflowInFreeze, rowLocationByIndex, rowLocation, handleRowHeaderMouseDown, handleRowSizeHandleMouseDown, handleRowFreezeHandleMouseDown, fixRowStyleOverflowInFreeze, locale, getStyleByCell, getCellValue, createRangeHightlight, isInlineStringCell, getInlineStringHTML, valueShowEs, escapeHTMLTag, escapeScriptTag, moveToEnd, isShowHidenCR, getrangeseleciton, cancelNormalSelected, moveHighlightCell, israngeseleciton, handleFormulaInput, onSearchDialogMoveStart, replaceAll, replace, searchAll, searchNext, normalizeSelection, scrollToHighlightCell, isLinkValid, getRangetxt, goToLink, replaceHtml, removeHyperlink, onRangeSelectionModalMoveStart, saveHyperlink, createFilterOptions, onImageMoveStart, onImageResizeStart, showComments, setEditingComment, onCommentBoxMoveStart,
|
|
1
|
+
import { defaultContext, defaultSettings, getSheetIndex, colLocationByIndex, fixPositionOnFrozenCells, colLocation, getFlowdata, isAllowEdit, handleColumnHeaderMouseDown, handleColSizeHandleMouseDown, handleColFreezeHandleMouseDown, handleContextMenu, selectTitlesMap, selectTitlesRange, fixColumnStyleOverflowInFreeze, rowLocationByIndex, rowLocation, handleRowHeaderMouseDown, handleRowSizeHandleMouseDown, handleRowFreezeHandleMouseDown, fixRowStyleOverflowInFreeze, locale, getStyleByCell, getCellValue, createRangeHightlight, isInlineStringCell, getInlineStringHTML, valueShowEs, escapeHTMLTag, escapeScriptTag, moveToEnd, isShowHidenCR, getrangeseleciton, cancelNormalSelected, moveHighlightCell, israngeseleciton, handleFormulaInput, onSearchDialogMoveStart, replaceAll, replace, searchAll, searchNext, normalizeSelection, scrollToHighlightCell, isLinkValid, getRangetxt, goToLink, replaceHtml, removeHyperlink, onRangeSelectionModalMoveStart, saveHyperlink, createFilterOptions, onImageMoveStart, onImageResizeStart, showComments, setEditingComment, onCommentBoxMoveStart, confirmMessage, getRangeByTxt, getDropdownList, setCellValue, setConditionRules, mergeBorder, setDropcownValue, handleCellAreaMouseDown, handleCellAreaDoubleClick, selectAll, showLinkCard, getCellRowColumn, getCellHyperlink, handleOverlayMouseMove, handleOverlayMouseUp, handleKeydownForZoom, handleOverlayTouchStart, handleOverlayTouchMove, handleOverlayTouchEnd, insertRowCol, drawArrow, onCellsMoveStart, createDropCellRange, updateContextWithSheetData, updateContextWithCanvas, initFreeze, Canvas, handleGlobalWheel, setCaretPosition, getDataArr, updateMoreCell, getRegStr, getOptionValue, getSelectRange, applyLocation, updateItem, update, normalizedCellAttr, updateFormat, handleTextSize, handleHorizontalAlign, handleVerticalAlign, handleScreenShot, showImgChooser, insertImage, editComment, deleteComment, showHideComment, showHideAllComments, newComment, handleSum, autoSelectionFormula, handleMerge, handleBorder, handleFreeze, handleSort, createFilter, clearFilter, toolbarItemSelectedFunc, toolbarItemClickHandler, handleTextColor, handleTextBackground, getInlineStringNoStyle, rangeHightlightselected, updateCell, editSheetName, cancelActiveImgItem, MAX_ZOOM_RATIO, MIN_ZOOM_RATIO, addSheet, indexToColumnChar, sortSelection, handleCopy, deleteRowCol, hideSelected, showSelected, api, removeActiveImage, deleteSelectedCellText, jfrefreshgrid, handleLink, handlePasteByClick, deleteSheet, opToPatch, orderbydatafiler, getFilterColumnValues, getFilterColumnColors, saveFilter, calcSelectionInfo, patchToOp, filterPatch, inverseRowColOptions, ensureSheetIndex, initSheetIndex, handleGlobalKeyDown, handlePaste, groupValuesRefresh } from '@fileverse-dev/fortune-core';
|
|
2
2
|
import React, { useContext, useRef, useState, useMemo, useCallback, useEffect, useLayoutEffect, useImperativeHandle } from 'react';
|
|
3
3
|
import produce, { applyPatches, enablePatches, produceWithPatches } from 'immer';
|
|
4
4
|
import _ from 'lodash';
|
|
@@ -2362,7 +2362,8 @@ var NotationBoxes = function NotationBoxes() {
|
|
|
2362
2362
|
var _useContext = useContext(WorkbookContext),
|
|
2363
2363
|
context = _useContext.context,
|
|
2364
2364
|
setContext = _useContext.setContext,
|
|
2365
|
-
refs = _useContext.refs
|
|
2365
|
+
refs = _useContext.refs,
|
|
2366
|
+
settings = _useContext.settings;
|
|
2366
2367
|
var flowdata = getFlowdata(context);
|
|
2367
2368
|
useEffect(function () {
|
|
2368
2369
|
if (flowdata) {
|
|
@@ -2390,8 +2391,8 @@ var NotationBoxes = function NotationBoxes() {
|
|
|
2390
2391
|
}, _.concat((_context$commentBoxes = context.commentBoxes) === null || _context$commentBoxes === void 0 ? void 0 : _context$commentBoxes.filter(function (v) {
|
|
2391
2392
|
var _context$editingComme;
|
|
2392
2393
|
return (v === null || v === void 0 ? void 0 : v.rc) !== ((_context$editingComme = context.editingCommentBox) === null || _context$editingComme === void 0 ? void 0 : _context$editingComme.rc);
|
|
2393
|
-
}), [context.editingCommentBox, context.hoveredCommentBox]).map(function (commentBox) {
|
|
2394
|
-
var _context$editingComme2;
|
|
2394
|
+
}), [context.editingCommentBox, context.hoveredCommentBox]).map(function (commentBox, index) {
|
|
2395
|
+
var _context$editingComme2, _settings$getCommentC;
|
|
2395
2396
|
if (!commentBox) return null;
|
|
2396
2397
|
var r = commentBox.r,
|
|
2397
2398
|
c = commentBox.c,
|
|
@@ -2406,7 +2407,7 @@ var NotationBoxes = function NotationBoxes() {
|
|
|
2406
2407
|
var isEditing = ((_context$editingComme2 = context.editingCommentBox) === null || _context$editingComme2 === void 0 ? void 0 : _context$editingComme2.rc) === rc;
|
|
2407
2408
|
var commentId = "comment-box-".concat(rc);
|
|
2408
2409
|
return /*#__PURE__*/React.createElement("div", {
|
|
2409
|
-
key: rc
|
|
2410
|
+
key: rc + index
|
|
2410
2411
|
}, /*#__PURE__*/React.createElement("canvas", {
|
|
2411
2412
|
id: "arrowCanvas-".concat(rc),
|
|
2412
2413
|
className: "arrowCanvas",
|
|
@@ -2450,72 +2451,12 @@ var NotationBoxes = function NotationBoxes() {
|
|
|
2450
2451
|
e.stopPropagation();
|
|
2451
2452
|
}
|
|
2452
2453
|
}, /*#__PURE__*/React.createElement("div", {
|
|
2453
|
-
className: "luckysheet-postil-dialog-move"
|
|
2454
|
-
}, ["t", "r", "b", "l"].map(function (v) {
|
|
2455
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
2456
|
-
key: v,
|
|
2457
|
-
className: "luckysheet-postil-dialog-move-item luckysheet-postil-dialog-move-item-".concat(v),
|
|
2458
|
-
"data-type": v
|
|
2459
|
-
});
|
|
2460
|
-
})), isEditing && (/*#__PURE__*/React.createElement("div", {
|
|
2461
|
-
className: "luckysheet-postil-dialog-resize"
|
|
2462
|
-
}, ["lt", "mt", "lm", "rm", "rt", "lb", "mb", "rb"].map(function (v) {
|
|
2463
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
2464
|
-
key: v,
|
|
2465
|
-
className: "luckysheet-postil-dialog-resize-item luckysheet-postil-dialog-resize-item-".concat(v),
|
|
2466
|
-
"data-type": v,
|
|
2467
|
-
onMouseDown: function onMouseDown(e) {
|
|
2468
|
-
var nativeEvent = e.nativeEvent;
|
|
2469
|
-
onCommentBoxResizeStart(context, refs.globalCache, nativeEvent, {
|
|
2470
|
-
r: r,
|
|
2471
|
-
c: c,
|
|
2472
|
-
rc: rc
|
|
2473
|
-
}, commentId, v);
|
|
2474
|
-
e.stopPropagation();
|
|
2475
|
-
}
|
|
2476
|
-
});
|
|
2477
|
-
}))), /*#__PURE__*/React.createElement("div", {
|
|
2478
2454
|
style: {
|
|
2479
2455
|
width: "100%",
|
|
2480
2456
|
height: "100%",
|
|
2481
2457
|
overflow: "hidden"
|
|
2482
2458
|
}
|
|
2483
|
-
},
|
|
2484
|
-
id: "comment-editor-".concat(rc),
|
|
2485
|
-
autoFocus: autoFocus,
|
|
2486
|
-
style: {
|
|
2487
|
-
width: "100%",
|
|
2488
|
-
height: "100%",
|
|
2489
|
-
lineHeight: "20px",
|
|
2490
|
-
boxSizing: "border-box",
|
|
2491
|
-
textAlign: "center",
|
|
2492
|
-
wordBreak: "break-all",
|
|
2493
|
-
outline: "none"
|
|
2494
|
-
},
|
|
2495
|
-
allowEdit: context.allowEdit,
|
|
2496
|
-
spellCheck: false,
|
|
2497
|
-
"data-r": r,
|
|
2498
|
-
"data-c": c,
|
|
2499
|
-
onKeyDown: function onKeyDown(e) {
|
|
2500
|
-
return e.stopPropagation();
|
|
2501
|
-
},
|
|
2502
|
-
onFocus: function onFocus(e) {
|
|
2503
|
-
if (context.allowEdit === false) return;
|
|
2504
|
-
refs.globalCache.editingCommentBoxEle = e.target;
|
|
2505
|
-
},
|
|
2506
|
-
onMouseDown: function onMouseDown(e) {
|
|
2507
|
-
setContext(function (draftContext) {
|
|
2508
|
-
if (flowdata) {
|
|
2509
|
-
setEditingComment(draftContext, flowdata, r, c);
|
|
2510
|
-
}
|
|
2511
|
-
});
|
|
2512
|
-
e.stopPropagation();
|
|
2513
|
-
},
|
|
2514
|
-
onDoubleClick: function onDoubleClick(e) {
|
|
2515
|
-
e.stopPropagation();
|
|
2516
|
-
},
|
|
2517
|
-
initialContent: value
|
|
2518
|
-
}))));
|
|
2459
|
+
}, (_settings$getCommentC = settings.getCommentCellUI) === null || _settings$getCommentC === void 0 ? void 0 : _settings$getCommentC.call(settings, r, c))));
|
|
2519
2460
|
}));
|
|
2520
2461
|
};
|
|
2521
2462
|
|
|
@@ -7607,6 +7548,17 @@ var ContextMenu = function ContextMenu() {
|
|
|
7607
7548
|
key: "divider-".concat(i)
|
|
7608
7549
|
});
|
|
7609
7550
|
}
|
|
7551
|
+
if (name === "comment") {
|
|
7552
|
+
return /*#__PURE__*/React.createElement(Menu, {
|
|
7553
|
+
key: name,
|
|
7554
|
+
onClick: function onClick() {
|
|
7555
|
+
setContext(function (draftCtx) {
|
|
7556
|
+
newComment(draftCtx, refs.globalCache, selection === null || selection === void 0 ? void 0 : selection.row_focus, selection === null || selection === void 0 ? void 0 : selection.column_focus);
|
|
7557
|
+
draftCtx.contextMenu = {};
|
|
7558
|
+
});
|
|
7559
|
+
}
|
|
7560
|
+
}, "Comment");
|
|
7561
|
+
}
|
|
7610
7562
|
if (name === "copy") {
|
|
7611
7563
|
return /*#__PURE__*/React.createElement(Menu, {
|
|
7612
7564
|
key: name,
|
|
@@ -10038,6 +9990,11 @@ function generateAPIs(context, setContext, handleUndo, handleRedo, settings, cel
|
|
|
10038
9990
|
}
|
|
10039
9991
|
});
|
|
10040
9992
|
},
|
|
9993
|
+
initializeComment: function initializeComment(row, column) {
|
|
9994
|
+
setContext(function (ctx) {
|
|
9995
|
+
newComment(ctx, undefined, row, column);
|
|
9996
|
+
});
|
|
9997
|
+
},
|
|
10041
9998
|
setCellValue: function setCellValue(row, column, value) {
|
|
10042
9999
|
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
10043
10000
|
return setContext(function (draftCtx) {
|
package/dist/index.js
CHANGED
|
@@ -2373,7 +2373,8 @@ var NotationBoxes = function NotationBoxes() {
|
|
|
2373
2373
|
var _useContext = React.useContext(WorkbookContext),
|
|
2374
2374
|
context = _useContext.context,
|
|
2375
2375
|
setContext = _useContext.setContext,
|
|
2376
|
-
refs = _useContext.refs
|
|
2376
|
+
refs = _useContext.refs,
|
|
2377
|
+
settings = _useContext.settings;
|
|
2377
2378
|
var flowdata = fortuneCore.getFlowdata(context);
|
|
2378
2379
|
React.useEffect(function () {
|
|
2379
2380
|
if (flowdata) {
|
|
@@ -2401,8 +2402,8 @@ var NotationBoxes = function NotationBoxes() {
|
|
|
2401
2402
|
}, ___default['default'].concat((_context$commentBoxes = context.commentBoxes) === null || _context$commentBoxes === void 0 ? void 0 : _context$commentBoxes.filter(function (v) {
|
|
2402
2403
|
var _context$editingComme;
|
|
2403
2404
|
return (v === null || v === void 0 ? void 0 : v.rc) !== ((_context$editingComme = context.editingCommentBox) === null || _context$editingComme === void 0 ? void 0 : _context$editingComme.rc);
|
|
2404
|
-
}), [context.editingCommentBox, context.hoveredCommentBox]).map(function (commentBox) {
|
|
2405
|
-
var _context$editingComme2;
|
|
2405
|
+
}), [context.editingCommentBox, context.hoveredCommentBox]).map(function (commentBox, index) {
|
|
2406
|
+
var _context$editingComme2, _settings$getCommentC;
|
|
2406
2407
|
if (!commentBox) return null;
|
|
2407
2408
|
var r = commentBox.r,
|
|
2408
2409
|
c = commentBox.c,
|
|
@@ -2417,7 +2418,7 @@ var NotationBoxes = function NotationBoxes() {
|
|
|
2417
2418
|
var isEditing = ((_context$editingComme2 = context.editingCommentBox) === null || _context$editingComme2 === void 0 ? void 0 : _context$editingComme2.rc) === rc;
|
|
2418
2419
|
var commentId = "comment-box-".concat(rc);
|
|
2419
2420
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2420
|
-
key: rc
|
|
2421
|
+
key: rc + index
|
|
2421
2422
|
}, /*#__PURE__*/React__default['default'].createElement("canvas", {
|
|
2422
2423
|
id: "arrowCanvas-".concat(rc),
|
|
2423
2424
|
className: "arrowCanvas",
|
|
@@ -2461,72 +2462,12 @@ var NotationBoxes = function NotationBoxes() {
|
|
|
2461
2462
|
e.stopPropagation();
|
|
2462
2463
|
}
|
|
2463
2464
|
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2464
|
-
className: "luckysheet-postil-dialog-move"
|
|
2465
|
-
}, ["t", "r", "b", "l"].map(function (v) {
|
|
2466
|
-
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2467
|
-
key: v,
|
|
2468
|
-
className: "luckysheet-postil-dialog-move-item luckysheet-postil-dialog-move-item-".concat(v),
|
|
2469
|
-
"data-type": v
|
|
2470
|
-
});
|
|
2471
|
-
})), isEditing && (/*#__PURE__*/React__default['default'].createElement("div", {
|
|
2472
|
-
className: "luckysheet-postil-dialog-resize"
|
|
2473
|
-
}, ["lt", "mt", "lm", "rm", "rt", "lb", "mb", "rb"].map(function (v) {
|
|
2474
|
-
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2475
|
-
key: v,
|
|
2476
|
-
className: "luckysheet-postil-dialog-resize-item luckysheet-postil-dialog-resize-item-".concat(v),
|
|
2477
|
-
"data-type": v,
|
|
2478
|
-
onMouseDown: function onMouseDown(e) {
|
|
2479
|
-
var nativeEvent = e.nativeEvent;
|
|
2480
|
-
fortuneCore.onCommentBoxResizeStart(context, refs.globalCache, nativeEvent, {
|
|
2481
|
-
r: r,
|
|
2482
|
-
c: c,
|
|
2483
|
-
rc: rc
|
|
2484
|
-
}, commentId, v);
|
|
2485
|
-
e.stopPropagation();
|
|
2486
|
-
}
|
|
2487
|
-
});
|
|
2488
|
-
}))), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2489
2465
|
style: {
|
|
2490
2466
|
width: "100%",
|
|
2491
2467
|
height: "100%",
|
|
2492
2468
|
overflow: "hidden"
|
|
2493
2469
|
}
|
|
2494
|
-
},
|
|
2495
|
-
id: "comment-editor-".concat(rc),
|
|
2496
|
-
autoFocus: autoFocus,
|
|
2497
|
-
style: {
|
|
2498
|
-
width: "100%",
|
|
2499
|
-
height: "100%",
|
|
2500
|
-
lineHeight: "20px",
|
|
2501
|
-
boxSizing: "border-box",
|
|
2502
|
-
textAlign: "center",
|
|
2503
|
-
wordBreak: "break-all",
|
|
2504
|
-
outline: "none"
|
|
2505
|
-
},
|
|
2506
|
-
allowEdit: context.allowEdit,
|
|
2507
|
-
spellCheck: false,
|
|
2508
|
-
"data-r": r,
|
|
2509
|
-
"data-c": c,
|
|
2510
|
-
onKeyDown: function onKeyDown(e) {
|
|
2511
|
-
return e.stopPropagation();
|
|
2512
|
-
},
|
|
2513
|
-
onFocus: function onFocus(e) {
|
|
2514
|
-
if (context.allowEdit === false) return;
|
|
2515
|
-
refs.globalCache.editingCommentBoxEle = e.target;
|
|
2516
|
-
},
|
|
2517
|
-
onMouseDown: function onMouseDown(e) {
|
|
2518
|
-
setContext(function (draftContext) {
|
|
2519
|
-
if (flowdata) {
|
|
2520
|
-
fortuneCore.setEditingComment(draftContext, flowdata, r, c);
|
|
2521
|
-
}
|
|
2522
|
-
});
|
|
2523
|
-
e.stopPropagation();
|
|
2524
|
-
},
|
|
2525
|
-
onDoubleClick: function onDoubleClick(e) {
|
|
2526
|
-
e.stopPropagation();
|
|
2527
|
-
},
|
|
2528
|
-
initialContent: value
|
|
2529
|
-
}))));
|
|
2470
|
+
}, (_settings$getCommentC = settings.getCommentCellUI) === null || _settings$getCommentC === void 0 ? void 0 : _settings$getCommentC.call(settings, r, c))));
|
|
2530
2471
|
}));
|
|
2531
2472
|
};
|
|
2532
2473
|
|
|
@@ -7618,6 +7559,17 @@ var ContextMenu = function ContextMenu() {
|
|
|
7618
7559
|
key: "divider-".concat(i)
|
|
7619
7560
|
});
|
|
7620
7561
|
}
|
|
7562
|
+
if (name === "comment") {
|
|
7563
|
+
return /*#__PURE__*/React__default['default'].createElement(Menu, {
|
|
7564
|
+
key: name,
|
|
7565
|
+
onClick: function onClick() {
|
|
7566
|
+
setContext(function (draftCtx) {
|
|
7567
|
+
fortuneCore.newComment(draftCtx, refs.globalCache, selection === null || selection === void 0 ? void 0 : selection.row_focus, selection === null || selection === void 0 ? void 0 : selection.column_focus);
|
|
7568
|
+
draftCtx.contextMenu = {};
|
|
7569
|
+
});
|
|
7570
|
+
}
|
|
7571
|
+
}, "Comment");
|
|
7572
|
+
}
|
|
7621
7573
|
if (name === "copy") {
|
|
7622
7574
|
return /*#__PURE__*/React__default['default'].createElement(Menu, {
|
|
7623
7575
|
key: name,
|
|
@@ -10049,6 +10001,11 @@ function generateAPIs(context, setContext, handleUndo, handleRedo, settings, cel
|
|
|
10049
10001
|
}
|
|
10050
10002
|
});
|
|
10051
10003
|
},
|
|
10004
|
+
initializeComment: function initializeComment(row, column) {
|
|
10005
|
+
setContext(function (ctx) {
|
|
10006
|
+
fortuneCore.newComment(ctx, undefined, row, column);
|
|
10007
|
+
});
|
|
10008
|
+
},
|
|
10052
10009
|
setCellValue: function setCellValue(row, column, value) {
|
|
10053
10010
|
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
10054
10011
|
return setContext(function (draftCtx) {
|