@leankylin-sheet/react 7.0.36 → 7.0.38
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/index.esm.js +70 -5
- package/dist/index.js +69 -4
- package/dist/index.umd.js +69 -4
- package/dist/index.umd.min.js +1 -1
- package/package.json +3 -3
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, functionHTMLGenerate, locale, getCellValue, createRangeHightlight, isInlineStringCell, getInlineStringHTML, valueShowEs, escapeHTMLTag, escapeScriptTag, isShowHidenCR, cancelNormalSelected, moveHighlightCell, updateCell, israngeseleciton, handleFormulaInput, onSearchDialogMoveStart, replaceAll, replace, searchAll, searchNext, changeSheet, normalizeSelection, scrollToHighlightCell, chatatABC, getCellHyperlink, isLinkValid, getRangetxt, goToLink, replaceHtml, removeHyperlink, onRangeSelectionModalMoveStart, saveHyperlink, createFilterOptions, onImageMoveStart, onImageResizeStart, showComments, setEditingComment, onCommentBoxMoveStart, onCommentBoxResizeStart, confirmMessage, getRangeByTxt, getDropdownList, setCellValue, setConditionRules, mergeBorder, setDropcownValue, handleCellAreaMouseDown, handleCellAreaMouseMove, handleCellAreaDragOver, handleCellDrop, handleCellAreaDoubleClick, selectAll, showLinkCard, getCellRowColumn, handleOverlayMouseMove, handleOverlayMouseUp, handleKeydownForZoom, handleOverlayTouchStart, handleOverlayTouchMove, handleOverlayTouchEnd, PAINT_MODEL_CURSOR, onCellsMoveStart, createDropCellRange, handleDropCellDoubleClick, updateContextWithSheetData, updateContextWithCanvas, initFreeze, Canvas, handleGlobalWheel, setCaretPosition, getDataArr, updateMoreCell, getRegStr, getOptionValue, getSelectRange, applyLocation, updateItem, normalizedCellAttr, update, updateFormat, handleTextSize, handleHorizontalAlign, handleVerticalAlign, handleScreenShot, showImgChooser, insertImage, editComment, deleteComment, showHideComment, showHideAllComments, newComment, handleSum, autoSelectionFormula, handleMerge, handleBorder, handleFreeze, handleSort, createFilter, clearFilter, toolbarItemSelectedFunc, toolbarItemClickHandler, handleTextColor, handleTextBackground, getDataBySelectionNoCopy, getInlineStringNoStyle, rangeHightlightselected, editSheetName, setNextSheet, MAX_ZOOM_RATIO, MIN_ZOOM_RATIO, addSheet, indexToColumnChar, sortSelection, handleCopy, insertRowCol, deleteRowCol, hideSelected, showSelected, api, removeActiveImage, deleteSelectedCellText, jfrefreshgrid, handleLink, deleteSheet, opToPatch, orderbydatafiler, getFilterColumnValues, getFilterColumnColors, saveFilter, cancelActiveImgItem, patchToOp, filterPatch, inverseRowColOptions, ensureSheetIndex, initSheetIndex, handleGlobalKeyDown, handlePasteByLeanklin, groupValuesRefresh } from '@leankylin-sheet/core';
|
|
1
|
+
import { defaultContext, defaultSettings, getSheetIndex, colLocationByIndex, fixPositionOnFrozenCells, colLocation, getFlowdata, isAllowEdit, handleColumnHeaderMouseDown, handleColSizeHandleMouseDown, handleColFreezeHandleMouseDown, handleContextMenu, selectTitlesMap, selectTitlesRange, fixColumnStyleOverflowInFreeze, rowLocationByIndex, rowLocation, handleRowHeaderMouseDown, handleRowSizeHandleMouseDown, handleRowFreezeHandleMouseDown, fixRowStyleOverflowInFreeze, functionHTMLGenerate, locale, getCellValue, createRangeHightlight, isInlineStringCell, getInlineStringHTML, valueShowEs, escapeHTMLTag, escapeScriptTag, isShowHidenCR, cancelNormalSelected, moveHighlightCell, updateCell, israngeseleciton, handleFormulaInput, onSearchDialogMoveStart, replaceAll, replace, searchAll, searchNext, changeSheet, normalizeSelection, scrollToHighlightCell, chatatABC, getCellHyperlink, isLinkValid, getRangetxt, goToLink, replaceHtml, removeHyperlink, onRangeSelectionModalMoveStart, saveHyperlink, createFilterOptions, onImageMoveStart, onImageResizeStart, showComments, setEditingComment, onCommentBoxMoveStart, onCommentBoxResizeStart, confirmMessage, getRangeByTxt, getDropdownList, setCellValue, setConditionRules, mergeBorder, setDropcownValue, handleCellAreaMouseDown, handleCellAreaMouseMove, handleCellAreaDragOver, handleCellDrop, handleCellAreaDoubleClick, selectAll, showLinkCard, getCellRowColumn, handleOverlayMouseMove, handleOverlayMouseUp, handleKeydownForZoom, handleOverlayTouchStart, handleOverlayTouchMove, handleOverlayTouchEnd, PAINT_MODEL_CURSOR, onCellsMoveStart, createDropCellRange, handleDropCellDoubleClick, updateContextWithSheetData, updateContextWithCanvas, initFreeze, Canvas, handleGlobalWheel, setCaretPosition, getDataArr, updateMoreCell, getRegStr, getOptionValue, getSelectRange, applyLocation, updateItem, normalizedCellAttr, update, updateFormat, handleTextSize, handleHorizontalAlign, handleVerticalAlign, handleScreenShot, showImgChooser, insertImage, editComment, deleteComment, showHideComment, showHideAllComments, newComment, handleSum, autoSelectionFormula, handleMerge, handleBorder, handleFreeze, handleSort, createFilter, clearFilter, handleAutoRecalc, toolbarItemSelectedFunc, toolbarItemClickHandler, handleTextColor, handleTextBackground, getDataBySelectionNoCopy, getInlineStringNoStyle, rangeHightlightselected, editSheetName, setNextSheet, MAX_ZOOM_RATIO, MIN_ZOOM_RATIO, addSheet, indexToColumnChar, sortSelection, handleCopy, insertRowCol, deleteRowCol, hideSelected, showSelected, api, removeActiveImage, deleteSelectedCellText, jfrefreshgrid, handleLink, deleteSheet, opToPatch, orderbydatafiler, getFilterColumnValues, getFilterColumnColors, saveFilter, cancelActiveImgItem, patchToOp, filterPatch, inverseRowColOptions, ensureSheetIndex, initSheetIndex, handleGlobalKeyDown, handlePasteByLeanklin, groupValuesRefresh } from '@leankylin-sheet/core';
|
|
2
2
|
import { useInViewport, useMemoizedFn, useThrottleFn } from 'ahooks';
|
|
3
3
|
import React, { useContext, useRef, useState, useMemo, useCallback, useEffect, useLayoutEffect, useImperativeHandle } from 'react';
|
|
4
4
|
import produce, { applyPatches, enablePatches, produceWithPatches } from 'immer';
|
|
@@ -6696,6 +6696,7 @@ var Toolbar = function Toolbar(_ref) {
|
|
|
6696
6696
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
6697
6697
|
customStyle = _useState8[0],
|
|
6698
6698
|
setcustomStyle = _useState8[1];
|
|
6699
|
+
var lastBorderTypeRef = useRef("border-all");
|
|
6699
6700
|
var showSubMenu = useCallback(function (e, className) {
|
|
6700
6701
|
var target = e.target;
|
|
6701
6702
|
var menuItem = target.className === "leankylin-toolbar-menu-line" ? target.parentElement : target;
|
|
@@ -7455,7 +7456,8 @@ var Toolbar = function Toolbar(_ref) {
|
|
|
7455
7456
|
tooltip: tooltip,
|
|
7456
7457
|
text: "\u8FB9\u6846\u8BBE\u7F6E",
|
|
7457
7458
|
onClick: function onClick() {
|
|
7458
|
-
|
|
7459
|
+
lastBorderTypeRef.current = "border-all";
|
|
7460
|
+
setContext(function (ctx) {
|
|
7459
7461
|
handleBorder(ctx, "border-all", customColor, customStyle);
|
|
7460
7462
|
});
|
|
7461
7463
|
}
|
|
@@ -7466,6 +7468,7 @@ var Toolbar = function Toolbar(_ref) {
|
|
|
7466
7468
|
return value !== "divider" ? ( /*#__PURE__*/React.createElement(Option, {
|
|
7467
7469
|
key: value,
|
|
7468
7470
|
onClick: function onClick() {
|
|
7471
|
+
lastBorderTypeRef.current = value;
|
|
7469
7472
|
setContext(function (ctx) {
|
|
7470
7473
|
handleBorder(ctx, value, customColor, customStyle);
|
|
7471
7474
|
});
|
|
@@ -7482,6 +7485,9 @@ var Toolbar = function Toolbar(_ref) {
|
|
|
7482
7485
|
onPick: function onPick(color, style) {
|
|
7483
7486
|
setcustomColor(color);
|
|
7484
7487
|
setcustomStyle(style);
|
|
7488
|
+
setContext(function (ctx) {
|
|
7489
|
+
handleBorder(ctx, lastBorderTypeRef.current, color, style);
|
|
7490
|
+
});
|
|
7485
7491
|
}
|
|
7486
7492
|
}));
|
|
7487
7493
|
});
|
|
@@ -7698,6 +7704,21 @@ var Toolbar = function Toolbar(_ref) {
|
|
|
7698
7704
|
}));
|
|
7699
7705
|
});
|
|
7700
7706
|
}
|
|
7707
|
+
if (name === "auto-recalc") {
|
|
7708
|
+
var enabled = context.autoRecalc !== false;
|
|
7709
|
+
return /*#__PURE__*/React.createElement(Button, {
|
|
7710
|
+
iconId: enabled ? "auto-recalc" : "auto-recalc-off",
|
|
7711
|
+
tooltip: enabled ? toolbar.autoRecalcOn : toolbar.autoRecalcOff,
|
|
7712
|
+
key: name,
|
|
7713
|
+
onClick: function onClick() {
|
|
7714
|
+
return setContext(function (draftCtx) {
|
|
7715
|
+
handleAutoRecalc(draftCtx);
|
|
7716
|
+
}, {
|
|
7717
|
+
noHistory: true
|
|
7718
|
+
});
|
|
7719
|
+
}
|
|
7720
|
+
});
|
|
7721
|
+
}
|
|
7701
7722
|
var selected = (_toolbarItemSelectedF = toolbarItemSelectedFunc(name)) === null || _toolbarItemSelectedF === void 0 ? void 0 : _toolbarItemSelectedF(cell);
|
|
7702
7723
|
if (name === "format-painter") {
|
|
7703
7724
|
selected = context.luckysheetPaintModelOn;
|
|
@@ -7714,7 +7735,7 @@ var Toolbar = function Toolbar(_ref) {
|
|
|
7714
7735
|
});
|
|
7715
7736
|
}
|
|
7716
7737
|
});
|
|
7717
|
-
}, [toolbar, cell, setContext, refs.cellInput, refs.fxInput, refs.globalCache, defaultFmt, align, handleUndo, handleRedo, flowdata, formula, showDialog, hideDialog, merge, border, freezen, screenshot, sort, textWrap, rotation, filter, splitText, findAndReplace, context.luckysheet_select_save, context.defaultFontSize, context.allowEdit, context.luckysheetPaintModelOn, comment, fontarray, hideSubMenu, showSubMenu, refs.canvas, customColor, customStyle]);
|
|
7738
|
+
}, [toolbar, cell, setContext, refs.cellInput, refs.fxInput, refs.globalCache, defaultFmt, align, handleUndo, handleRedo, flowdata, formula, showDialog, hideDialog, merge, border, freezen, screenshot, sort, textWrap, rotation, filter, splitText, findAndReplace, context.luckysheet_select_save, context.defaultFontSize, context.allowEdit, context.luckysheetPaintModelOn, context.autoRecalc, comment, fontarray, hideSubMenu, showSubMenu, refs.canvas, customColor, customStyle]);
|
|
7718
7739
|
return /*#__PURE__*/React.createElement("div", {
|
|
7719
7740
|
ref: containerRef,
|
|
7720
7741
|
className: "leankylin-toolbar"
|
|
@@ -10192,6 +10213,41 @@ var SVGDefines = function SVGDefines() {
|
|
|
10192
10213
|
d: "M9.58333 4.75V19.25M14.4167 4.75V19.25M4.75 9.58333H19.25M4.75 14.4167H19.25",
|
|
10193
10214
|
stroke: "#525C6F",
|
|
10194
10215
|
strokeWidth: "1.5"
|
|
10216
|
+
})), /*#__PURE__*/React.createElement("symbol", {
|
|
10217
|
+
viewBox: "0 0 24 24",
|
|
10218
|
+
fill: "none",
|
|
10219
|
+
id: "auto-recalc"
|
|
10220
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
10221
|
+
d: "M19 12a7 7 0 1 1-2.05-4.95",
|
|
10222
|
+
stroke: "#525C6F",
|
|
10223
|
+
strokeWidth: "1.5",
|
|
10224
|
+
strokeLinecap: "round"
|
|
10225
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
10226
|
+
d: "M19 4.5V8h-3.5",
|
|
10227
|
+
stroke: "#525C6F",
|
|
10228
|
+
strokeWidth: "1.5",
|
|
10229
|
+
strokeLinecap: "round",
|
|
10230
|
+
strokeLinejoin: "round"
|
|
10231
|
+
})), /*#__PURE__*/React.createElement("symbol", {
|
|
10232
|
+
viewBox: "0 0 24 24",
|
|
10233
|
+
fill: "none",
|
|
10234
|
+
id: "auto-recalc-off"
|
|
10235
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
10236
|
+
d: "M19 12a7 7 0 1 1-2.05-4.95",
|
|
10237
|
+
stroke: "#525C6F",
|
|
10238
|
+
strokeWidth: "1.5",
|
|
10239
|
+
strokeLinecap: "round"
|
|
10240
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
10241
|
+
d: "M19 4.5V8h-3.5",
|
|
10242
|
+
stroke: "#525C6F",
|
|
10243
|
+
strokeWidth: "1.5",
|
|
10244
|
+
strokeLinecap: "round",
|
|
10245
|
+
strokeLinejoin: "round"
|
|
10246
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
10247
|
+
d: "M4.75 4.75L19.25 19.25",
|
|
10248
|
+
stroke: "#525C6F",
|
|
10249
|
+
strokeWidth: "1.5",
|
|
10250
|
+
strokeLinecap: "round"
|
|
10195
10251
|
})), /*#__PURE__*/React.createElement("symbol", {
|
|
10196
10252
|
viewBox: "0 0 24 24",
|
|
10197
10253
|
fill: "none",
|
|
@@ -12373,7 +12429,11 @@ var Workbook = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
12373
12429
|
workbookContainer: workbookContainer
|
|
12374
12430
|
};
|
|
12375
12431
|
}, []);
|
|
12376
|
-
var _useState = useState(
|
|
12432
|
+
var _useState = useState(function () {
|
|
12433
|
+
var initialCtx = defaultContext(refs);
|
|
12434
|
+
initialCtx.autoRecalc = props.autoRecalc !== false;
|
|
12435
|
+
return initialCtx;
|
|
12436
|
+
}),
|
|
12377
12437
|
_useState2 = _slicedToArray(_useState, 2),
|
|
12378
12438
|
context = _useState2[0],
|
|
12379
12439
|
setContext = _useState2[1];
|
|
@@ -12385,6 +12445,7 @@ var Workbook = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
12385
12445
|
var mergedSettings = useMemo(function () {
|
|
12386
12446
|
return _.assign(_.cloneDeep(defaultSettings), props);
|
|
12387
12447
|
}, _toConsumableArray(_.values(props)));
|
|
12448
|
+
var prevAutoRecalcSettingRef = useRef(mergedSettings.autoRecalc);
|
|
12388
12449
|
var initSheetData = useCallback(function (draftCtx, newData, index) {
|
|
12389
12450
|
var _lastRow$r, _lastCol$c;
|
|
12390
12451
|
var celldata = newData.celldata,
|
|
@@ -12664,6 +12725,10 @@ var Workbook = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
12664
12725
|
}
|
|
12665
12726
|
draftCtx.lang = mergedSettings.lang;
|
|
12666
12727
|
draftCtx.allowEdit = mergedSettings.allowEdit;
|
|
12728
|
+
if (prevAutoRecalcSettingRef.current !== mergedSettings.autoRecalc) {
|
|
12729
|
+
prevAutoRecalcSettingRef.current = mergedSettings.autoRecalc;
|
|
12730
|
+
draftCtx.autoRecalc = mergedSettings.autoRecalc !== false;
|
|
12731
|
+
}
|
|
12667
12732
|
draftCtx.showAddSheetButton = mergedSettings.showAddSheetButton;
|
|
12668
12733
|
draftCtx.onAddSheetClick = mergedSettings.onAddSheetClick;
|
|
12669
12734
|
draftCtx.onSheetRename = mergedSettings.onSheetRename;
|
|
@@ -12761,7 +12826,7 @@ var Workbook = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
12761
12826
|
}, {
|
|
12762
12827
|
noHistory: true
|
|
12763
12828
|
});
|
|
12764
|
-
}, [context.currentSheetId, context.luckysheetfile.length, originalData, mergedSettings.defaultRowHeight, mergedSettings.defaultColWidth, mergedSettings.column, mergedSettings.row, mergedSettings.defaultFontSize, mergedSettings.devicePixelRatio, mergedSettings.lang, mergedSettings.allowEdit, mergedSettings.showAddSheetButton, mergedSettings.onAddSheetClick, mergedSettings.onSheetRename, mergedSettings.onSheetDelete, mergedSettings.hooks, mergedSettings.generateSheetId, setContextWithProduce, initSheetData, mergedSettings.rowHeaderWidth, mergedSettings.columnHeaderHeight, mergedSettings.addRows]);
|
|
12829
|
+
}, [context.currentSheetId, context.luckysheetfile.length, originalData, mergedSettings.defaultRowHeight, mergedSettings.defaultColWidth, mergedSettings.column, mergedSettings.row, mergedSettings.defaultFontSize, mergedSettings.devicePixelRatio, mergedSettings.lang, mergedSettings.allowEdit, mergedSettings.autoRecalc, mergedSettings.showAddSheetButton, mergedSettings.onAddSheetClick, mergedSettings.onSheetRename, mergedSettings.onSheetDelete, mergedSettings.hooks, mergedSettings.generateSheetId, setContextWithProduce, initSheetData, mergedSettings.rowHeaderWidth, mergedSettings.columnHeaderHeight, mergedSettings.addRows]);
|
|
12765
12830
|
var onKeyDown = useCallback(function (e) {
|
|
12766
12831
|
var nativeEvent = e.nativeEvent;
|
|
12767
12832
|
if ((e.ctrlKey || e.metaKey) && mergedSettings.disabledKeyboardCodes.includes(e.code)) {
|
package/dist/index.js
CHANGED
|
@@ -6706,6 +6706,7 @@ var Toolbar = function Toolbar(_ref) {
|
|
|
6706
6706
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
6707
6707
|
customStyle = _useState8[0],
|
|
6708
6708
|
setcustomStyle = _useState8[1];
|
|
6709
|
+
var lastBorderTypeRef = React.useRef("border-all");
|
|
6709
6710
|
var showSubMenu = React.useCallback(function (e, className) {
|
|
6710
6711
|
var target = e.target;
|
|
6711
6712
|
var menuItem = target.className === "leankylin-toolbar-menu-line" ? target.parentElement : target;
|
|
@@ -7465,7 +7466,8 @@ var Toolbar = function Toolbar(_ref) {
|
|
|
7465
7466
|
tooltip: tooltip,
|
|
7466
7467
|
text: "\u8FB9\u6846\u8BBE\u7F6E",
|
|
7467
7468
|
onClick: function onClick() {
|
|
7468
|
-
|
|
7469
|
+
lastBorderTypeRef.current = "border-all";
|
|
7470
|
+
setContext(function (ctx) {
|
|
7469
7471
|
core.handleBorder(ctx, "border-all", customColor, customStyle);
|
|
7470
7472
|
});
|
|
7471
7473
|
}
|
|
@@ -7476,6 +7478,7 @@ var Toolbar = function Toolbar(_ref) {
|
|
|
7476
7478
|
return value !== "divider" ? ( /*#__PURE__*/React__default['default'].createElement(Option, {
|
|
7477
7479
|
key: value,
|
|
7478
7480
|
onClick: function onClick() {
|
|
7481
|
+
lastBorderTypeRef.current = value;
|
|
7479
7482
|
setContext(function (ctx) {
|
|
7480
7483
|
core.handleBorder(ctx, value, customColor, customStyle);
|
|
7481
7484
|
});
|
|
@@ -7492,6 +7495,9 @@ var Toolbar = function Toolbar(_ref) {
|
|
|
7492
7495
|
onPick: function onPick(color, style) {
|
|
7493
7496
|
setcustomColor(color);
|
|
7494
7497
|
setcustomStyle(style);
|
|
7498
|
+
setContext(function (ctx) {
|
|
7499
|
+
core.handleBorder(ctx, lastBorderTypeRef.current, color, style);
|
|
7500
|
+
});
|
|
7495
7501
|
}
|
|
7496
7502
|
}));
|
|
7497
7503
|
});
|
|
@@ -7708,6 +7714,21 @@ var Toolbar = function Toolbar(_ref) {
|
|
|
7708
7714
|
}));
|
|
7709
7715
|
});
|
|
7710
7716
|
}
|
|
7717
|
+
if (name === "auto-recalc") {
|
|
7718
|
+
var enabled = context.autoRecalc !== false;
|
|
7719
|
+
return /*#__PURE__*/React__default['default'].createElement(Button, {
|
|
7720
|
+
iconId: enabled ? "auto-recalc" : "auto-recalc-off",
|
|
7721
|
+
tooltip: enabled ? toolbar.autoRecalcOn : toolbar.autoRecalcOff,
|
|
7722
|
+
key: name,
|
|
7723
|
+
onClick: function onClick() {
|
|
7724
|
+
return setContext(function (draftCtx) {
|
|
7725
|
+
core.handleAutoRecalc(draftCtx);
|
|
7726
|
+
}, {
|
|
7727
|
+
noHistory: true
|
|
7728
|
+
});
|
|
7729
|
+
}
|
|
7730
|
+
});
|
|
7731
|
+
}
|
|
7711
7732
|
var selected = (_toolbarItemSelectedF = core.toolbarItemSelectedFunc(name)) === null || _toolbarItemSelectedF === void 0 ? void 0 : _toolbarItemSelectedF(cell);
|
|
7712
7733
|
if (name === "format-painter") {
|
|
7713
7734
|
selected = context.luckysheetPaintModelOn;
|
|
@@ -7724,7 +7745,7 @@ var Toolbar = function Toolbar(_ref) {
|
|
|
7724
7745
|
});
|
|
7725
7746
|
}
|
|
7726
7747
|
});
|
|
7727
|
-
}, [toolbar, cell, setContext, refs.cellInput, refs.fxInput, refs.globalCache, defaultFmt, align, handleUndo, handleRedo, flowdata, formula, showDialog, hideDialog, merge, border, freezen, screenshot, sort, textWrap, rotation, filter, splitText, findAndReplace, context.luckysheet_select_save, context.defaultFontSize, context.allowEdit, context.luckysheetPaintModelOn, comment, fontarray, hideSubMenu, showSubMenu, refs.canvas, customColor, customStyle]);
|
|
7748
|
+
}, [toolbar, cell, setContext, refs.cellInput, refs.fxInput, refs.globalCache, defaultFmt, align, handleUndo, handleRedo, flowdata, formula, showDialog, hideDialog, merge, border, freezen, screenshot, sort, textWrap, rotation, filter, splitText, findAndReplace, context.luckysheet_select_save, context.defaultFontSize, context.allowEdit, context.luckysheetPaintModelOn, context.autoRecalc, comment, fontarray, hideSubMenu, showSubMenu, refs.canvas, customColor, customStyle]);
|
|
7728
7749
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
7729
7750
|
ref: containerRef,
|
|
7730
7751
|
className: "leankylin-toolbar"
|
|
@@ -10202,6 +10223,41 @@ var SVGDefines = function SVGDefines() {
|
|
|
10202
10223
|
d: "M9.58333 4.75V19.25M14.4167 4.75V19.25M4.75 9.58333H19.25M4.75 14.4167H19.25",
|
|
10203
10224
|
stroke: "#525C6F",
|
|
10204
10225
|
strokeWidth: "1.5"
|
|
10226
|
+
})), /*#__PURE__*/React__default['default'].createElement("symbol", {
|
|
10227
|
+
viewBox: "0 0 24 24",
|
|
10228
|
+
fill: "none",
|
|
10229
|
+
id: "auto-recalc"
|
|
10230
|
+
}, /*#__PURE__*/React__default['default'].createElement("path", {
|
|
10231
|
+
d: "M19 12a7 7 0 1 1-2.05-4.95",
|
|
10232
|
+
stroke: "#525C6F",
|
|
10233
|
+
strokeWidth: "1.5",
|
|
10234
|
+
strokeLinecap: "round"
|
|
10235
|
+
}), /*#__PURE__*/React__default['default'].createElement("path", {
|
|
10236
|
+
d: "M19 4.5V8h-3.5",
|
|
10237
|
+
stroke: "#525C6F",
|
|
10238
|
+
strokeWidth: "1.5",
|
|
10239
|
+
strokeLinecap: "round",
|
|
10240
|
+
strokeLinejoin: "round"
|
|
10241
|
+
})), /*#__PURE__*/React__default['default'].createElement("symbol", {
|
|
10242
|
+
viewBox: "0 0 24 24",
|
|
10243
|
+
fill: "none",
|
|
10244
|
+
id: "auto-recalc-off"
|
|
10245
|
+
}, /*#__PURE__*/React__default['default'].createElement("path", {
|
|
10246
|
+
d: "M19 12a7 7 0 1 1-2.05-4.95",
|
|
10247
|
+
stroke: "#525C6F",
|
|
10248
|
+
strokeWidth: "1.5",
|
|
10249
|
+
strokeLinecap: "round"
|
|
10250
|
+
}), /*#__PURE__*/React__default['default'].createElement("path", {
|
|
10251
|
+
d: "M19 4.5V8h-3.5",
|
|
10252
|
+
stroke: "#525C6F",
|
|
10253
|
+
strokeWidth: "1.5",
|
|
10254
|
+
strokeLinecap: "round",
|
|
10255
|
+
strokeLinejoin: "round"
|
|
10256
|
+
}), /*#__PURE__*/React__default['default'].createElement("path", {
|
|
10257
|
+
d: "M4.75 4.75L19.25 19.25",
|
|
10258
|
+
stroke: "#525C6F",
|
|
10259
|
+
strokeWidth: "1.5",
|
|
10260
|
+
strokeLinecap: "round"
|
|
10205
10261
|
})), /*#__PURE__*/React__default['default'].createElement("symbol", {
|
|
10206
10262
|
viewBox: "0 0 24 24",
|
|
10207
10263
|
fill: "none",
|
|
@@ -12383,7 +12439,11 @@ var Workbook = /*#__PURE__*/React__default['default'].forwardRef(function (_ref,
|
|
|
12383
12439
|
workbookContainer: workbookContainer
|
|
12384
12440
|
};
|
|
12385
12441
|
}, []);
|
|
12386
|
-
var _useState = React.useState(
|
|
12442
|
+
var _useState = React.useState(function () {
|
|
12443
|
+
var initialCtx = core.defaultContext(refs);
|
|
12444
|
+
initialCtx.autoRecalc = props.autoRecalc !== false;
|
|
12445
|
+
return initialCtx;
|
|
12446
|
+
}),
|
|
12387
12447
|
_useState2 = _slicedToArray(_useState, 2),
|
|
12388
12448
|
context = _useState2[0],
|
|
12389
12449
|
setContext = _useState2[1];
|
|
@@ -12395,6 +12455,7 @@ var Workbook = /*#__PURE__*/React__default['default'].forwardRef(function (_ref,
|
|
|
12395
12455
|
var mergedSettings = React.useMemo(function () {
|
|
12396
12456
|
return ___default['default'].assign(___default['default'].cloneDeep(core.defaultSettings), props);
|
|
12397
12457
|
}, _toConsumableArray(___default['default'].values(props)));
|
|
12458
|
+
var prevAutoRecalcSettingRef = React.useRef(mergedSettings.autoRecalc);
|
|
12398
12459
|
var initSheetData = React.useCallback(function (draftCtx, newData, index) {
|
|
12399
12460
|
var _lastRow$r, _lastCol$c;
|
|
12400
12461
|
var celldata = newData.celldata,
|
|
@@ -12674,6 +12735,10 @@ var Workbook = /*#__PURE__*/React__default['default'].forwardRef(function (_ref,
|
|
|
12674
12735
|
}
|
|
12675
12736
|
draftCtx.lang = mergedSettings.lang;
|
|
12676
12737
|
draftCtx.allowEdit = mergedSettings.allowEdit;
|
|
12738
|
+
if (prevAutoRecalcSettingRef.current !== mergedSettings.autoRecalc) {
|
|
12739
|
+
prevAutoRecalcSettingRef.current = mergedSettings.autoRecalc;
|
|
12740
|
+
draftCtx.autoRecalc = mergedSettings.autoRecalc !== false;
|
|
12741
|
+
}
|
|
12677
12742
|
draftCtx.showAddSheetButton = mergedSettings.showAddSheetButton;
|
|
12678
12743
|
draftCtx.onAddSheetClick = mergedSettings.onAddSheetClick;
|
|
12679
12744
|
draftCtx.onSheetRename = mergedSettings.onSheetRename;
|
|
@@ -12771,7 +12836,7 @@ var Workbook = /*#__PURE__*/React__default['default'].forwardRef(function (_ref,
|
|
|
12771
12836
|
}, {
|
|
12772
12837
|
noHistory: true
|
|
12773
12838
|
});
|
|
12774
|
-
}, [context.currentSheetId, context.luckysheetfile.length, originalData, mergedSettings.defaultRowHeight, mergedSettings.defaultColWidth, mergedSettings.column, mergedSettings.row, mergedSettings.defaultFontSize, mergedSettings.devicePixelRatio, mergedSettings.lang, mergedSettings.allowEdit, mergedSettings.showAddSheetButton, mergedSettings.onAddSheetClick, mergedSettings.onSheetRename, mergedSettings.onSheetDelete, mergedSettings.hooks, mergedSettings.generateSheetId, setContextWithProduce, initSheetData, mergedSettings.rowHeaderWidth, mergedSettings.columnHeaderHeight, mergedSettings.addRows]);
|
|
12839
|
+
}, [context.currentSheetId, context.luckysheetfile.length, originalData, mergedSettings.defaultRowHeight, mergedSettings.defaultColWidth, mergedSettings.column, mergedSettings.row, mergedSettings.defaultFontSize, mergedSettings.devicePixelRatio, mergedSettings.lang, mergedSettings.allowEdit, mergedSettings.autoRecalc, mergedSettings.showAddSheetButton, mergedSettings.onAddSheetClick, mergedSettings.onSheetRename, mergedSettings.onSheetDelete, mergedSettings.hooks, mergedSettings.generateSheetId, setContextWithProduce, initSheetData, mergedSettings.rowHeaderWidth, mergedSettings.columnHeaderHeight, mergedSettings.addRows]);
|
|
12775
12840
|
var onKeyDown = React.useCallback(function (e) {
|
|
12776
12841
|
var nativeEvent = e.nativeEvent;
|
|
12777
12842
|
if ((e.ctrlKey || e.metaKey) && mergedSettings.disabledKeyboardCodes.includes(e.code)) {
|
package/dist/index.umd.js
CHANGED
|
@@ -25780,6 +25780,7 @@
|
|
|
25780
25780
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
25781
25781
|
customStyle = _useState8[0],
|
|
25782
25782
|
setcustomStyle = _useState8[1];
|
|
25783
|
+
var lastBorderTypeRef = React.useRef("border-all");
|
|
25783
25784
|
var showSubMenu = React.useCallback(function (e, className) {
|
|
25784
25785
|
var target = e.target;
|
|
25785
25786
|
var menuItem = target.className === "leankylin-toolbar-menu-line" ? target.parentElement : target;
|
|
@@ -26539,7 +26540,8 @@
|
|
|
26539
26540
|
tooltip: tooltip,
|
|
26540
26541
|
text: "\u8FB9\u6846\u8BBE\u7F6E",
|
|
26541
26542
|
onClick: function onClick() {
|
|
26542
|
-
|
|
26543
|
+
lastBorderTypeRef.current = "border-all";
|
|
26544
|
+
setContext(function (ctx) {
|
|
26543
26545
|
core.handleBorder(ctx, "border-all", customColor, customStyle);
|
|
26544
26546
|
});
|
|
26545
26547
|
}
|
|
@@ -26550,6 +26552,7 @@
|
|
|
26550
26552
|
return value !== "divider" ? ( /*#__PURE__*/React__default['default'].createElement(Option, {
|
|
26551
26553
|
key: value,
|
|
26552
26554
|
onClick: function onClick() {
|
|
26555
|
+
lastBorderTypeRef.current = value;
|
|
26553
26556
|
setContext(function (ctx) {
|
|
26554
26557
|
core.handleBorder(ctx, value, customColor, customStyle);
|
|
26555
26558
|
});
|
|
@@ -26566,6 +26569,9 @@
|
|
|
26566
26569
|
onPick: function onPick(color, style) {
|
|
26567
26570
|
setcustomColor(color);
|
|
26568
26571
|
setcustomStyle(style);
|
|
26572
|
+
setContext(function (ctx) {
|
|
26573
|
+
core.handleBorder(ctx, lastBorderTypeRef.current, color, style);
|
|
26574
|
+
});
|
|
26569
26575
|
}
|
|
26570
26576
|
}));
|
|
26571
26577
|
});
|
|
@@ -26782,6 +26788,21 @@
|
|
|
26782
26788
|
}));
|
|
26783
26789
|
});
|
|
26784
26790
|
}
|
|
26791
|
+
if (name === "auto-recalc") {
|
|
26792
|
+
var enabled = context.autoRecalc !== false;
|
|
26793
|
+
return /*#__PURE__*/React__default['default'].createElement(Button, {
|
|
26794
|
+
iconId: enabled ? "auto-recalc" : "auto-recalc-off",
|
|
26795
|
+
tooltip: enabled ? toolbar.autoRecalcOn : toolbar.autoRecalcOff,
|
|
26796
|
+
key: name,
|
|
26797
|
+
onClick: function onClick() {
|
|
26798
|
+
return setContext(function (draftCtx) {
|
|
26799
|
+
core.handleAutoRecalc(draftCtx);
|
|
26800
|
+
}, {
|
|
26801
|
+
noHistory: true
|
|
26802
|
+
});
|
|
26803
|
+
}
|
|
26804
|
+
});
|
|
26805
|
+
}
|
|
26785
26806
|
var selected = (_toolbarItemSelectedF = core.toolbarItemSelectedFunc(name)) === null || _toolbarItemSelectedF === void 0 ? void 0 : _toolbarItemSelectedF(cell);
|
|
26786
26807
|
if (name === "format-painter") {
|
|
26787
26808
|
selected = context.luckysheetPaintModelOn;
|
|
@@ -26798,7 +26819,7 @@
|
|
|
26798
26819
|
});
|
|
26799
26820
|
}
|
|
26800
26821
|
});
|
|
26801
|
-
}, [toolbar, cell, setContext, refs.cellInput, refs.fxInput, refs.globalCache, defaultFmt, align, handleUndo, handleRedo, flowdata, formula, showDialog, hideDialog, merge, border, freezen, screenshot, sort, textWrap, rotation, filter, splitText, findAndReplace, context.luckysheet_select_save, context.defaultFontSize, context.allowEdit, context.luckysheetPaintModelOn, comment, fontarray, hideSubMenu, showSubMenu, refs.canvas, customColor, customStyle]);
|
|
26822
|
+
}, [toolbar, cell, setContext, refs.cellInput, refs.fxInput, refs.globalCache, defaultFmt, align, handleUndo, handleRedo, flowdata, formula, showDialog, hideDialog, merge, border, freezen, screenshot, sort, textWrap, rotation, filter, splitText, findAndReplace, context.luckysheet_select_save, context.defaultFontSize, context.allowEdit, context.luckysheetPaintModelOn, context.autoRecalc, comment, fontarray, hideSubMenu, showSubMenu, refs.canvas, customColor, customStyle]);
|
|
26802
26823
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
26803
26824
|
ref: containerRef,
|
|
26804
26825
|
className: "leankylin-toolbar"
|
|
@@ -29276,6 +29297,41 @@
|
|
|
29276
29297
|
d: "M9.58333 4.75V19.25M14.4167 4.75V19.25M4.75 9.58333H19.25M4.75 14.4167H19.25",
|
|
29277
29298
|
stroke: "#525C6F",
|
|
29278
29299
|
strokeWidth: "1.5"
|
|
29300
|
+
})), /*#__PURE__*/React__default['default'].createElement("symbol", {
|
|
29301
|
+
viewBox: "0 0 24 24",
|
|
29302
|
+
fill: "none",
|
|
29303
|
+
id: "auto-recalc"
|
|
29304
|
+
}, /*#__PURE__*/React__default['default'].createElement("path", {
|
|
29305
|
+
d: "M19 12a7 7 0 1 1-2.05-4.95",
|
|
29306
|
+
stroke: "#525C6F",
|
|
29307
|
+
strokeWidth: "1.5",
|
|
29308
|
+
strokeLinecap: "round"
|
|
29309
|
+
}), /*#__PURE__*/React__default['default'].createElement("path", {
|
|
29310
|
+
d: "M19 4.5V8h-3.5",
|
|
29311
|
+
stroke: "#525C6F",
|
|
29312
|
+
strokeWidth: "1.5",
|
|
29313
|
+
strokeLinecap: "round",
|
|
29314
|
+
strokeLinejoin: "round"
|
|
29315
|
+
})), /*#__PURE__*/React__default['default'].createElement("symbol", {
|
|
29316
|
+
viewBox: "0 0 24 24",
|
|
29317
|
+
fill: "none",
|
|
29318
|
+
id: "auto-recalc-off"
|
|
29319
|
+
}, /*#__PURE__*/React__default['default'].createElement("path", {
|
|
29320
|
+
d: "M19 12a7 7 0 1 1-2.05-4.95",
|
|
29321
|
+
stroke: "#525C6F",
|
|
29322
|
+
strokeWidth: "1.5",
|
|
29323
|
+
strokeLinecap: "round"
|
|
29324
|
+
}), /*#__PURE__*/React__default['default'].createElement("path", {
|
|
29325
|
+
d: "M19 4.5V8h-3.5",
|
|
29326
|
+
stroke: "#525C6F",
|
|
29327
|
+
strokeWidth: "1.5",
|
|
29328
|
+
strokeLinecap: "round",
|
|
29329
|
+
strokeLinejoin: "round"
|
|
29330
|
+
}), /*#__PURE__*/React__default['default'].createElement("path", {
|
|
29331
|
+
d: "M4.75 4.75L19.25 19.25",
|
|
29332
|
+
stroke: "#525C6F",
|
|
29333
|
+
strokeWidth: "1.5",
|
|
29334
|
+
strokeLinecap: "round"
|
|
29279
29335
|
})), /*#__PURE__*/React__default['default'].createElement("symbol", {
|
|
29280
29336
|
viewBox: "0 0 24 24",
|
|
29281
29337
|
fill: "none",
|
|
@@ -31457,7 +31513,11 @@
|
|
|
31457
31513
|
workbookContainer: workbookContainer
|
|
31458
31514
|
};
|
|
31459
31515
|
}, []);
|
|
31460
|
-
var _useState = React.useState(
|
|
31516
|
+
var _useState = React.useState(function () {
|
|
31517
|
+
var initialCtx = core.defaultContext(refs);
|
|
31518
|
+
initialCtx.autoRecalc = props.autoRecalc !== false;
|
|
31519
|
+
return initialCtx;
|
|
31520
|
+
}),
|
|
31461
31521
|
_useState2 = _slicedToArray(_useState, 2),
|
|
31462
31522
|
context = _useState2[0],
|
|
31463
31523
|
setContext = _useState2[1];
|
|
@@ -31469,6 +31529,7 @@
|
|
|
31469
31529
|
var mergedSettings = React.useMemo(function () {
|
|
31470
31530
|
return lodash.assign(lodash.cloneDeep(core.defaultSettings), props);
|
|
31471
31531
|
}, _toConsumableArray(lodash.values(props)));
|
|
31532
|
+
var prevAutoRecalcSettingRef = React.useRef(mergedSettings.autoRecalc);
|
|
31472
31533
|
var initSheetData = React.useCallback(function (draftCtx, newData, index) {
|
|
31473
31534
|
var _lastRow$r, _lastCol$c;
|
|
31474
31535
|
var celldata = newData.celldata,
|
|
@@ -31748,6 +31809,10 @@
|
|
|
31748
31809
|
}
|
|
31749
31810
|
draftCtx.lang = mergedSettings.lang;
|
|
31750
31811
|
draftCtx.allowEdit = mergedSettings.allowEdit;
|
|
31812
|
+
if (prevAutoRecalcSettingRef.current !== mergedSettings.autoRecalc) {
|
|
31813
|
+
prevAutoRecalcSettingRef.current = mergedSettings.autoRecalc;
|
|
31814
|
+
draftCtx.autoRecalc = mergedSettings.autoRecalc !== false;
|
|
31815
|
+
}
|
|
31751
31816
|
draftCtx.showAddSheetButton = mergedSettings.showAddSheetButton;
|
|
31752
31817
|
draftCtx.onAddSheetClick = mergedSettings.onAddSheetClick;
|
|
31753
31818
|
draftCtx.onSheetRename = mergedSettings.onSheetRename;
|
|
@@ -31845,7 +31910,7 @@
|
|
|
31845
31910
|
}, {
|
|
31846
31911
|
noHistory: true
|
|
31847
31912
|
});
|
|
31848
|
-
}, [context.currentSheetId, context.luckysheetfile.length, originalData, mergedSettings.defaultRowHeight, mergedSettings.defaultColWidth, mergedSettings.column, mergedSettings.row, mergedSettings.defaultFontSize, mergedSettings.devicePixelRatio, mergedSettings.lang, mergedSettings.allowEdit, mergedSettings.showAddSheetButton, mergedSettings.onAddSheetClick, mergedSettings.onSheetRename, mergedSettings.onSheetDelete, mergedSettings.hooks, mergedSettings.generateSheetId, setContextWithProduce, initSheetData, mergedSettings.rowHeaderWidth, mergedSettings.columnHeaderHeight, mergedSettings.addRows]);
|
|
31913
|
+
}, [context.currentSheetId, context.luckysheetfile.length, originalData, mergedSettings.defaultRowHeight, mergedSettings.defaultColWidth, mergedSettings.column, mergedSettings.row, mergedSettings.defaultFontSize, mergedSettings.devicePixelRatio, mergedSettings.lang, mergedSettings.allowEdit, mergedSettings.autoRecalc, mergedSettings.showAddSheetButton, mergedSettings.onAddSheetClick, mergedSettings.onSheetRename, mergedSettings.onSheetDelete, mergedSettings.hooks, mergedSettings.generateSheetId, setContextWithProduce, initSheetData, mergedSettings.rowHeaderWidth, mergedSettings.columnHeaderHeight, mergedSettings.addRows]);
|
|
31849
31914
|
var onKeyDown = React.useCallback(function (e) {
|
|
31850
31915
|
var nativeEvent = e.nativeEvent;
|
|
31851
31916
|
if ((e.ctrlKey || e.metaKey) && mergedSettings.disabledKeyboardCodes.includes(e.code)) {
|