@fileverse-dev/fortune-react 1.0.2-mod-10 → 1.0.2-mod-11-test
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 +7 -2
- package/dist/components/Workbook/index.d.ts +7 -2
- package/dist/index.css +26 -1
- package/dist/index.esm.css +26 -1
- package/dist/index.esm.js +269 -108
- package/dist/index.js +268 -107
- package/dist/index.umd.css +26 -1
- package/dist/index.umd.js +281 -117
- package/dist/index.umd.min.css +1 -1
- package/dist/index.umd.min.js +2 -2
- package/package.json +2 -2
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, onCommentBoxResizeStart, 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,
|
|
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, onCommentBoxResizeStart, confirmMessage, getRangeByTxt, getDropdownList, setCellValue, setConditionRules, mergeBorder, setDropcownValue, handleCellAreaMouseDown, handleCellAreaDoubleClick, selectAll, showLinkCard, getCellRowColumn, getCellHyperlink, handleOverlayMouseMove, handleOverlayMouseUp, handleKeydownForZoom, handleOverlayTouchStart, handleOverlayTouchMove, handleOverlayTouchEnd, insertRowCol, api, 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, removeActiveImage, deleteSelectedCellText, jfrefreshgrid, handleLink, handlePasteByClick, deleteSheet, opToPatch, orderbydatafiler, getFilterColumnValues, getFilterColumnColors, saveFilter, calcSelectionInfo, patchToOp, filterPatch, inverseRowColOptions, ensureSheetIndex, setFormulaCellInfoMap, 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';
|
|
@@ -629,7 +629,7 @@ var ColumnHeader = function ColumnHeader() {
|
|
|
629
629
|
className: "fortune-cols-freeze-handle",
|
|
630
630
|
onMouseDown: onColFreezeHandleMouseDown,
|
|
631
631
|
style: {
|
|
632
|
-
left: freezeHandleLeft
|
|
632
|
+
left: freezeHandleLeft || 0
|
|
633
633
|
}
|
|
634
634
|
}), /*#__PURE__*/React.createElement("div", {
|
|
635
635
|
className: "fortune-cols-change-size",
|
|
@@ -832,7 +832,7 @@ var RowHeader = function RowHeader() {
|
|
|
832
832
|
className: "fortune-rows-freeze-handle",
|
|
833
833
|
onMouseDown: onRowFreezeHandleMouseDown,
|
|
834
834
|
style: {
|
|
835
|
-
top: freezeHandleTop
|
|
835
|
+
top: freezeHandleTop || 0
|
|
836
836
|
}
|
|
837
837
|
}), /*#__PURE__*/React.createElement("div", {
|
|
838
838
|
className: "fortune-rows-change-size",
|
|
@@ -1239,7 +1239,7 @@ var InputBox = function InputBox() {
|
|
|
1239
1239
|
}
|
|
1240
1240
|
e.preventDefault();
|
|
1241
1241
|
}
|
|
1242
|
-
}, [clearSearchItemActiveClass, context.luckysheetCellUpdate.length, selectActiveFormula, setContext
|
|
1242
|
+
}, [clearSearchItemActiveClass, context.luckysheetCellUpdate.length, selectActiveFormula, setContext]);
|
|
1243
1243
|
var onChange = useCallback(function (__, isBlur) {
|
|
1244
1244
|
var e = lastKeyDownEventRef.current;
|
|
1245
1245
|
if (!e) return;
|
|
@@ -1285,8 +1285,8 @@ var InputBox = function InputBox() {
|
|
|
1285
1285
|
}, /*#__PURE__*/React.createElement("div", {
|
|
1286
1286
|
className: "luckysheet-input-box-inner",
|
|
1287
1287
|
style: firstSelection ? _objectSpread2({
|
|
1288
|
-
minWidth: firstSelection.width,
|
|
1289
|
-
minHeight: firstSelection.height
|
|
1288
|
+
minWidth: (firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.width) || 0,
|
|
1289
|
+
minHeight: (firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.height) || 0
|
|
1290
1290
|
}, inputBoxStyle) : {}
|
|
1291
1291
|
}, /*#__PURE__*/React.createElement(ContentEditable, {
|
|
1292
1292
|
innerRef: function innerRef(e) {
|
|
@@ -1301,7 +1301,6 @@ var InputBox = function InputBox() {
|
|
|
1301
1301
|
width: "".concat(100 / context.zoomRatio, "%"),
|
|
1302
1302
|
height: "".concat(100 / context.zoomRatio, "%")
|
|
1303
1303
|
},
|
|
1304
|
-
"aria-autocomplete": "list",
|
|
1305
1304
|
onChange: onChange,
|
|
1306
1305
|
onKeyDown: onKeyDown,
|
|
1307
1306
|
onPaste: onPaste,
|
|
@@ -2570,7 +2569,7 @@ var DataVerification = function DataVerification() {
|
|
|
2570
2569
|
setContext(function (ctx) {
|
|
2571
2570
|
var isPass = confirmMessage(ctx, generalDialog, dataVerification);
|
|
2572
2571
|
if (isPass) {
|
|
2573
|
-
var _ctx$dataVerification, _ctx$dataVerification2, _ctx$luckysheetfile$g;
|
|
2572
|
+
var _ctx$dataVerification, _ctx$dataVerification2, _ctx$luckysheetfile$g, _range, _range2, _range3, _range4;
|
|
2574
2573
|
var range = getRangeByTxt(ctx, (_ctx$dataVerification = ctx.dataVerification) === null || _ctx$dataVerification === void 0 ? void 0 : (_ctx$dataVerification2 = _ctx$dataVerification.dataRegulation) === null || _ctx$dataVerification2 === void 0 ? void 0 : _ctx$dataVerification2.rangeTxt);
|
|
2575
2574
|
if (range.length === 0) {
|
|
2576
2575
|
return;
|
|
@@ -2586,12 +2585,12 @@ var DataVerification = function DataVerification() {
|
|
|
2586
2585
|
item.value1 = list.join(",");
|
|
2587
2586
|
}
|
|
2588
2587
|
var currentDataVerification = (_ctx$luckysheetfile$g = ctx.luckysheetfile[getSheetIndex(ctx, ctx.currentSheetId)].dataVerification) !== null && _ctx$luckysheetfile$g !== void 0 ? _ctx$luckysheetfile$g : {};
|
|
2589
|
-
var str = range[range.length - 1].row[0];
|
|
2590
|
-
var edr = range[range.length - 1].row[1];
|
|
2591
|
-
var stc = range[range.length - 1].column[0];
|
|
2592
|
-
var edc = range[range.length - 1].column[1];
|
|
2588
|
+
var str = (_range = range[range.length - 1]) === null || _range === void 0 ? void 0 : _range.row[0];
|
|
2589
|
+
var edr = (_range2 = range[range.length - 1]) === null || _range2 === void 0 ? void 0 : _range2.row[1];
|
|
2590
|
+
var stc = (_range3 = range[range.length - 1]) === null || _range3 === void 0 ? void 0 : _range3.column[0];
|
|
2591
|
+
var edc = (_range4 = range[range.length - 1]) === null || _range4 === void 0 ? void 0 : _range4.column[1];
|
|
2593
2592
|
var d = getFlowdata(ctx);
|
|
2594
|
-
if (!d) return;
|
|
2593
|
+
if (!d || _.isNil(str) || _.isNil(stc) || _.isNil(edr) || _.isNil(edc)) return;
|
|
2595
2594
|
for (var r = str; r <= edr; r += 1) {
|
|
2596
2595
|
for (var c = stc; c <= edc; c += 1) {
|
|
2597
2596
|
var key = "".concat(r, "_").concat(c);
|
|
@@ -2606,17 +2605,18 @@ var DataVerification = function DataVerification() {
|
|
|
2606
2605
|
});
|
|
2607
2606
|
} else if (type === "delete") {
|
|
2608
2607
|
setContext(function (ctx) {
|
|
2609
|
-
var _ctx$dataVerification3, _ctx$dataVerification4, _ctx$luckysheetfile$g2;
|
|
2608
|
+
var _ctx$dataVerification3, _ctx$dataVerification4, _ctx$luckysheetfile$g2, _range5, _range6, _range7, _range8;
|
|
2610
2609
|
var range = getRangeByTxt(ctx, (_ctx$dataVerification3 = ctx.dataVerification) === null || _ctx$dataVerification3 === void 0 ? void 0 : (_ctx$dataVerification4 = _ctx$dataVerification3.dataRegulation) === null || _ctx$dataVerification4 === void 0 ? void 0 : _ctx$dataVerification4.rangeTxt);
|
|
2611
2610
|
if (range.length === 0) {
|
|
2612
2611
|
showDialog(generalDialog.noSeletionError, "ok");
|
|
2613
2612
|
return;
|
|
2614
2613
|
}
|
|
2615
2614
|
var currentDataVerification = (_ctx$luckysheetfile$g2 = ctx.luckysheetfile[getSheetIndex(ctx, ctx.currentSheetId)].dataVerification) !== null && _ctx$luckysheetfile$g2 !== void 0 ? _ctx$luckysheetfile$g2 : {};
|
|
2616
|
-
var str = range[range.length - 1].row[0];
|
|
2617
|
-
var edr = range[range.length - 1].row[1];
|
|
2618
|
-
var stc = range[range.length - 1].column[0];
|
|
2619
|
-
var edc = range[range.length - 1].column[1];
|
|
2615
|
+
var str = (_range5 = range[range.length - 1]) === null || _range5 === void 0 ? void 0 : _range5.row[0];
|
|
2616
|
+
var edr = (_range6 = range[range.length - 1]) === null || _range6 === void 0 ? void 0 : _range6.row[1];
|
|
2617
|
+
var stc = (_range7 = range[range.length - 1]) === null || _range7 === void 0 ? void 0 : _range7.column[0];
|
|
2618
|
+
var edc = (_range8 = range[range.length - 1]) === null || _range8 === void 0 ? void 0 : _range8.column[1];
|
|
2619
|
+
if (_.isNil(str) || _.isNil(stc) || _.isNil(edr) || _.isNil(edc)) return;
|
|
2620
2620
|
for (var r = str; r <= edr; r += 1) {
|
|
2621
2621
|
for (var c = stc; c <= edc; c += 1) {
|
|
2622
2622
|
delete currentDataVerification["".concat(r, "_").concat(c)];
|
|
@@ -2628,56 +2628,41 @@ var DataVerification = function DataVerification() {
|
|
|
2628
2628
|
}, [dataVerification, generalDialog, hideDialog, setContext, showDialog]);
|
|
2629
2629
|
useEffect(function () {
|
|
2630
2630
|
setContext(function (ctx) {
|
|
2631
|
+
var _defaultItem$value, _ctx$rangeDialog, _ctx$rangeDialog2;
|
|
2631
2632
|
var rangeT = "";
|
|
2632
2633
|
if (ctx.luckysheet_select_save) {
|
|
2633
2634
|
var range = ctx.luckysheet_select_save[ctx.luckysheet_select_save.length - 1];
|
|
2634
2635
|
rangeT = getRangetxt(context, context.currentSheetId, range, context.currentSheetId);
|
|
2635
2636
|
}
|
|
2636
2637
|
var index = getSheetIndex(ctx, ctx.currentSheetId);
|
|
2637
|
-
var ctxDataVerification = ctx.luckysheetfile[index].dataVerification;
|
|
2638
|
-
if (
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
ctx.
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
rangeTxt: rangeT
|
|
2660
|
-
});
|
|
2661
|
-
} else {
|
|
2662
|
-
ctx.dataVerification.dataRegulation = {
|
|
2663
|
-
type: "dropdown",
|
|
2664
|
-
type2: "",
|
|
2665
|
-
rangeTxt: rangeT,
|
|
2666
|
-
value1: rangValue,
|
|
2667
|
-
value2: "",
|
|
2668
|
-
validity: "",
|
|
2669
|
-
remote: false,
|
|
2670
|
-
prohibitInput: false,
|
|
2671
|
-
hintShow: false,
|
|
2672
|
-
hintValue: ""
|
|
2673
|
-
};
|
|
2674
|
-
}
|
|
2638
|
+
var ctxDataVerification = ctx.luckysheetfile[index].dataVerification || {};
|
|
2639
|
+
if (!ctx.luckysheet_select_save) return;
|
|
2640
|
+
var last = ctx.luckysheet_select_save[ctx.luckysheet_select_save.length - 1];
|
|
2641
|
+
var rowIndex = last.row_focus;
|
|
2642
|
+
var colIndex = last.column_focus;
|
|
2643
|
+
if (rowIndex == null || colIndex == null) return;
|
|
2644
|
+
var item = ctxDataVerification["".concat(rowIndex, "_").concat(colIndex)];
|
|
2645
|
+
var defaultItem = item !== null && item !== void 0 ? item : {};
|
|
2646
|
+
var rangValue = (_defaultItem$value = defaultItem.value1) !== null && _defaultItem$value !== void 0 ? _defaultItem$value : "";
|
|
2647
|
+
if (((_ctx$rangeDialog = ctx.rangeDialog) === null || _ctx$rangeDialog === void 0 ? void 0 : _ctx$rangeDialog.type) === "dropDown" && ctx.dataVerification && ctx.dataVerification.dataRegulation && ctx.dataVerification.dataRegulation.rangeTxt) {
|
|
2648
|
+
rangeT = ctx.dataVerification.dataRegulation.rangeTxt;
|
|
2649
|
+
rangValue = ctx.rangeDialog.rangeTxt;
|
|
2650
|
+
} else if (((_ctx$rangeDialog2 = ctx.rangeDialog) === null || _ctx$rangeDialog2 === void 0 ? void 0 : _ctx$rangeDialog2.type) === "rangeTxt" && ctx.dataVerification && ctx.dataVerification.dataRegulation && ctx.dataVerification.dataRegulation.value1) {
|
|
2651
|
+
rangValue = ctx.dataVerification.dataRegulation.value1;
|
|
2652
|
+
rangeT = ctx.rangeDialog.rangeTxt;
|
|
2653
|
+
}
|
|
2654
|
+
ctx.rangeDialog.type = "";
|
|
2655
|
+
if (item) {
|
|
2656
|
+
ctx.dataVerification.dataRegulation = _objectSpread2(_objectSpread2({}, item), {}, {
|
|
2657
|
+
value1: rangValue,
|
|
2658
|
+
rangeTxt: rangeT
|
|
2659
|
+
});
|
|
2675
2660
|
} else {
|
|
2676
2661
|
ctx.dataVerification.dataRegulation = {
|
|
2677
2662
|
type: "dropdown",
|
|
2678
2663
|
type2: "",
|
|
2679
2664
|
rangeTxt: rangeT,
|
|
2680
|
-
value1:
|
|
2665
|
+
value1: rangValue,
|
|
2681
2666
|
value2: "",
|
|
2682
2667
|
validity: "",
|
|
2683
2668
|
remote: false,
|
|
@@ -3521,7 +3506,7 @@ var DropDownList = function DropDownList() {
|
|
|
3521
3506
|
};
|
|
3522
3507
|
|
|
3523
3508
|
var SheetOverlay = function SheetOverlay() {
|
|
3524
|
-
var _refs$cellArea$curren, _refs$cellArea$curren2, _context$
|
|
3509
|
+
var _refs$cellArea$curren, _refs$cellArea$curren2, _context$luckysheet_s4, _context$luckysheet_s5, _context$luckysheet_s6, _context$luckysheet_s7, _context$luckysheet_s8, _context$luckysheet_s9, _context$presences$le, _context$presences, _context$linkCard, _context$rangeDialog;
|
|
3525
3510
|
var _useContext = useContext(WorkbookContext),
|
|
3526
3511
|
context = _useContext.context,
|
|
3527
3512
|
setContext = _useContext.setContext,
|
|
@@ -3535,6 +3520,14 @@ var SheetOverlay = function SheetOverlay() {
|
|
|
3535
3520
|
var containerRef = useRef(null);
|
|
3536
3521
|
var bottomAddRowInputRef = useRef(null);
|
|
3537
3522
|
var dataVerificationHintBoxRef = useRef(null);
|
|
3523
|
+
var _useState = useState(""),
|
|
3524
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
3525
|
+
lastRangeText = _useState2[0],
|
|
3526
|
+
setLastRangeText = _useState2[1];
|
|
3527
|
+
var _useState3 = useState(""),
|
|
3528
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
3529
|
+
lastCellValue = _useState4[0],
|
|
3530
|
+
setLastCellValue = _useState4[1];
|
|
3538
3531
|
var _useAlert = useAlert(),
|
|
3539
3532
|
showAlert = _useAlert.showAlert;
|
|
3540
3533
|
var cellAreaMouseDown = useCallback(function (e) {
|
|
@@ -3657,6 +3650,20 @@ var SheetOverlay = function SheetOverlay() {
|
|
|
3657
3650
|
insertRowColOp: insertRowColOp
|
|
3658
3651
|
});
|
|
3659
3652
|
}, [context, rightclick.rowOverLimit, setContext, showAlert]);
|
|
3653
|
+
useEffect(function () {
|
|
3654
|
+
setContext(function (draftCtx) {
|
|
3655
|
+
var _currentSheet$luckysh;
|
|
3656
|
+
var sheetIndex = getSheetIndex(draftCtx, draftCtx.currentSheetId);
|
|
3657
|
+
if (sheetIndex === undefined || sheetIndex === null) return;
|
|
3658
|
+
var currentSheet = draftCtx.luckysheetfile[sheetIndex];
|
|
3659
|
+
if (!((_currentSheet$luckysh = currentSheet.luckysheet_select_save) === null || _currentSheet$luckysh === void 0 ? void 0 : _currentSheet$luckysh.length)) {
|
|
3660
|
+
api.setSelection(draftCtx, [{
|
|
3661
|
+
row: [0],
|
|
3662
|
+
column: [0]
|
|
3663
|
+
}], {});
|
|
3664
|
+
}
|
|
3665
|
+
});
|
|
3666
|
+
}, [context.currentSheetId, setContext]);
|
|
3660
3667
|
useEffect(function () {
|
|
3661
3668
|
if (context.warnDialog) {
|
|
3662
3669
|
setTimeout(function () {
|
|
@@ -3699,7 +3706,43 @@ var SheetOverlay = function SheetOverlay() {
|
|
|
3699
3706
|
document.removeEventListener("keydown", onKeyDownForZoom);
|
|
3700
3707
|
};
|
|
3701
3708
|
}, [onKeyDownForZoom]);
|
|
3702
|
-
|
|
3709
|
+
var rangeText = useMemo(function () {
|
|
3710
|
+
var lastSelection = _.last(context.luckysheet_select_save);
|
|
3711
|
+
if (!(lastSelection && lastSelection.row_focus != null && lastSelection.column_focus != null)) return "";
|
|
3712
|
+
var rf = lastSelection.row_focus;
|
|
3713
|
+
var cf = lastSelection.column_focus;
|
|
3714
|
+
if (context.config.merge != null && "".concat(rf, "_").concat(cf) in context.config.merge) {
|
|
3715
|
+
return getRangetxt(context, context.currentSheetId, {
|
|
3716
|
+
column: [cf, cf],
|
|
3717
|
+
row: [rf, rf]
|
|
3718
|
+
});
|
|
3719
|
+
}
|
|
3720
|
+
var rawRangeTxt = getRangetxt(context, context.currentSheetId, lastSelection);
|
|
3721
|
+
return rawRangeTxt.replace(/([A-Z]+)(\d+)/g, "$1. $2");
|
|
3722
|
+
}, [context.currentSheetId, context.luckysheet_select_save]);
|
|
3723
|
+
var cellValue = function cellValue() {
|
|
3724
|
+
var _context$luckysheet_s, _context$luckysheet_s2;
|
|
3725
|
+
if (((_context$luckysheet_s = (_context$luckysheet_s2 = context.luckysheet_select_save) === null || _context$luckysheet_s2 === void 0 ? void 0 : _context$luckysheet_s2.length) !== null && _context$luckysheet_s !== void 0 ? _context$luckysheet_s : 0) > 0) {
|
|
3726
|
+
var _context$luckysheet_s3, _selection$row_focus, _selection$column_foc, _context$luckysheetfi, _context$luckysheetfi2, _context$luckysheetfi3, _context$luckysheetfi4;
|
|
3727
|
+
var selection = (_context$luckysheet_s3 = context.luckysheet_select_save) === null || _context$luckysheet_s3 === void 0 ? void 0 : _context$luckysheet_s3[context.luckysheet_select_save.length - 1];
|
|
3728
|
+
if (!selection) return "";
|
|
3729
|
+
var sheetIndex = getSheetIndex(context, context.currentSheetId);
|
|
3730
|
+
if (sheetIndex === undefined || sheetIndex === null) return "";
|
|
3731
|
+
var rowFocus = (_selection$row_focus = selection.row_focus) !== null && _selection$row_focus !== void 0 ? _selection$row_focus : 0;
|
|
3732
|
+
var columnFocus = (_selection$column_foc = selection.column_focus) !== null && _selection$column_foc !== void 0 ? _selection$column_foc : 0;
|
|
3733
|
+
var cellVal = ((_context$luckysheetfi = context.luckysheetfile[sheetIndex]) === null || _context$luckysheetfi === void 0 ? void 0 : (_context$luckysheetfi2 = _context$luckysheetfi.data) === null || _context$luckysheetfi2 === void 0 ? void 0 : (_context$luckysheetfi3 = _context$luckysheetfi2[rowFocus]) === null || _context$luckysheetfi3 === void 0 ? void 0 : (_context$luckysheetfi4 = _context$luckysheetfi3[columnFocus]) === null || _context$luckysheetfi4 === void 0 ? void 0 : _context$luckysheetfi4.m) || "";
|
|
3734
|
+
return cellVal;
|
|
3735
|
+
}
|
|
3736
|
+
return "";
|
|
3737
|
+
};
|
|
3738
|
+
var computedCellValue = cellValue();
|
|
3739
|
+
useEffect(function () {
|
|
3740
|
+
if (context.sheetFocused) {
|
|
3741
|
+
setLastRangeText(String(rangeText));
|
|
3742
|
+
setLastCellValue(String(cellValue()));
|
|
3743
|
+
}
|
|
3744
|
+
}, [context.sheetFocused]);
|
|
3745
|
+
return /*#__PURE__*/React.createElement("main", {
|
|
3703
3746
|
className: "fortune-sheet-overlay",
|
|
3704
3747
|
ref: containerRef,
|
|
3705
3748
|
onTouchStart: onTouchStart,
|
|
@@ -3802,20 +3845,20 @@ var SheetOverlay = function SheetOverlay() {
|
|
|
3802
3845
|
hidden: !context.luckysheet_cols_freeze_drag && !context.luckysheet_rows_freeze_drag
|
|
3803
3846
|
}), /*#__PURE__*/React.createElement("div", {
|
|
3804
3847
|
className: "luckysheet-cell-selected-focus",
|
|
3805
|
-
style: ((_context$
|
|
3848
|
+
style: ((_context$luckysheet_s4 = (_context$luckysheet_s5 = context.luckysheet_select_save) === null || _context$luckysheet_s5 === void 0 ? void 0 : _context$luckysheet_s5.length) !== null && _context$luckysheet_s4 !== void 0 ? _context$luckysheet_s4 : 0) > 0 ? function (_refs$globalCache$fre, _refs$globalCache$fre2) {
|
|
3806
3849
|
var selection = _.last(context.luckysheet_select_save);
|
|
3807
3850
|
return _.assign({
|
|
3808
3851
|
left: selection.left,
|
|
3809
3852
|
top: selection.top,
|
|
3810
|
-
width: selection.width,
|
|
3811
|
-
height: selection.height,
|
|
3853
|
+
width: (selection === null || selection === void 0 ? void 0 : selection.width) || 0,
|
|
3854
|
+
height: (selection === null || selection === void 0 ? void 0 : selection.height) || 0,
|
|
3812
3855
|
display: "block"
|
|
3813
3856
|
}, fixRowStyleOverflowInFreeze(context, selection.row_focus || 0, selection.row_focus || 0, (_refs$globalCache$fre = refs.globalCache.freezen) === null || _refs$globalCache$fre === void 0 ? void 0 : _refs$globalCache$fre[context.currentSheetId]), fixColumnStyleOverflowInFreeze(context, selection.column_focus || 0, selection.column_focus || 0, (_refs$globalCache$fre2 = refs.globalCache.freezen) === null || _refs$globalCache$fre2 === void 0 ? void 0 : _refs$globalCache$fre2[context.currentSheetId]));
|
|
3814
3857
|
}() : {},
|
|
3815
3858
|
onMouseDown: function onMouseDown(e) {
|
|
3816
3859
|
return e.preventDefault();
|
|
3817
3860
|
}
|
|
3818
|
-
}), ((_context$
|
|
3861
|
+
}), ((_context$luckysheet_s6 = (_context$luckysheet_s7 = context.luckysheet_selection_range) === null || _context$luckysheet_s7 === void 0 ? void 0 : _context$luckysheet_s7.length) !== null && _context$luckysheet_s6 !== void 0 ? _context$luckysheet_s6 : 0) > 0 && (/*#__PURE__*/React.createElement("div", {
|
|
3819
3862
|
id: "fortune-selection-copy"
|
|
3820
3863
|
}, context.luckysheet_selection_range.map(function (range) {
|
|
3821
3864
|
var r1 = range.row[0];
|
|
@@ -3856,7 +3899,7 @@ var SheetOverlay = function SheetOverlay() {
|
|
|
3856
3899
|
onMouseDown: function onMouseDown(e) {
|
|
3857
3900
|
return e.preventDefault();
|
|
3858
3901
|
}
|
|
3859
|
-
}), ((_context$
|
|
3902
|
+
}), ((_context$luckysheet_s8 = (_context$luckysheet_s9 = context.luckysheet_select_save) === null || _context$luckysheet_s9 === void 0 ? void 0 : _context$luckysheet_s9.length) !== null && _context$luckysheet_s8 !== void 0 ? _context$luckysheet_s8 : 0) > 0 && (/*#__PURE__*/React.createElement("div", {
|
|
3860
3903
|
id: "luckysheet-cell-selected-boxs"
|
|
3861
3904
|
}, context.luckysheet_select_save.map(function (selection, index) {
|
|
3862
3905
|
var _refs$globalCache$fre3, _refs$globalCache$fre4;
|
|
@@ -3867,8 +3910,8 @@ var SheetOverlay = function SheetOverlay() {
|
|
|
3867
3910
|
style: _.assign({
|
|
3868
3911
|
left: selection.left_move,
|
|
3869
3912
|
top: selection.top_move,
|
|
3870
|
-
width: selection.width_move,
|
|
3871
|
-
height: selection.height_move,
|
|
3913
|
+
width: (selection === null || selection === void 0 ? void 0 : selection.width_move) || 0,
|
|
3914
|
+
height: (selection === null || selection === void 0 ? void 0 : selection.height_move) || 0,
|
|
3872
3915
|
display: "block"
|
|
3873
3916
|
}, fixRowStyleOverflowInFreeze(context, selection.row[0], selection.row[1], (_refs$globalCache$fre3 = refs.globalCache.freezen) === null || _refs$globalCache$fre3 === void 0 ? void 0 : _refs$globalCache$fre3[context.currentSheetId]), fixColumnStyleOverflowInFreeze(context, selection.column[0], selection.column[1], (_refs$globalCache$fre4 = refs.globalCache.freezen) === null || _refs$globalCache$fre4 === void 0 ? void 0 : _refs$globalCache$fre4[context.currentSheetId])),
|
|
3874
3917
|
onMouseDown: function onMouseDown(e) {
|
|
@@ -4061,7 +4104,15 @@ var SheetOverlay = function SheetOverlay() {
|
|
|
4061
4104
|
});
|
|
4062
4105
|
},
|
|
4063
4106
|
tabIndex: 0
|
|
4064
|
-
}, info.backTop)))))))
|
|
4107
|
+
}, info.backTop))))))), /*#__PURE__*/React.createElement("div", {
|
|
4108
|
+
id: "sr-selection",
|
|
4109
|
+
className: "sr-only",
|
|
4110
|
+
role: "alert"
|
|
4111
|
+
}, !rangeText.includes("NaN") ? "".concat(rangeText, " ").concat(computedCellValue) : "A1. ".concat(info.sheetSrIntro)), /*#__PURE__*/React.createElement("div", {
|
|
4112
|
+
id: "sr-sheetFocus",
|
|
4113
|
+
className: "sr-only",
|
|
4114
|
+
role: "alert"
|
|
4115
|
+
}, context.sheetFocused ? "".concat(lastRangeText, " ").concat(lastCellValue ? "".concat(lastCellValue, ".") : "", " ").concat(info.sheetIsFocused) : "Toolbar. ".concat(info.sheetNotFocused)));
|
|
4065
4116
|
};
|
|
4066
4117
|
|
|
4067
4118
|
var Sheet = function Sheet(_ref) {
|
|
@@ -4080,7 +4131,7 @@ var Sheet = function Sheet(_ref) {
|
|
|
4080
4131
|
if (!data) return;
|
|
4081
4132
|
setContext(function (draftCtx) {
|
|
4082
4133
|
if (settings.devicePixelRatio === 0) {
|
|
4083
|
-
draftCtx.devicePixelRatio = (globalThis
|
|
4134
|
+
draftCtx.devicePixelRatio = (typeof globalThis !== "undefined" ? globalThis : window).devicePixelRatio;
|
|
4084
4135
|
}
|
|
4085
4136
|
updateContextWithSheetData(draftCtx, data);
|
|
4086
4137
|
updateContextWithCanvas(draftCtx, refs.canvas.current, placeholderRef.current);
|
|
@@ -4230,7 +4281,8 @@ var Sheet = function Sheet(_ref) {
|
|
|
4230
4281
|
className: "fortune-sheet-canvas-placeholder"
|
|
4231
4282
|
}), /*#__PURE__*/React.createElement("canvas", {
|
|
4232
4283
|
className: "fortune-sheet-canvas",
|
|
4233
|
-
ref: refs.canvas
|
|
4284
|
+
ref: refs.canvas,
|
|
4285
|
+
"aria-hidden": "true"
|
|
4234
4286
|
}), /*#__PURE__*/React.createElement(SheetOverlay, null));
|
|
4235
4287
|
};
|
|
4236
4288
|
|
|
@@ -5520,16 +5572,17 @@ var FormatSearch = function FormatSearch(_ref) {
|
|
|
5520
5572
|
button = _locale.button,
|
|
5521
5573
|
format = _locale.format,
|
|
5522
5574
|
currencyDetail = _locale.currencyDetail,
|
|
5523
|
-
dateFmtList = _locale.dateFmtList
|
|
5575
|
+
dateFmtList = _locale.dateFmtList,
|
|
5576
|
+
numberFmtList = _locale.numberFmtList;
|
|
5524
5577
|
var _useDialog = useDialog(),
|
|
5525
5578
|
showDialog = _useDialog.showDialog;
|
|
5526
5579
|
var toolbarFormatAll = useMemo(function () {
|
|
5527
5580
|
return {
|
|
5528
5581
|
currency: currencyDetail,
|
|
5529
5582
|
date: dateFmtList,
|
|
5530
|
-
number:
|
|
5583
|
+
number: numberFmtList
|
|
5531
5584
|
};
|
|
5532
|
-
}, [currencyDetail, dateFmtList]);
|
|
5585
|
+
}, [currencyDetail, dateFmtList, numberFmtList]);
|
|
5533
5586
|
var toolbarFormat = useMemo(function () {
|
|
5534
5587
|
return toolbarFormatAll[type];
|
|
5535
5588
|
}, [toolbarFormatAll, type]);
|
|
@@ -5543,15 +5596,22 @@ var FormatSearch = function FormatSearch(_ref) {
|
|
|
5543
5596
|
setContext(function (ctx) {
|
|
5544
5597
|
var index = getSheetIndex(ctx, ctx.currentSheetId);
|
|
5545
5598
|
if (_.isNil(index)) return;
|
|
5546
|
-
var
|
|
5599
|
+
var selectedFormatVal = toolbarFormat[selectedFormatIndex].value;
|
|
5600
|
+
var selectedFormatPos;
|
|
5601
|
+
if ("pos" in toolbarFormat[selectedFormatIndex]) selectedFormatPos = toolbarFormat[selectedFormatIndex].pos || "before";
|
|
5547
5602
|
_.forEach(ctx.luckysheet_select_save, function (selection) {
|
|
5548
5603
|
for (var r = selection.row[0]; r <= selection.row[1]; r += 1) {
|
|
5549
5604
|
for (var c = selection.column[0]; c <= selection.column[1]; c += 1) {
|
|
5550
5605
|
var _ctx$luckysheetfile$i, _ctx$luckysheetfile$i2, _ctx$luckysheetfile$i3, _ctx$luckysheetfile$i4;
|
|
5551
5606
|
if (((_ctx$luckysheetfile$i = ctx.luckysheetfile[index].data) === null || _ctx$luckysheetfile$i === void 0 ? void 0 : _ctx$luckysheetfile$i[r][c]) && ((_ctx$luckysheetfile$i2 = ctx.luckysheetfile[index].data) === null || _ctx$luckysheetfile$i2 === void 0 ? void 0 : (_ctx$luckysheetfile$i3 = _ctx$luckysheetfile$i2[r][c]) === null || _ctx$luckysheetfile$i3 === void 0 ? void 0 : (_ctx$luckysheetfile$i4 = _ctx$luckysheetfile$i3.ct) === null || _ctx$luckysheetfile$i4 === void 0 ? void 0 : _ctx$luckysheetfile$i4.t) === "n") {
|
|
5552
5607
|
var zero = 0;
|
|
5553
|
-
|
|
5554
|
-
|
|
5608
|
+
if (selectedFormatPos === "after") {
|
|
5609
|
+
ctx.luckysheetfile[index].data[r][c].ct.fa = zero.toFixed(decimalPlace).concat("".concat(selectedFormatVal));
|
|
5610
|
+
ctx.luckysheetfile[index].data[r][c].m = update(zero.toFixed(decimalPlace).concat("".concat(selectedFormatVal)), ctx.luckysheetfile[index].data[r][c].v);
|
|
5611
|
+
} else {
|
|
5612
|
+
ctx.luckysheetfile[index].data[r][c].ct.fa = "".concat(selectedFormatVal).concat(zero.toFixed(decimalPlace));
|
|
5613
|
+
ctx.luckysheetfile[index].data[r][c].m = update("".concat(selectedFormatVal).concat(zero.toFixed(decimalPlace)), ctx.luckysheetfile[index].data[r][c].v);
|
|
5614
|
+
}
|
|
5555
5615
|
}
|
|
5556
5616
|
}
|
|
5557
5617
|
}
|
|
@@ -5581,10 +5641,8 @@ var FormatSearch = function FormatSearch(_ref) {
|
|
|
5581
5641
|
}
|
|
5582
5642
|
}, tips, format.format, "\uFF1A"), /*#__PURE__*/React.createElement("div", {
|
|
5583
5643
|
className: "inpbox",
|
|
5584
|
-
style:
|
|
5644
|
+
style: {
|
|
5585
5645
|
display: "block"
|
|
5586
|
-
} : {
|
|
5587
|
-
display: "none"
|
|
5588
5646
|
}
|
|
5589
5647
|
}, format.decimalPlaces, "\uFF1A", /*#__PURE__*/React.createElement("input", {
|
|
5590
5648
|
className: "decimal-places-input",
|
|
@@ -5609,10 +5667,8 @@ var FormatSearch = function FormatSearch(_ref) {
|
|
|
5609
5667
|
}, /*#__PURE__*/React.createElement("div", null, v.name), /*#__PURE__*/React.createElement("div", null, v.value));
|
|
5610
5668
|
}))), /*#__PURE__*/React.createElement("div", {
|
|
5611
5669
|
className: "fortune-dialog-box-button-container",
|
|
5612
|
-
style:
|
|
5670
|
+
style: {
|
|
5613
5671
|
marginTop: 40
|
|
5614
|
-
} : {
|
|
5615
|
-
marginTop: 30
|
|
5616
5672
|
}
|
|
5617
5673
|
}, /*#__PURE__*/React.createElement("div", {
|
|
5618
5674
|
className: "fortune-message-box-button button-primary",
|
|
@@ -6795,8 +6851,7 @@ var LocationBox = function LocationBox() {
|
|
|
6795
6851
|
}, /*#__PURE__*/React.createElement("div", {
|
|
6796
6852
|
className: "fortune-name-box",
|
|
6797
6853
|
tabIndex: 0,
|
|
6798
|
-
dir: "ltr"
|
|
6799
|
-
"aria-autocomplete": "list"
|
|
6854
|
+
dir: "ltr"
|
|
6800
6855
|
}, rangeText));
|
|
6801
6856
|
};
|
|
6802
6857
|
|
|
@@ -6820,6 +6875,8 @@ var FxEditor = function FxEditor() {
|
|
|
6820
6875
|
var prevFirstSelection = usePrevious(firstSelection);
|
|
6821
6876
|
var prevSheetId = usePrevious(context.currentSheetId);
|
|
6822
6877
|
var recentText = useRef("");
|
|
6878
|
+
var _locale = locale(context),
|
|
6879
|
+
info = _locale.info;
|
|
6823
6880
|
useEffect(function () {
|
|
6824
6881
|
setIsHidenRC(isShowHidenCR(context));
|
|
6825
6882
|
if (_.isEqual(prevFirstSelection, firstSelection) && context.currentSheetId === prevSheetId) {
|
|
@@ -6936,7 +6993,7 @@ var FxEditor = function FxEditor() {
|
|
|
6936
6993
|
}
|
|
6937
6994
|
return true;
|
|
6938
6995
|
}, [context.config, context.luckysheet_select_save, context.luckysheetfile, context.currentSheetId, isHidenRC]);
|
|
6939
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
6996
|
+
return /*#__PURE__*/React.createElement("aside", null, /*#__PURE__*/React.createElement("div", {
|
|
6940
6997
|
className: "fortune-fx-editor"
|
|
6941
6998
|
}, /*#__PURE__*/React.createElement(LocationBox, null), /*#__PURE__*/React.createElement("div", {
|
|
6942
6999
|
className: "fortune-fx-icon"
|
|
@@ -6952,8 +7009,9 @@ var FxEditor = function FxEditor() {
|
|
|
6952
7009
|
refs.fxInput.current = e;
|
|
6953
7010
|
},
|
|
6954
7011
|
className: "fortune-fx-input",
|
|
7012
|
+
role: "textbox",
|
|
6955
7013
|
id: "luckysheet-functionbox-cell",
|
|
6956
|
-
"aria-
|
|
7014
|
+
"aria-label": info.currentCellInput,
|
|
6957
7015
|
onFocus: onFocus,
|
|
6958
7016
|
onKeyDown: onKeyDown,
|
|
6959
7017
|
onChange: onChange,
|
|
@@ -6970,7 +7028,7 @@ var FxEditor = function FxEditor() {
|
|
|
6970
7028
|
style: {
|
|
6971
7029
|
top: inputContainerRef.current.clientHeight
|
|
6972
7030
|
}
|
|
6973
|
-
})))));
|
|
7031
|
+
}))))));
|
|
6974
7032
|
};
|
|
6975
7033
|
|
|
6976
7034
|
var SheetItem = function SheetItem(_ref) {
|
|
@@ -6996,6 +7054,8 @@ var SheetItem = function SheetItem(_ref) {
|
|
|
6996
7054
|
setSvgColor = _useState6[1];
|
|
6997
7055
|
var _useAlert = useAlert(),
|
|
6998
7056
|
showAlert = _useAlert.showAlert;
|
|
7057
|
+
var _locale = locale(context),
|
|
7058
|
+
info = _locale.info;
|
|
6999
7059
|
useEffect(function () {
|
|
7000
7060
|
setContext(function (draftCtx) {
|
|
7001
7061
|
var r = context.sheetScrollRecord[draftCtx === null || draftCtx === void 0 ? void 0 : draftCtx.currentSheetId];
|
|
@@ -7082,6 +7142,7 @@ var SheetItem = function SheetItem(_ref) {
|
|
|
7082
7142
|
e.stopPropagation();
|
|
7083
7143
|
}, [context.allowEdit, isDropPlaceholder, setContext, sheet.id]);
|
|
7084
7144
|
return /*#__PURE__*/React.createElement("div", {
|
|
7145
|
+
role: "button",
|
|
7085
7146
|
onDragOver: function onDragOver(e) {
|
|
7086
7147
|
e.preventDefault();
|
|
7087
7148
|
e.stopPropagation();
|
|
@@ -7184,7 +7245,8 @@ var SheetItem = function SheetItem(_ref) {
|
|
|
7184
7245
|
};
|
|
7185
7246
|
});
|
|
7186
7247
|
},
|
|
7187
|
-
tabIndex: 0
|
|
7248
|
+
tabIndex: 0,
|
|
7249
|
+
"aria-label": info.sheetOptions
|
|
7188
7250
|
}, /*#__PURE__*/React.createElement(SVGIcon, {
|
|
7189
7251
|
name: "downArrow",
|
|
7190
7252
|
width: 12,
|
|
@@ -7236,6 +7298,8 @@ var ZoomControl = function ZoomControl() {
|
|
|
7236
7298
|
_useState2 = _slicedToArray(_useState, 2),
|
|
7237
7299
|
radioMenuOpen = _useState2[0],
|
|
7238
7300
|
setRadioMenuOpen = _useState2[1];
|
|
7301
|
+
var _locale = locale(context),
|
|
7302
|
+
info = _locale.info;
|
|
7239
7303
|
useOutsideClick(menuRef, function () {
|
|
7240
7304
|
setRadioMenuOpen(false);
|
|
7241
7305
|
}, []);
|
|
@@ -7255,15 +7319,18 @@ var ZoomControl = function ZoomControl() {
|
|
|
7255
7319
|
noHistory: true
|
|
7256
7320
|
});
|
|
7257
7321
|
}, [setContext]);
|
|
7258
|
-
return /*#__PURE__*/React.createElement("
|
|
7322
|
+
return /*#__PURE__*/React.createElement("aside", {
|
|
7323
|
+
title: "Zoom settings",
|
|
7259
7324
|
className: "fortune-zoom-container"
|
|
7260
7325
|
}, /*#__PURE__*/React.createElement("div", {
|
|
7261
7326
|
className: "fortune-zoom-button",
|
|
7327
|
+
"aria-label": info.zoomOut,
|
|
7262
7328
|
onClick: function onClick(e) {
|
|
7263
7329
|
zoomTo(context.zoomRatio - 0.1);
|
|
7264
7330
|
e.stopPropagation();
|
|
7265
7331
|
},
|
|
7266
|
-
tabIndex: 0
|
|
7332
|
+
tabIndex: 0,
|
|
7333
|
+
role: "button"
|
|
7267
7334
|
}, /*#__PURE__*/React.createElement(SVGIcon, {
|
|
7268
7335
|
name: "minus",
|
|
7269
7336
|
width: 16,
|
|
@@ -7293,11 +7360,13 @@ var ZoomControl = function ZoomControl() {
|
|
|
7293
7360
|
}, v.text));
|
|
7294
7361
|
})))), /*#__PURE__*/React.createElement("div", {
|
|
7295
7362
|
className: "fortune-zoom-button",
|
|
7363
|
+
"aria-label": info.zoomIn,
|
|
7296
7364
|
onClick: function onClick(e) {
|
|
7297
7365
|
zoomTo(context.zoomRatio + 0.1);
|
|
7298
7366
|
e.stopPropagation();
|
|
7299
7367
|
},
|
|
7300
|
-
tabIndex: 0
|
|
7368
|
+
tabIndex: 0,
|
|
7369
|
+
role: "button"
|
|
7301
7370
|
}, /*#__PURE__*/React.createElement(SVGIcon, {
|
|
7302
7371
|
name: "plus",
|
|
7303
7372
|
width: 16,
|
|
@@ -7322,6 +7391,8 @@ var SheetTab = function SheetTab() {
|
|
|
7322
7391
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
7323
7392
|
isShowBoundary = _useState4[0],
|
|
7324
7393
|
setIsShowBoundary = _useState4[1];
|
|
7394
|
+
var _locale = locale(context),
|
|
7395
|
+
info = _locale.info;
|
|
7325
7396
|
var scrollDelta = 150;
|
|
7326
7397
|
var scrollBy = useCallback(function (amount) {
|
|
7327
7398
|
var _tabContainerRef$curr;
|
|
@@ -7364,7 +7435,10 @@ var SheetTab = function SheetTab() {
|
|
|
7364
7435
|
id: "luckysheet-sheet-content"
|
|
7365
7436
|
}, context.allowEdit && (/*#__PURE__*/React.createElement("div", {
|
|
7366
7437
|
className: "fortune-sheettab-button",
|
|
7367
|
-
onClick: onAddSheetClick
|
|
7438
|
+
onClick: onAddSheetClick,
|
|
7439
|
+
tabIndex: 0,
|
|
7440
|
+
"aria-label": info.newSheet,
|
|
7441
|
+
role: "button"
|
|
7368
7442
|
}, /*#__PURE__*/React.createElement(SVGIcon, {
|
|
7369
7443
|
name: "plus",
|
|
7370
7444
|
width: 16,
|
|
@@ -7449,6 +7523,12 @@ var Menu = function Menu(_ref) {
|
|
|
7449
7523
|
_onMouseLeave = _ref.onMouseLeave,
|
|
7450
7524
|
_onMouseEnter = _ref.onMouseEnter,
|
|
7451
7525
|
children = _ref.children;
|
|
7526
|
+
useEffect(function () {
|
|
7527
|
+
var element = document.querySelector(".luckysheet-cols-menuitem");
|
|
7528
|
+
if (element) {
|
|
7529
|
+
element.focus();
|
|
7530
|
+
}
|
|
7531
|
+
}, []);
|
|
7452
7532
|
var containerRef = useRef(null);
|
|
7453
7533
|
return /*#__PURE__*/React.createElement("div", {
|
|
7454
7534
|
ref: containerRef,
|
|
@@ -7629,23 +7709,34 @@ var ContextMenu = function ContextMenu() {
|
|
|
7629
7709
|
key: name,
|
|
7630
7710
|
onClick: function () {
|
|
7631
7711
|
var _onClick = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
7632
|
-
var clipboardText;
|
|
7712
|
+
var clipboardText, sessionClipboardText, finalText;
|
|
7633
7713
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
7634
7714
|
while (1) switch (_context.prev = _context.next) {
|
|
7635
7715
|
case 0:
|
|
7636
|
-
|
|
7716
|
+
clipboardText = "";
|
|
7717
|
+
sessionClipboardText = sessionStorage.getItem("localClipboard") || "";
|
|
7718
|
+
_context.prev = 2;
|
|
7719
|
+
_context.next = 5;
|
|
7637
7720
|
return navigator.clipboard.readText();
|
|
7638
|
-
case
|
|
7721
|
+
case 5:
|
|
7639
7722
|
clipboardText = _context.sent;
|
|
7723
|
+
_context.next = 11;
|
|
7724
|
+
break;
|
|
7725
|
+
case 8:
|
|
7726
|
+
_context.prev = 8;
|
|
7727
|
+
_context.t0 = _context["catch"](2);
|
|
7728
|
+
console.warn("Clipboard access blocked. Attempting to use sessionStorage fallback.");
|
|
7729
|
+
case 11:
|
|
7730
|
+
finalText = clipboardText || sessionClipboardText;
|
|
7640
7731
|
setContext(function (draftCtx) {
|
|
7641
|
-
handlePasteByClick(draftCtx,
|
|
7732
|
+
handlePasteByClick(draftCtx, finalText);
|
|
7642
7733
|
draftCtx.contextMenu = {};
|
|
7643
7734
|
});
|
|
7644
|
-
case
|
|
7735
|
+
case 13:
|
|
7645
7736
|
case "end":
|
|
7646
7737
|
return _context.stop();
|
|
7647
7738
|
}
|
|
7648
|
-
}, _callee);
|
|
7739
|
+
}, _callee, null, [[2, 8]]);
|
|
7649
7740
|
}));
|
|
7650
7741
|
function onClick() {
|
|
7651
7742
|
return _onClick.apply(this, arguments);
|
|
@@ -9999,6 +10090,45 @@ function generateAPIs(context, setContext, handleUndo, handleRedo, settings, cel
|
|
|
9999
10090
|
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
10000
10091
|
return api.getCellValue(context, row, column, options);
|
|
10001
10092
|
},
|
|
10093
|
+
onboardingActiveCell: function onboardingActiveCell(functionName) {
|
|
10094
|
+
var _context$luckysheet_s;
|
|
10095
|
+
var _locale = locale(context),
|
|
10096
|
+
functionlist = _locale.functionlist;
|
|
10097
|
+
var last = (_context$luckysheet_s = context.luckysheet_select_save) === null || _context$luckysheet_s === void 0 ? void 0 : _context$luckysheet_s[context.luckysheet_select_save.length - 1];
|
|
10098
|
+
var row_index = last === null || last === void 0 ? void 0 : last.row_focus;
|
|
10099
|
+
var col_index = last === null || last === void 0 ? void 0 : last.column_focus;
|
|
10100
|
+
if (!last) {
|
|
10101
|
+
row_index = 0;
|
|
10102
|
+
col_index = 0;
|
|
10103
|
+
} else {
|
|
10104
|
+
if (row_index == null) {
|
|
10105
|
+
var _last$row = _slicedToArray(last.row, 1);
|
|
10106
|
+
row_index = _last$row[0];
|
|
10107
|
+
}
|
|
10108
|
+
if (col_index == null) {
|
|
10109
|
+
var _last$column = _slicedToArray(last.column, 1);
|
|
10110
|
+
col_index = _last$column[0];
|
|
10111
|
+
}
|
|
10112
|
+
}
|
|
10113
|
+
var formulaTxt = "<span>=</span><span>".concat(functionName, "</span><span>(</span>");
|
|
10114
|
+
setContext(function (ctx) {
|
|
10115
|
+
if (cellInput != null) {
|
|
10116
|
+
ctx.luckysheetCellUpdate = [row_index, col_index];
|
|
10117
|
+
cellInput.innerHTML = formulaTxt;
|
|
10118
|
+
var spans = cellInput.childNodes;
|
|
10119
|
+
if (!_.isEmpty(spans)) {
|
|
10120
|
+
setCaretPosition(ctx, spans[spans.length - 1], 0, 1);
|
|
10121
|
+
}
|
|
10122
|
+
ctx.functionHint = functionName;
|
|
10123
|
+
ctx.functionCandidates = [];
|
|
10124
|
+
if (_.isEmpty(ctx.formulaCache.functionlistMap)) {
|
|
10125
|
+
for (var i = 0; i < functionlist.length; i += 1) {
|
|
10126
|
+
ctx.formulaCache.functionlistMap[functionlist[i].n] = functionlist[i];
|
|
10127
|
+
}
|
|
10128
|
+
}
|
|
10129
|
+
}
|
|
10130
|
+
});
|
|
10131
|
+
},
|
|
10002
10132
|
setCellValue: function setCellValue(row, column, value) {
|
|
10003
10133
|
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
10004
10134
|
return setContext(function (draftCtx) {
|
|
@@ -10130,10 +10260,17 @@ function generateAPIs(context, setContext, handleUndo, handleRedo, settings, cel
|
|
|
10130
10260
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
10131
10261
|
return api.getSheetWithLatestCelldata(context, options);
|
|
10132
10262
|
},
|
|
10133
|
-
addSheet: function addSheet() {
|
|
10134
|
-
|
|
10135
|
-
return
|
|
10263
|
+
addSheet: function addSheet(sheetId) {
|
|
10264
|
+
var existingSheetIds = api.getAllSheets(context).map(function (sheet) {
|
|
10265
|
+
return sheet.id || "";
|
|
10136
10266
|
});
|
|
10267
|
+
if (sheetId && existingSheetIds.includes(sheetId)) {
|
|
10268
|
+
console.error("Failed to add new sheet: A sheet with the id \"".concat(sheetId, "\" already exists. Please use a unique sheet id."));
|
|
10269
|
+
} else {
|
|
10270
|
+
setContext(function (draftCtx) {
|
|
10271
|
+
return api.addSheet(draftCtx, settings, sheetId);
|
|
10272
|
+
});
|
|
10273
|
+
}
|
|
10137
10274
|
},
|
|
10138
10275
|
deleteSheet: function deleteSheet() {
|
|
10139
10276
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
@@ -10184,11 +10321,9 @@ function generateAPIs(context, setContext, handleUndo, handleRedo, settings, cel
|
|
|
10184
10321
|
},
|
|
10185
10322
|
handleUndo: handleUndo,
|
|
10186
10323
|
handleRedo: handleRedo,
|
|
10187
|
-
calculateFormula: function calculateFormula() {
|
|
10324
|
+
calculateFormula: function calculateFormula(id, range) {
|
|
10188
10325
|
setContext(function (draftCtx) {
|
|
10189
|
-
|
|
10190
|
-
api.calculateSheetFromula(draftCtx, sheet_obj.id);
|
|
10191
|
-
});
|
|
10326
|
+
api.calculateFormula(draftCtx, id, range);
|
|
10192
10327
|
});
|
|
10193
10328
|
},
|
|
10194
10329
|
dataToCelldata: function dataToCelldata(data) {
|
|
@@ -10196,6 +10331,19 @@ function generateAPIs(context, setContext, handleUndo, handleRedo, settings, cel
|
|
|
10196
10331
|
},
|
|
10197
10332
|
celldataToData: function celldataToData(celldata, rowCount, colCount) {
|
|
10198
10333
|
return api.celldataToData(celldata, rowCount, colCount);
|
|
10334
|
+
},
|
|
10335
|
+
batchCallApis: function batchCallApis(apiCalls) {
|
|
10336
|
+
setContext(function (draftCtx) {
|
|
10337
|
+
apiCalls.forEach(function (apiCall) {
|
|
10338
|
+
var name = apiCall.name,
|
|
10339
|
+
args = apiCall.args;
|
|
10340
|
+
if (typeof api[name] === "function") {
|
|
10341
|
+
api[name].apply(api, [draftCtx].concat(_toConsumableArray(args)));
|
|
10342
|
+
} else {
|
|
10343
|
+
console.warn("API ".concat(name, " does not exist"));
|
|
10344
|
+
}
|
|
10345
|
+
});
|
|
10346
|
+
});
|
|
10199
10347
|
}
|
|
10200
10348
|
};
|
|
10201
10349
|
}
|
|
@@ -10976,7 +11124,8 @@ var Workbook = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
10976
11124
|
context = _useState2[0],
|
|
10977
11125
|
setContext = _useState2[1];
|
|
10978
11126
|
var _locale = locale(context),
|
|
10979
|
-
formula = _locale.formula
|
|
11127
|
+
formula = _locale.formula,
|
|
11128
|
+
info = _locale.info;
|
|
10980
11129
|
var _useState3 = useState(null),
|
|
10981
11130
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
10982
11131
|
moreToolbarItems = _useState4[0],
|
|
@@ -11162,7 +11311,7 @@ var Workbook = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
11162
11311
|
var history = globalCache.current.undoList.pop();
|
|
11163
11312
|
if (history) {
|
|
11164
11313
|
setContext(function (ctx_) {
|
|
11165
|
-
var _history$options, _history$options3;
|
|
11314
|
+
var _history$options, _history$options3, _history$options4, _history$options5, _history$options6;
|
|
11166
11315
|
if ((_history$options = history.options) === null || _history$options === void 0 ? void 0 : _history$options.deleteSheetOp) {
|
|
11167
11316
|
var _history$options$dele, _history$options$dele2;
|
|
11168
11317
|
history.inversePatches[0].path[1] = ctx_.luckysheetfile.length;
|
|
@@ -11197,6 +11346,7 @@ var Workbook = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
11197
11346
|
delete inversedOptions.addSheet.value.data;
|
|
11198
11347
|
}
|
|
11199
11348
|
emitOp(newContext, history.inversePatches, inversedOptions, true);
|
|
11349
|
+
if (((_history$options4 = history.options) === null || _history$options4 === void 0 ? void 0 : _history$options4.deleteRowColOp) || ((_history$options5 = history.options) === null || _history$options5 === void 0 ? void 0 : _history$options5.insertRowColOp) || ((_history$options6 = history.options) === null || _history$options6 === void 0 ? void 0 : _history$options6.restoreDeletedCells)) newContext.formulaCache.formulaCellInfoMap = null;else newContext.formulaCache.updateFormulaCache(newContext, history, "undo");
|
|
11200
11350
|
return newContext;
|
|
11201
11351
|
});
|
|
11202
11352
|
}
|
|
@@ -11205,9 +11355,11 @@ var Workbook = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
11205
11355
|
var history = globalCache.current.redoList.pop();
|
|
11206
11356
|
if (history) {
|
|
11207
11357
|
setContext(function (ctx_) {
|
|
11358
|
+
var _history$options7, _history$options8, _history$options9;
|
|
11208
11359
|
var newContext = applyPatches(ctx_, history.patches);
|
|
11209
11360
|
globalCache.current.undoList.push(history);
|
|
11210
11361
|
emitOp(newContext, history.patches, history.options);
|
|
11362
|
+
if (((_history$options7 = history.options) === null || _history$options7 === void 0 ? void 0 : _history$options7.deleteRowColOp) || ((_history$options8 = history.options) === null || _history$options8 === void 0 ? void 0 : _history$options8.insertRowColOp) || ((_history$options9 = history.options) === null || _history$options9 === void 0 ? void 0 : _history$options9.restoreDeletedCells)) newContext.formulaCache.formulaCellInfoMap = null;else newContext.formulaCache.updateFormulaCache(newContext, history, "redo");
|
|
11211
11363
|
return newContext;
|
|
11212
11364
|
});
|
|
11213
11365
|
}
|
|
@@ -11248,7 +11400,8 @@ var Workbook = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
11248
11400
|
var _draftCtx$luckysheetf;
|
|
11249
11401
|
var index = getSheetIndex(draftCtx, newDatum.id);
|
|
11250
11402
|
var sheet = (_draftCtx$luckysheetf = draftCtx.luckysheetfile) === null || _draftCtx$luckysheetf === void 0 ? void 0 : _draftCtx$luckysheetf[index];
|
|
11251
|
-
initSheetData(draftCtx, sheet, index);
|
|
11403
|
+
var cellMatrixData = initSheetData(draftCtx, sheet, index);
|
|
11404
|
+
setFormulaCellInfoMap(draftCtx, sheet.calcChain, cellMatrixData || undefined);
|
|
11252
11405
|
});
|
|
11253
11406
|
}
|
|
11254
11407
|
if (mergedSettings.devicePixelRatio > 0) {
|
|
@@ -11419,7 +11572,15 @@ var Workbook = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
11419
11572
|
className: "fortune-container",
|
|
11420
11573
|
ref: workbookContainer,
|
|
11421
11574
|
onKeyDown: onKeyDown
|
|
11422
|
-
}, /*#__PURE__*/React.createElement(
|
|
11575
|
+
}, /*#__PURE__*/React.createElement("section", {
|
|
11576
|
+
"aria-labelledby": "shortcuts-heading",
|
|
11577
|
+
id: "shortcut-list",
|
|
11578
|
+
className: "sr-only",
|
|
11579
|
+
tabIndex: 0,
|
|
11580
|
+
"aria-live": "polite"
|
|
11581
|
+
}, /*#__PURE__*/React.createElement("h2", {
|
|
11582
|
+
id: "shortcuts-heading"
|
|
11583
|
+
}, info.shortcuts), /*#__PURE__*/React.createElement("ul", null, /*#__PURE__*/React.createElement("li", null, info.toggleSheetFocusShortcut), /*#__PURE__*/React.createElement("li", null, info.selectRangeShortcut), /*#__PURE__*/React.createElement("li", null, info.autoFillDownShortcut), /*#__PURE__*/React.createElement("li", null, info.autoFillRightShortcut), /*#__PURE__*/React.createElement("li", null, info.boldTextShortcut), /*#__PURE__*/React.createElement("li", null, info.copyShortcut), /*#__PURE__*/React.createElement("li", null, info.pasteShortcut), /*#__PURE__*/React.createElement("li", null, info.undoShortcut), /*#__PURE__*/React.createElement("li", null, info.redoShortcut), /*#__PURE__*/React.createElement("li", null, info.deleteCellContentShortcut), /*#__PURE__*/React.createElement("li", null, info.confirmCellEditShortcut), /*#__PURE__*/React.createElement("li", null, info.moveRightShortcut), /*#__PURE__*/React.createElement("li", null, info.moveLeftShortcut))), /*#__PURE__*/React.createElement(SVGDefines, {
|
|
11423
11584
|
currency: mergedSettings.currency
|
|
11424
11585
|
}), /*#__PURE__*/React.createElement("div", {
|
|
11425
11586
|
className: "fortune-workarea"
|