@fileverse-dev/fortune-react 1.0.2-mod-12 → 1.0.2-mod-10-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 +2 -6
- package/dist/components/Workbook/index.d.ts +2 -6
- package/dist/index.css +1 -26
- package/dist/index.esm.css +1 -26
- package/dist/index.esm.js +108 -230
- package/dist/index.js +107 -229
- package/dist/index.umd.css +1 -26
- package/dist/index.umd.js +810 -312
- 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,
|
|
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, 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';
|
|
@@ -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
|
|
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
|
|
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, firstSelection]);
|
|
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:
|
|
1289
|
-
minHeight:
|
|
1288
|
+
minWidth: firstSelection.width,
|
|
1289
|
+
minHeight: firstSelection.height
|
|
1290
1290
|
}, inputBoxStyle) : {}
|
|
1291
1291
|
}, /*#__PURE__*/React.createElement(ContentEditable, {
|
|
1292
1292
|
innerRef: function innerRef(e) {
|
|
@@ -1301,6 +1301,7 @@ var InputBox = function InputBox() {
|
|
|
1301
1301
|
width: "".concat(100 / context.zoomRatio, "%"),
|
|
1302
1302
|
height: "".concat(100 / context.zoomRatio, "%")
|
|
1303
1303
|
},
|
|
1304
|
+
"aria-autocomplete": "list",
|
|
1304
1305
|
onChange: onChange,
|
|
1305
1306
|
onKeyDown: onKeyDown,
|
|
1306
1307
|
onPaste: onPaste,
|
|
@@ -2569,7 +2570,7 @@ var DataVerification = function DataVerification() {
|
|
|
2569
2570
|
setContext(function (ctx) {
|
|
2570
2571
|
var isPass = confirmMessage(ctx, generalDialog, dataVerification);
|
|
2571
2572
|
if (isPass) {
|
|
2572
|
-
var _ctx$dataVerification, _ctx$dataVerification2, _ctx$luckysheetfile$g
|
|
2573
|
+
var _ctx$dataVerification, _ctx$dataVerification2, _ctx$luckysheetfile$g;
|
|
2573
2574
|
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);
|
|
2574
2575
|
if (range.length === 0) {
|
|
2575
2576
|
return;
|
|
@@ -2585,12 +2586,12 @@ var DataVerification = function DataVerification() {
|
|
|
2585
2586
|
item.value1 = list.join(",");
|
|
2586
2587
|
}
|
|
2587
2588
|
var currentDataVerification = (_ctx$luckysheetfile$g = ctx.luckysheetfile[getSheetIndex(ctx, ctx.currentSheetId)].dataVerification) !== null && _ctx$luckysheetfile$g !== void 0 ? _ctx$luckysheetfile$g : {};
|
|
2588
|
-
var str =
|
|
2589
|
-
var edr =
|
|
2590
|
-
var stc =
|
|
2591
|
-
var edc =
|
|
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];
|
|
2592
2593
|
var d = getFlowdata(ctx);
|
|
2593
|
-
if (!d
|
|
2594
|
+
if (!d) return;
|
|
2594
2595
|
for (var r = str; r <= edr; r += 1) {
|
|
2595
2596
|
for (var c = stc; c <= edc; c += 1) {
|
|
2596
2597
|
var key = "".concat(r, "_").concat(c);
|
|
@@ -2605,18 +2606,17 @@ var DataVerification = function DataVerification() {
|
|
|
2605
2606
|
});
|
|
2606
2607
|
} else if (type === "delete") {
|
|
2607
2608
|
setContext(function (ctx) {
|
|
2608
|
-
var _ctx$dataVerification3, _ctx$dataVerification4, _ctx$luckysheetfile$g2
|
|
2609
|
+
var _ctx$dataVerification3, _ctx$dataVerification4, _ctx$luckysheetfile$g2;
|
|
2609
2610
|
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);
|
|
2610
2611
|
if (range.length === 0) {
|
|
2611
2612
|
showDialog(generalDialog.noSeletionError, "ok");
|
|
2612
2613
|
return;
|
|
2613
2614
|
}
|
|
2614
2615
|
var currentDataVerification = (_ctx$luckysheetfile$g2 = ctx.luckysheetfile[getSheetIndex(ctx, ctx.currentSheetId)].dataVerification) !== null && _ctx$luckysheetfile$g2 !== void 0 ? _ctx$luckysheetfile$g2 : {};
|
|
2615
|
-
var str =
|
|
2616
|
-
var edr =
|
|
2617
|
-
var stc =
|
|
2618
|
-
var edc =
|
|
2619
|
-
if (_.isNil(str) || _.isNil(stc) || _.isNil(edr) || _.isNil(edc)) return;
|
|
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];
|
|
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,41 +2628,56 @@ 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;
|
|
2632
2631
|
var rangeT = "";
|
|
2633
2632
|
if (ctx.luckysheet_select_save) {
|
|
2634
2633
|
var range = ctx.luckysheet_select_save[ctx.luckysheet_select_save.length - 1];
|
|
2635
2634
|
rangeT = getRangetxt(context, context.currentSheetId, range, context.currentSheetId);
|
|
2636
2635
|
}
|
|
2637
2636
|
var index = getSheetIndex(ctx, ctx.currentSheetId);
|
|
2638
|
-
var ctxDataVerification = ctx.luckysheetfile[index].dataVerification
|
|
2639
|
-
if (
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
ctx.
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2637
|
+
var ctxDataVerification = ctx.luckysheetfile[index].dataVerification;
|
|
2638
|
+
if (ctxDataVerification) {
|
|
2639
|
+
var _defaultItem$value, _ctx$rangeDialog, _ctx$rangeDialog2;
|
|
2640
|
+
if (!ctx.luckysheet_select_save) return;
|
|
2641
|
+
var last = ctx.luckysheet_select_save[ctx.luckysheet_select_save.length - 1];
|
|
2642
|
+
var rowIndex = last.row_focus;
|
|
2643
|
+
var colIndex = last.column_focus;
|
|
2644
|
+
if (rowIndex == null || colIndex == null) return;
|
|
2645
|
+
var item = ctxDataVerification["".concat(rowIndex, "_").concat(colIndex)];
|
|
2646
|
+
var defaultItem = item !== null && item !== void 0 ? item : {};
|
|
2647
|
+
var rangValue = (_defaultItem$value = defaultItem.value1) !== null && _defaultItem$value !== void 0 ? _defaultItem$value : "";
|
|
2648
|
+
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) {
|
|
2649
|
+
rangeT = ctx.dataVerification.dataRegulation.rangeTxt;
|
|
2650
|
+
rangValue = ctx.rangeDialog.rangeTxt;
|
|
2651
|
+
} 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) {
|
|
2652
|
+
rangValue = ctx.dataVerification.dataRegulation.value1;
|
|
2653
|
+
rangeT = ctx.rangeDialog.rangeTxt;
|
|
2654
|
+
}
|
|
2655
|
+
ctx.rangeDialog.type = "";
|
|
2656
|
+
if (item) {
|
|
2657
|
+
ctx.dataVerification.dataRegulation = _objectSpread2(_objectSpread2({}, item), {}, {
|
|
2658
|
+
value1: rangValue,
|
|
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
|
+
}
|
|
2660
2675
|
} else {
|
|
2661
2676
|
ctx.dataVerification.dataRegulation = {
|
|
2662
2677
|
type: "dropdown",
|
|
2663
2678
|
type2: "",
|
|
2664
2679
|
rangeTxt: rangeT,
|
|
2665
|
-
value1:
|
|
2680
|
+
value1: "",
|
|
2666
2681
|
value2: "",
|
|
2667
2682
|
validity: "",
|
|
2668
2683
|
remote: false,
|
|
@@ -3506,7 +3521,7 @@ var DropDownList = function DropDownList() {
|
|
|
3506
3521
|
};
|
|
3507
3522
|
|
|
3508
3523
|
var SheetOverlay = function SheetOverlay() {
|
|
3509
|
-
var _refs$cellArea$curren, _refs$cellArea$curren2, _context$
|
|
3524
|
+
var _refs$cellArea$curren, _refs$cellArea$curren2, _context$luckysheet_s, _context$luckysheet_s2, _context$luckysheet_s3, _context$luckysheet_s4, _context$luckysheet_s5, _context$luckysheet_s6, _context$presences$le, _context$presences, _context$linkCard, _context$rangeDialog;
|
|
3510
3525
|
var _useContext = useContext(WorkbookContext),
|
|
3511
3526
|
context = _useContext.context,
|
|
3512
3527
|
setContext = _useContext.setContext,
|
|
@@ -3520,14 +3535,6 @@ var SheetOverlay = function SheetOverlay() {
|
|
|
3520
3535
|
var containerRef = useRef(null);
|
|
3521
3536
|
var bottomAddRowInputRef = useRef(null);
|
|
3522
3537
|
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];
|
|
3531
3538
|
var _useAlert = useAlert(),
|
|
3532
3539
|
showAlert = _useAlert.showAlert;
|
|
3533
3540
|
var cellAreaMouseDown = useCallback(function (e) {
|
|
@@ -3650,20 +3657,6 @@ var SheetOverlay = function SheetOverlay() {
|
|
|
3650
3657
|
insertRowColOp: insertRowColOp
|
|
3651
3658
|
});
|
|
3652
3659
|
}, [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]);
|
|
3667
3660
|
useEffect(function () {
|
|
3668
3661
|
if (context.warnDialog) {
|
|
3669
3662
|
setTimeout(function () {
|
|
@@ -3706,43 +3699,7 @@ var SheetOverlay = function SheetOverlay() {
|
|
|
3706
3699
|
document.removeEventListener("keydown", onKeyDownForZoom);
|
|
3707
3700
|
};
|
|
3708
3701
|
}, [onKeyDownForZoom]);
|
|
3709
|
-
|
|
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", {
|
|
3702
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
3746
3703
|
className: "fortune-sheet-overlay",
|
|
3747
3704
|
ref: containerRef,
|
|
3748
3705
|
onTouchStart: onTouchStart,
|
|
@@ -3845,20 +3802,20 @@ var SheetOverlay = function SheetOverlay() {
|
|
|
3845
3802
|
hidden: !context.luckysheet_cols_freeze_drag && !context.luckysheet_rows_freeze_drag
|
|
3846
3803
|
}), /*#__PURE__*/React.createElement("div", {
|
|
3847
3804
|
className: "luckysheet-cell-selected-focus",
|
|
3848
|
-
style: ((_context$
|
|
3805
|
+
style: ((_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 ? function (_refs$globalCache$fre, _refs$globalCache$fre2) {
|
|
3849
3806
|
var selection = _.last(context.luckysheet_select_save);
|
|
3850
3807
|
return _.assign({
|
|
3851
3808
|
left: selection.left,
|
|
3852
3809
|
top: selection.top,
|
|
3853
|
-
width:
|
|
3854
|
-
height:
|
|
3810
|
+
width: selection.width,
|
|
3811
|
+
height: selection.height,
|
|
3855
3812
|
display: "block"
|
|
3856
3813
|
}, 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]));
|
|
3857
3814
|
}() : {},
|
|
3858
3815
|
onMouseDown: function onMouseDown(e) {
|
|
3859
3816
|
return e.preventDefault();
|
|
3860
3817
|
}
|
|
3861
|
-
}), ((_context$
|
|
3818
|
+
}), ((_context$luckysheet_s3 = (_context$luckysheet_s4 = context.luckysheet_selection_range) === null || _context$luckysheet_s4 === void 0 ? void 0 : _context$luckysheet_s4.length) !== null && _context$luckysheet_s3 !== void 0 ? _context$luckysheet_s3 : 0) > 0 && (/*#__PURE__*/React.createElement("div", {
|
|
3862
3819
|
id: "fortune-selection-copy"
|
|
3863
3820
|
}, context.luckysheet_selection_range.map(function (range) {
|
|
3864
3821
|
var r1 = range.row[0];
|
|
@@ -3899,7 +3856,7 @@ var SheetOverlay = function SheetOverlay() {
|
|
|
3899
3856
|
onMouseDown: function onMouseDown(e) {
|
|
3900
3857
|
return e.preventDefault();
|
|
3901
3858
|
}
|
|
3902
|
-
}), ((_context$
|
|
3859
|
+
}), ((_context$luckysheet_s5 = (_context$luckysheet_s6 = context.luckysheet_select_save) === null || _context$luckysheet_s6 === void 0 ? void 0 : _context$luckysheet_s6.length) !== null && _context$luckysheet_s5 !== void 0 ? _context$luckysheet_s5 : 0) > 0 && (/*#__PURE__*/React.createElement("div", {
|
|
3903
3860
|
id: "luckysheet-cell-selected-boxs"
|
|
3904
3861
|
}, context.luckysheet_select_save.map(function (selection, index) {
|
|
3905
3862
|
var _refs$globalCache$fre3, _refs$globalCache$fre4;
|
|
@@ -3910,8 +3867,8 @@ var SheetOverlay = function SheetOverlay() {
|
|
|
3910
3867
|
style: _.assign({
|
|
3911
3868
|
left: selection.left_move,
|
|
3912
3869
|
top: selection.top_move,
|
|
3913
|
-
width:
|
|
3914
|
-
height:
|
|
3870
|
+
width: selection.width_move,
|
|
3871
|
+
height: selection.height_move,
|
|
3915
3872
|
display: "block"
|
|
3916
3873
|
}, 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])),
|
|
3917
3874
|
onMouseDown: function onMouseDown(e) {
|
|
@@ -4104,15 +4061,7 @@ var SheetOverlay = function SheetOverlay() {
|
|
|
4104
4061
|
});
|
|
4105
4062
|
},
|
|
4106
4063
|
tabIndex: 0
|
|
4107
|
-
}, info.backTop)))))))
|
|
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)));
|
|
4064
|
+
}, info.backTop))))))));
|
|
4116
4065
|
};
|
|
4117
4066
|
|
|
4118
4067
|
var Sheet = function Sheet(_ref) {
|
|
@@ -4131,7 +4080,7 @@ var Sheet = function Sheet(_ref) {
|
|
|
4131
4080
|
if (!data) return;
|
|
4132
4081
|
setContext(function (draftCtx) {
|
|
4133
4082
|
if (settings.devicePixelRatio === 0) {
|
|
4134
|
-
draftCtx.devicePixelRatio = (
|
|
4083
|
+
draftCtx.devicePixelRatio = (globalThis || window).devicePixelRatio;
|
|
4135
4084
|
}
|
|
4136
4085
|
updateContextWithSheetData(draftCtx, data);
|
|
4137
4086
|
updateContextWithCanvas(draftCtx, refs.canvas.current, placeholderRef.current);
|
|
@@ -4281,8 +4230,7 @@ var Sheet = function Sheet(_ref) {
|
|
|
4281
4230
|
className: "fortune-sheet-canvas-placeholder"
|
|
4282
4231
|
}), /*#__PURE__*/React.createElement("canvas", {
|
|
4283
4232
|
className: "fortune-sheet-canvas",
|
|
4284
|
-
ref: refs.canvas
|
|
4285
|
-
"aria-hidden": "true"
|
|
4233
|
+
ref: refs.canvas
|
|
4286
4234
|
}), /*#__PURE__*/React.createElement(SheetOverlay, null));
|
|
4287
4235
|
};
|
|
4288
4236
|
|
|
@@ -5572,17 +5520,16 @@ var FormatSearch = function FormatSearch(_ref) {
|
|
|
5572
5520
|
button = _locale.button,
|
|
5573
5521
|
format = _locale.format,
|
|
5574
5522
|
currencyDetail = _locale.currencyDetail,
|
|
5575
|
-
dateFmtList = _locale.dateFmtList
|
|
5576
|
-
numberFmtList = _locale.numberFmtList;
|
|
5523
|
+
dateFmtList = _locale.dateFmtList;
|
|
5577
5524
|
var _useDialog = useDialog(),
|
|
5578
5525
|
showDialog = _useDialog.showDialog;
|
|
5579
5526
|
var toolbarFormatAll = useMemo(function () {
|
|
5580
5527
|
return {
|
|
5581
5528
|
currency: currencyDetail,
|
|
5582
5529
|
date: dateFmtList,
|
|
5583
|
-
number:
|
|
5530
|
+
number: []
|
|
5584
5531
|
};
|
|
5585
|
-
}, [currencyDetail, dateFmtList
|
|
5532
|
+
}, [currencyDetail, dateFmtList]);
|
|
5586
5533
|
var toolbarFormat = useMemo(function () {
|
|
5587
5534
|
return toolbarFormatAll[type];
|
|
5588
5535
|
}, [toolbarFormatAll, type]);
|
|
@@ -5596,22 +5543,15 @@ var FormatSearch = function FormatSearch(_ref) {
|
|
|
5596
5543
|
setContext(function (ctx) {
|
|
5597
5544
|
var index = getSheetIndex(ctx, ctx.currentSheetId);
|
|
5598
5545
|
if (_.isNil(index)) return;
|
|
5599
|
-
var
|
|
5600
|
-
var selectedFormatPos;
|
|
5601
|
-
if ("pos" in toolbarFormat[selectedFormatIndex]) selectedFormatPos = toolbarFormat[selectedFormatIndex].pos || "before";
|
|
5546
|
+
var selectedFormat = toolbarFormat[selectedFormatIndex].value;
|
|
5602
5547
|
_.forEach(ctx.luckysheet_select_save, function (selection) {
|
|
5603
5548
|
for (var r = selection.row[0]; r <= selection.row[1]; r += 1) {
|
|
5604
5549
|
for (var c = selection.column[0]; c <= selection.column[1]; c += 1) {
|
|
5605
5550
|
var _ctx$luckysheetfile$i, _ctx$luckysheetfile$i2, _ctx$luckysheetfile$i3, _ctx$luckysheetfile$i4;
|
|
5606
5551
|
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") {
|
|
5607
5552
|
var zero = 0;
|
|
5608
|
-
|
|
5609
|
-
|
|
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
|
-
}
|
|
5553
|
+
ctx.luckysheetfile[index].data[r][c].ct.fa = "".concat(selectedFormat).concat(zero.toFixed(decimalPlace));
|
|
5554
|
+
ctx.luckysheetfile[index].data[r][c].m = update("".concat(selectedFormat).concat(zero.toFixed(decimalPlace)), ctx.luckysheetfile[index].data[r][c].v);
|
|
5615
5555
|
}
|
|
5616
5556
|
}
|
|
5617
5557
|
}
|
|
@@ -5641,8 +5581,10 @@ var FormatSearch = function FormatSearch(_ref) {
|
|
|
5641
5581
|
}
|
|
5642
5582
|
}, tips, format.format, "\uFF1A"), /*#__PURE__*/React.createElement("div", {
|
|
5643
5583
|
className: "inpbox",
|
|
5644
|
-
style: {
|
|
5584
|
+
style: type === "currency" ? {
|
|
5645
5585
|
display: "block"
|
|
5586
|
+
} : {
|
|
5587
|
+
display: "none"
|
|
5646
5588
|
}
|
|
5647
5589
|
}, format.decimalPlaces, "\uFF1A", /*#__PURE__*/React.createElement("input", {
|
|
5648
5590
|
className: "decimal-places-input",
|
|
@@ -5667,8 +5609,10 @@ var FormatSearch = function FormatSearch(_ref) {
|
|
|
5667
5609
|
}, /*#__PURE__*/React.createElement("div", null, v.name), /*#__PURE__*/React.createElement("div", null, v.value));
|
|
5668
5610
|
}))), /*#__PURE__*/React.createElement("div", {
|
|
5669
5611
|
className: "fortune-dialog-box-button-container",
|
|
5670
|
-
style: {
|
|
5612
|
+
style: type === "currency" ? {
|
|
5671
5613
|
marginTop: 40
|
|
5614
|
+
} : {
|
|
5615
|
+
marginTop: 30
|
|
5672
5616
|
}
|
|
5673
5617
|
}, /*#__PURE__*/React.createElement("div", {
|
|
5674
5618
|
className: "fortune-message-box-button button-primary",
|
|
@@ -6851,7 +6795,8 @@ var LocationBox = function LocationBox() {
|
|
|
6851
6795
|
}, /*#__PURE__*/React.createElement("div", {
|
|
6852
6796
|
className: "fortune-name-box",
|
|
6853
6797
|
tabIndex: 0,
|
|
6854
|
-
dir: "ltr"
|
|
6798
|
+
dir: "ltr",
|
|
6799
|
+
"aria-autocomplete": "list"
|
|
6855
6800
|
}, rangeText));
|
|
6856
6801
|
};
|
|
6857
6802
|
|
|
@@ -6875,8 +6820,6 @@ var FxEditor = function FxEditor() {
|
|
|
6875
6820
|
var prevFirstSelection = usePrevious(firstSelection);
|
|
6876
6821
|
var prevSheetId = usePrevious(context.currentSheetId);
|
|
6877
6822
|
var recentText = useRef("");
|
|
6878
|
-
var _locale = locale(context),
|
|
6879
|
-
info = _locale.info;
|
|
6880
6823
|
useEffect(function () {
|
|
6881
6824
|
setIsHidenRC(isShowHidenCR(context));
|
|
6882
6825
|
if (_.isEqual(prevFirstSelection, firstSelection) && context.currentSheetId === prevSheetId) {
|
|
@@ -6993,7 +6936,7 @@ var FxEditor = function FxEditor() {
|
|
|
6993
6936
|
}
|
|
6994
6937
|
return true;
|
|
6995
6938
|
}, [context.config, context.luckysheet_select_save, context.luckysheetfile, context.currentSheetId, isHidenRC]);
|
|
6996
|
-
return /*#__PURE__*/React.createElement("
|
|
6939
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
6997
6940
|
className: "fortune-fx-editor"
|
|
6998
6941
|
}, /*#__PURE__*/React.createElement(LocationBox, null), /*#__PURE__*/React.createElement("div", {
|
|
6999
6942
|
className: "fortune-fx-icon"
|
|
@@ -7009,9 +6952,8 @@ var FxEditor = function FxEditor() {
|
|
|
7009
6952
|
refs.fxInput.current = e;
|
|
7010
6953
|
},
|
|
7011
6954
|
className: "fortune-fx-input",
|
|
7012
|
-
role: "textbox",
|
|
7013
6955
|
id: "luckysheet-functionbox-cell",
|
|
7014
|
-
"aria-
|
|
6956
|
+
"aria-autocomplete": "list",
|
|
7015
6957
|
onFocus: onFocus,
|
|
7016
6958
|
onKeyDown: onKeyDown,
|
|
7017
6959
|
onChange: onChange,
|
|
@@ -7028,7 +6970,7 @@ var FxEditor = function FxEditor() {
|
|
|
7028
6970
|
style: {
|
|
7029
6971
|
top: inputContainerRef.current.clientHeight
|
|
7030
6972
|
}
|
|
7031
|
-
})))))
|
|
6973
|
+
})))));
|
|
7032
6974
|
};
|
|
7033
6975
|
|
|
7034
6976
|
var SheetItem = function SheetItem(_ref) {
|
|
@@ -7054,8 +6996,6 @@ var SheetItem = function SheetItem(_ref) {
|
|
|
7054
6996
|
setSvgColor = _useState6[1];
|
|
7055
6997
|
var _useAlert = useAlert(),
|
|
7056
6998
|
showAlert = _useAlert.showAlert;
|
|
7057
|
-
var _locale = locale(context),
|
|
7058
|
-
info = _locale.info;
|
|
7059
6999
|
useEffect(function () {
|
|
7060
7000
|
setContext(function (draftCtx) {
|
|
7061
7001
|
var r = context.sheetScrollRecord[draftCtx === null || draftCtx === void 0 ? void 0 : draftCtx.currentSheetId];
|
|
@@ -7142,7 +7082,6 @@ var SheetItem = function SheetItem(_ref) {
|
|
|
7142
7082
|
e.stopPropagation();
|
|
7143
7083
|
}, [context.allowEdit, isDropPlaceholder, setContext, sheet.id]);
|
|
7144
7084
|
return /*#__PURE__*/React.createElement("div", {
|
|
7145
|
-
role: "button",
|
|
7146
7085
|
onDragOver: function onDragOver(e) {
|
|
7147
7086
|
e.preventDefault();
|
|
7148
7087
|
e.stopPropagation();
|
|
@@ -7245,8 +7184,7 @@ var SheetItem = function SheetItem(_ref) {
|
|
|
7245
7184
|
};
|
|
7246
7185
|
});
|
|
7247
7186
|
},
|
|
7248
|
-
tabIndex: 0
|
|
7249
|
-
"aria-label": info.sheetOptions
|
|
7187
|
+
tabIndex: 0
|
|
7250
7188
|
}, /*#__PURE__*/React.createElement(SVGIcon, {
|
|
7251
7189
|
name: "downArrow",
|
|
7252
7190
|
width: 12,
|
|
@@ -7298,8 +7236,6 @@ var ZoomControl = function ZoomControl() {
|
|
|
7298
7236
|
_useState2 = _slicedToArray(_useState, 2),
|
|
7299
7237
|
radioMenuOpen = _useState2[0],
|
|
7300
7238
|
setRadioMenuOpen = _useState2[1];
|
|
7301
|
-
var _locale = locale(context),
|
|
7302
|
-
info = _locale.info;
|
|
7303
7239
|
useOutsideClick(menuRef, function () {
|
|
7304
7240
|
setRadioMenuOpen(false);
|
|
7305
7241
|
}, []);
|
|
@@ -7319,18 +7255,15 @@ var ZoomControl = function ZoomControl() {
|
|
|
7319
7255
|
noHistory: true
|
|
7320
7256
|
});
|
|
7321
7257
|
}, [setContext]);
|
|
7322
|
-
return /*#__PURE__*/React.createElement("
|
|
7323
|
-
title: "Zoom settings",
|
|
7258
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
7324
7259
|
className: "fortune-zoom-container"
|
|
7325
7260
|
}, /*#__PURE__*/React.createElement("div", {
|
|
7326
7261
|
className: "fortune-zoom-button",
|
|
7327
|
-
"aria-label": info.zoomOut,
|
|
7328
7262
|
onClick: function onClick(e) {
|
|
7329
7263
|
zoomTo(context.zoomRatio - 0.1);
|
|
7330
7264
|
e.stopPropagation();
|
|
7331
7265
|
},
|
|
7332
|
-
tabIndex: 0
|
|
7333
|
-
role: "button"
|
|
7266
|
+
tabIndex: 0
|
|
7334
7267
|
}, /*#__PURE__*/React.createElement(SVGIcon, {
|
|
7335
7268
|
name: "minus",
|
|
7336
7269
|
width: 16,
|
|
@@ -7360,13 +7293,11 @@ var ZoomControl = function ZoomControl() {
|
|
|
7360
7293
|
}, v.text));
|
|
7361
7294
|
})))), /*#__PURE__*/React.createElement("div", {
|
|
7362
7295
|
className: "fortune-zoom-button",
|
|
7363
|
-
"aria-label": info.zoomIn,
|
|
7364
7296
|
onClick: function onClick(e) {
|
|
7365
7297
|
zoomTo(context.zoomRatio + 0.1);
|
|
7366
7298
|
e.stopPropagation();
|
|
7367
7299
|
},
|
|
7368
|
-
tabIndex: 0
|
|
7369
|
-
role: "button"
|
|
7300
|
+
tabIndex: 0
|
|
7370
7301
|
}, /*#__PURE__*/React.createElement(SVGIcon, {
|
|
7371
7302
|
name: "plus",
|
|
7372
7303
|
width: 16,
|
|
@@ -7391,8 +7322,6 @@ var SheetTab = function SheetTab() {
|
|
|
7391
7322
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
7392
7323
|
isShowBoundary = _useState4[0],
|
|
7393
7324
|
setIsShowBoundary = _useState4[1];
|
|
7394
|
-
var _locale = locale(context),
|
|
7395
|
-
info = _locale.info;
|
|
7396
7325
|
var scrollDelta = 150;
|
|
7397
7326
|
var scrollBy = useCallback(function (amount) {
|
|
7398
7327
|
var _tabContainerRef$curr;
|
|
@@ -7435,10 +7364,7 @@ var SheetTab = function SheetTab() {
|
|
|
7435
7364
|
id: "luckysheet-sheet-content"
|
|
7436
7365
|
}, context.allowEdit && (/*#__PURE__*/React.createElement("div", {
|
|
7437
7366
|
className: "fortune-sheettab-button",
|
|
7438
|
-
onClick: onAddSheetClick
|
|
7439
|
-
tabIndex: 0,
|
|
7440
|
-
"aria-label": info.newSheet,
|
|
7441
|
-
role: "button"
|
|
7367
|
+
onClick: onAddSheetClick
|
|
7442
7368
|
}, /*#__PURE__*/React.createElement(SVGIcon, {
|
|
7443
7369
|
name: "plus",
|
|
7444
7370
|
width: 16,
|
|
@@ -7523,12 +7449,6 @@ var Menu = function Menu(_ref) {
|
|
|
7523
7449
|
_onMouseLeave = _ref.onMouseLeave,
|
|
7524
7450
|
_onMouseEnter = _ref.onMouseEnter,
|
|
7525
7451
|
children = _ref.children;
|
|
7526
|
-
useEffect(function () {
|
|
7527
|
-
var element = document.querySelector(".luckysheet-cols-menuitem");
|
|
7528
|
-
if (element) {
|
|
7529
|
-
element.focus();
|
|
7530
|
-
}
|
|
7531
|
-
}, []);
|
|
7532
7452
|
var containerRef = useRef(null);
|
|
7533
7453
|
return /*#__PURE__*/React.createElement("div", {
|
|
7534
7454
|
ref: containerRef,
|
|
@@ -7709,34 +7629,23 @@ var ContextMenu = function ContextMenu() {
|
|
|
7709
7629
|
key: name,
|
|
7710
7630
|
onClick: function () {
|
|
7711
7631
|
var _onClick = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
7712
|
-
var clipboardText
|
|
7632
|
+
var clipboardText;
|
|
7713
7633
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
7714
7634
|
while (1) switch (_context.prev = _context.next) {
|
|
7715
7635
|
case 0:
|
|
7716
|
-
|
|
7717
|
-
sessionClipboardText = sessionStorage.getItem("localClipboard") || "";
|
|
7718
|
-
_context.prev = 2;
|
|
7719
|
-
_context.next = 5;
|
|
7636
|
+
_context.next = 2;
|
|
7720
7637
|
return navigator.clipboard.readText();
|
|
7721
|
-
case
|
|
7638
|
+
case 2:
|
|
7722
7639
|
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;
|
|
7731
7640
|
setContext(function (draftCtx) {
|
|
7732
|
-
handlePasteByClick(draftCtx,
|
|
7641
|
+
handlePasteByClick(draftCtx, clipboardText);
|
|
7733
7642
|
draftCtx.contextMenu = {};
|
|
7734
7643
|
});
|
|
7735
|
-
case
|
|
7644
|
+
case 4:
|
|
7736
7645
|
case "end":
|
|
7737
7646
|
return _context.stop();
|
|
7738
7647
|
}
|
|
7739
|
-
}, _callee
|
|
7648
|
+
}, _callee);
|
|
7740
7649
|
}));
|
|
7741
7650
|
function onClick() {
|
|
7742
7651
|
return _onClick.apply(this, arguments);
|
|
@@ -10260,17 +10169,10 @@ function generateAPIs(context, setContext, handleUndo, handleRedo, settings, cel
|
|
|
10260
10169
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
10261
10170
|
return api.getSheetWithLatestCelldata(context, options);
|
|
10262
10171
|
},
|
|
10263
|
-
addSheet: function addSheet(
|
|
10264
|
-
|
|
10265
|
-
return
|
|
10172
|
+
addSheet: function addSheet() {
|
|
10173
|
+
return setContext(function (draftCtx) {
|
|
10174
|
+
return api.addSheet(draftCtx, settings);
|
|
10266
10175
|
});
|
|
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
|
-
}
|
|
10274
10176
|
},
|
|
10275
10177
|
deleteSheet: function deleteSheet() {
|
|
10276
10178
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
@@ -10321,9 +10223,11 @@ function generateAPIs(context, setContext, handleUndo, handleRedo, settings, cel
|
|
|
10321
10223
|
},
|
|
10322
10224
|
handleUndo: handleUndo,
|
|
10323
10225
|
handleRedo: handleRedo,
|
|
10324
|
-
calculateFormula: function calculateFormula(
|
|
10226
|
+
calculateFormula: function calculateFormula() {
|
|
10325
10227
|
setContext(function (draftCtx) {
|
|
10326
|
-
|
|
10228
|
+
_.forEach(draftCtx.luckysheetfile, function (sheet_obj) {
|
|
10229
|
+
api.calculateSheetFromula(draftCtx, sheet_obj.id);
|
|
10230
|
+
});
|
|
10327
10231
|
});
|
|
10328
10232
|
},
|
|
10329
10233
|
dataToCelldata: function dataToCelldata(data) {
|
|
@@ -10331,19 +10235,6 @@ function generateAPIs(context, setContext, handleUndo, handleRedo, settings, cel
|
|
|
10331
10235
|
},
|
|
10332
10236
|
celldataToData: function celldataToData(celldata, rowCount, colCount) {
|
|
10333
10237
|
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
|
-
});
|
|
10347
10238
|
}
|
|
10348
10239
|
};
|
|
10349
10240
|
}
|
|
@@ -11124,8 +11015,7 @@ var Workbook = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
11124
11015
|
context = _useState2[0],
|
|
11125
11016
|
setContext = _useState2[1];
|
|
11126
11017
|
var _locale = locale(context),
|
|
11127
|
-
formula = _locale.formula
|
|
11128
|
-
info = _locale.info;
|
|
11018
|
+
formula = _locale.formula;
|
|
11129
11019
|
var _useState3 = useState(null),
|
|
11130
11020
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
11131
11021
|
moreToolbarItems = _useState4[0],
|
|
@@ -11311,7 +11201,7 @@ var Workbook = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
11311
11201
|
var history = globalCache.current.undoList.pop();
|
|
11312
11202
|
if (history) {
|
|
11313
11203
|
setContext(function (ctx_) {
|
|
11314
|
-
var _history$options, _history$options3
|
|
11204
|
+
var _history$options, _history$options3;
|
|
11315
11205
|
if ((_history$options = history.options) === null || _history$options === void 0 ? void 0 : _history$options.deleteSheetOp) {
|
|
11316
11206
|
var _history$options$dele, _history$options$dele2;
|
|
11317
11207
|
history.inversePatches[0].path[1] = ctx_.luckysheetfile.length;
|
|
@@ -11346,7 +11236,6 @@ var Workbook = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
11346
11236
|
delete inversedOptions.addSheet.value.data;
|
|
11347
11237
|
}
|
|
11348
11238
|
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");
|
|
11350
11239
|
return newContext;
|
|
11351
11240
|
});
|
|
11352
11241
|
}
|
|
@@ -11355,11 +11244,9 @@ var Workbook = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
11355
11244
|
var history = globalCache.current.redoList.pop();
|
|
11356
11245
|
if (history) {
|
|
11357
11246
|
setContext(function (ctx_) {
|
|
11358
|
-
var _history$options7, _history$options8, _history$options9;
|
|
11359
11247
|
var newContext = applyPatches(ctx_, history.patches);
|
|
11360
11248
|
globalCache.current.undoList.push(history);
|
|
11361
11249
|
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");
|
|
11363
11250
|
return newContext;
|
|
11364
11251
|
});
|
|
11365
11252
|
}
|
|
@@ -11400,8 +11287,7 @@ var Workbook = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
11400
11287
|
var _draftCtx$luckysheetf;
|
|
11401
11288
|
var index = getSheetIndex(draftCtx, newDatum.id);
|
|
11402
11289
|
var sheet = (_draftCtx$luckysheetf = draftCtx.luckysheetfile) === null || _draftCtx$luckysheetf === void 0 ? void 0 : _draftCtx$luckysheetf[index];
|
|
11403
|
-
|
|
11404
|
-
setFormulaCellInfoMap(draftCtx, sheet.calcChain, cellMatrixData || undefined);
|
|
11290
|
+
initSheetData(draftCtx, sheet, index);
|
|
11405
11291
|
});
|
|
11406
11292
|
}
|
|
11407
11293
|
if (mergedSettings.devicePixelRatio > 0) {
|
|
@@ -11572,15 +11458,7 @@ var Workbook = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
11572
11458
|
className: "fortune-container",
|
|
11573
11459
|
ref: workbookContainer,
|
|
11574
11460
|
onKeyDown: onKeyDown
|
|
11575
|
-
}, /*#__PURE__*/React.createElement(
|
|
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, {
|
|
11461
|
+
}, /*#__PURE__*/React.createElement(SVGDefines, {
|
|
11584
11462
|
currency: mergedSettings.currency
|
|
11585
11463
|
}), /*#__PURE__*/React.createElement("div", {
|
|
11586
11464
|
className: "fortune-workarea"
|