@fileverse-dev/fortune-react 1.0.2-mod-11 → 1.0.2-mod-12
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 +6 -2
- package/dist/components/Workbook/index.d.ts +6 -2
- package/dist/index.css +26 -1
- package/dist/index.esm.css +26 -1
- package/dist/index.esm.js +230 -108
- package/dist/index.js +229 -107
- package/dist/index.umd.css +26 -1
- package/dist/index.umd.js +312 -810
- package/dist/index.umd.min.css +1 -1
- package/dist/index.umd.min.js +2 -2
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -640,7 +640,7 @@ var ColumnHeader = function ColumnHeader() {
|
|
|
640
640
|
className: "fortune-cols-freeze-handle",
|
|
641
641
|
onMouseDown: onColFreezeHandleMouseDown,
|
|
642
642
|
style: {
|
|
643
|
-
left: freezeHandleLeft
|
|
643
|
+
left: freezeHandleLeft || 0
|
|
644
644
|
}
|
|
645
645
|
}), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
646
646
|
className: "fortune-cols-change-size",
|
|
@@ -843,7 +843,7 @@ var RowHeader = function RowHeader() {
|
|
|
843
843
|
className: "fortune-rows-freeze-handle",
|
|
844
844
|
onMouseDown: onRowFreezeHandleMouseDown,
|
|
845
845
|
style: {
|
|
846
|
-
top: freezeHandleTop
|
|
846
|
+
top: freezeHandleTop || 0
|
|
847
847
|
}
|
|
848
848
|
}), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
849
849
|
className: "fortune-rows-change-size",
|
|
@@ -1250,7 +1250,7 @@ var InputBox = function InputBox() {
|
|
|
1250
1250
|
}
|
|
1251
1251
|
e.preventDefault();
|
|
1252
1252
|
}
|
|
1253
|
-
}, [clearSearchItemActiveClass, context.luckysheetCellUpdate.length, selectActiveFormula, setContext
|
|
1253
|
+
}, [clearSearchItemActiveClass, context.luckysheetCellUpdate.length, selectActiveFormula, setContext]);
|
|
1254
1254
|
var onChange = React.useCallback(function (__, isBlur) {
|
|
1255
1255
|
var e = lastKeyDownEventRef.current;
|
|
1256
1256
|
if (!e) return;
|
|
@@ -1296,8 +1296,8 @@ var InputBox = function InputBox() {
|
|
|
1296
1296
|
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
1297
1297
|
className: "luckysheet-input-box-inner",
|
|
1298
1298
|
style: firstSelection ? _objectSpread2({
|
|
1299
|
-
minWidth: firstSelection.width,
|
|
1300
|
-
minHeight: firstSelection.height
|
|
1299
|
+
minWidth: (firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.width) || 0,
|
|
1300
|
+
minHeight: (firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.height) || 0
|
|
1301
1301
|
}, inputBoxStyle) : {}
|
|
1302
1302
|
}, /*#__PURE__*/React__default['default'].createElement(ContentEditable, {
|
|
1303
1303
|
innerRef: function innerRef(e) {
|
|
@@ -1312,7 +1312,6 @@ var InputBox = function InputBox() {
|
|
|
1312
1312
|
width: "".concat(100 / context.zoomRatio, "%"),
|
|
1313
1313
|
height: "".concat(100 / context.zoomRatio, "%")
|
|
1314
1314
|
},
|
|
1315
|
-
"aria-autocomplete": "list",
|
|
1316
1315
|
onChange: onChange,
|
|
1317
1316
|
onKeyDown: onKeyDown,
|
|
1318
1317
|
onPaste: onPaste,
|
|
@@ -2581,7 +2580,7 @@ var DataVerification = function DataVerification() {
|
|
|
2581
2580
|
setContext(function (ctx) {
|
|
2582
2581
|
var isPass = fortuneCore.confirmMessage(ctx, generalDialog, dataVerification);
|
|
2583
2582
|
if (isPass) {
|
|
2584
|
-
var _ctx$dataVerification, _ctx$dataVerification2, _ctx$luckysheetfile$g;
|
|
2583
|
+
var _ctx$dataVerification, _ctx$dataVerification2, _ctx$luckysheetfile$g, _range, _range2, _range3, _range4;
|
|
2585
2584
|
var range = fortuneCore.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);
|
|
2586
2585
|
if (range.length === 0) {
|
|
2587
2586
|
return;
|
|
@@ -2597,12 +2596,12 @@ var DataVerification = function DataVerification() {
|
|
|
2597
2596
|
item.value1 = list.join(",");
|
|
2598
2597
|
}
|
|
2599
2598
|
var currentDataVerification = (_ctx$luckysheetfile$g = ctx.luckysheetfile[fortuneCore.getSheetIndex(ctx, ctx.currentSheetId)].dataVerification) !== null && _ctx$luckysheetfile$g !== void 0 ? _ctx$luckysheetfile$g : {};
|
|
2600
|
-
var str = range[range.length - 1].row[0];
|
|
2601
|
-
var edr = range[range.length - 1].row[1];
|
|
2602
|
-
var stc = range[range.length - 1].column[0];
|
|
2603
|
-
var edc = range[range.length - 1].column[1];
|
|
2599
|
+
var str = (_range = range[range.length - 1]) === null || _range === void 0 ? void 0 : _range.row[0];
|
|
2600
|
+
var edr = (_range2 = range[range.length - 1]) === null || _range2 === void 0 ? void 0 : _range2.row[1];
|
|
2601
|
+
var stc = (_range3 = range[range.length - 1]) === null || _range3 === void 0 ? void 0 : _range3.column[0];
|
|
2602
|
+
var edc = (_range4 = range[range.length - 1]) === null || _range4 === void 0 ? void 0 : _range4.column[1];
|
|
2604
2603
|
var d = fortuneCore.getFlowdata(ctx);
|
|
2605
|
-
if (!d) return;
|
|
2604
|
+
if (!d || ___default['default'].isNil(str) || ___default['default'].isNil(stc) || ___default['default'].isNil(edr) || ___default['default'].isNil(edc)) return;
|
|
2606
2605
|
for (var r = str; r <= edr; r += 1) {
|
|
2607
2606
|
for (var c = stc; c <= edc; c += 1) {
|
|
2608
2607
|
var key = "".concat(r, "_").concat(c);
|
|
@@ -2617,17 +2616,18 @@ var DataVerification = function DataVerification() {
|
|
|
2617
2616
|
});
|
|
2618
2617
|
} else if (type === "delete") {
|
|
2619
2618
|
setContext(function (ctx) {
|
|
2620
|
-
var _ctx$dataVerification3, _ctx$dataVerification4, _ctx$luckysheetfile$g2;
|
|
2619
|
+
var _ctx$dataVerification3, _ctx$dataVerification4, _ctx$luckysheetfile$g2, _range5, _range6, _range7, _range8;
|
|
2621
2620
|
var range = fortuneCore.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);
|
|
2622
2621
|
if (range.length === 0) {
|
|
2623
2622
|
showDialog(generalDialog.noSeletionError, "ok");
|
|
2624
2623
|
return;
|
|
2625
2624
|
}
|
|
2626
2625
|
var currentDataVerification = (_ctx$luckysheetfile$g2 = ctx.luckysheetfile[fortuneCore.getSheetIndex(ctx, ctx.currentSheetId)].dataVerification) !== null && _ctx$luckysheetfile$g2 !== void 0 ? _ctx$luckysheetfile$g2 : {};
|
|
2627
|
-
var str = range[range.length - 1].row[0];
|
|
2628
|
-
var edr = range[range.length - 1].row[1];
|
|
2629
|
-
var stc = range[range.length - 1].column[0];
|
|
2630
|
-
var edc = range[range.length - 1].column[1];
|
|
2626
|
+
var str = (_range5 = range[range.length - 1]) === null || _range5 === void 0 ? void 0 : _range5.row[0];
|
|
2627
|
+
var edr = (_range6 = range[range.length - 1]) === null || _range6 === void 0 ? void 0 : _range6.row[1];
|
|
2628
|
+
var stc = (_range7 = range[range.length - 1]) === null || _range7 === void 0 ? void 0 : _range7.column[0];
|
|
2629
|
+
var edc = (_range8 = range[range.length - 1]) === null || _range8 === void 0 ? void 0 : _range8.column[1];
|
|
2630
|
+
if (___default['default'].isNil(str) || ___default['default'].isNil(stc) || ___default['default'].isNil(edr) || ___default['default'].isNil(edc)) return;
|
|
2631
2631
|
for (var r = str; r <= edr; r += 1) {
|
|
2632
2632
|
for (var c = stc; c <= edc; c += 1) {
|
|
2633
2633
|
delete currentDataVerification["".concat(r, "_").concat(c)];
|
|
@@ -2639,56 +2639,41 @@ var DataVerification = function DataVerification() {
|
|
|
2639
2639
|
}, [dataVerification, generalDialog, hideDialog, setContext, showDialog]);
|
|
2640
2640
|
React.useEffect(function () {
|
|
2641
2641
|
setContext(function (ctx) {
|
|
2642
|
+
var _defaultItem$value, _ctx$rangeDialog, _ctx$rangeDialog2;
|
|
2642
2643
|
var rangeT = "";
|
|
2643
2644
|
if (ctx.luckysheet_select_save) {
|
|
2644
2645
|
var range = ctx.luckysheet_select_save[ctx.luckysheet_select_save.length - 1];
|
|
2645
2646
|
rangeT = fortuneCore.getRangetxt(context, context.currentSheetId, range, context.currentSheetId);
|
|
2646
2647
|
}
|
|
2647
2648
|
var index = fortuneCore.getSheetIndex(ctx, ctx.currentSheetId);
|
|
2648
|
-
var ctxDataVerification = ctx.luckysheetfile[index].dataVerification;
|
|
2649
|
-
if (
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
ctx.
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
rangeTxt: rangeT
|
|
2671
|
-
});
|
|
2672
|
-
} else {
|
|
2673
|
-
ctx.dataVerification.dataRegulation = {
|
|
2674
|
-
type: "dropdown",
|
|
2675
|
-
type2: "",
|
|
2676
|
-
rangeTxt: rangeT,
|
|
2677
|
-
value1: rangValue,
|
|
2678
|
-
value2: "",
|
|
2679
|
-
validity: "",
|
|
2680
|
-
remote: false,
|
|
2681
|
-
prohibitInput: false,
|
|
2682
|
-
hintShow: false,
|
|
2683
|
-
hintValue: ""
|
|
2684
|
-
};
|
|
2685
|
-
}
|
|
2649
|
+
var ctxDataVerification = ctx.luckysheetfile[index].dataVerification || {};
|
|
2650
|
+
if (!ctx.luckysheet_select_save) return;
|
|
2651
|
+
var last = ctx.luckysheet_select_save[ctx.luckysheet_select_save.length - 1];
|
|
2652
|
+
var rowIndex = last.row_focus;
|
|
2653
|
+
var colIndex = last.column_focus;
|
|
2654
|
+
if (rowIndex == null || colIndex == null) return;
|
|
2655
|
+
var item = ctxDataVerification["".concat(rowIndex, "_").concat(colIndex)];
|
|
2656
|
+
var defaultItem = item !== null && item !== void 0 ? item : {};
|
|
2657
|
+
var rangValue = (_defaultItem$value = defaultItem.value1) !== null && _defaultItem$value !== void 0 ? _defaultItem$value : "";
|
|
2658
|
+
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) {
|
|
2659
|
+
rangeT = ctx.dataVerification.dataRegulation.rangeTxt;
|
|
2660
|
+
rangValue = ctx.rangeDialog.rangeTxt;
|
|
2661
|
+
} 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) {
|
|
2662
|
+
rangValue = ctx.dataVerification.dataRegulation.value1;
|
|
2663
|
+
rangeT = ctx.rangeDialog.rangeTxt;
|
|
2664
|
+
}
|
|
2665
|
+
ctx.rangeDialog.type = "";
|
|
2666
|
+
if (item) {
|
|
2667
|
+
ctx.dataVerification.dataRegulation = _objectSpread2(_objectSpread2({}, item), {}, {
|
|
2668
|
+
value1: rangValue,
|
|
2669
|
+
rangeTxt: rangeT
|
|
2670
|
+
});
|
|
2686
2671
|
} else {
|
|
2687
2672
|
ctx.dataVerification.dataRegulation = {
|
|
2688
2673
|
type: "dropdown",
|
|
2689
2674
|
type2: "",
|
|
2690
2675
|
rangeTxt: rangeT,
|
|
2691
|
-
value1:
|
|
2676
|
+
value1: rangValue,
|
|
2692
2677
|
value2: "",
|
|
2693
2678
|
validity: "",
|
|
2694
2679
|
remote: false,
|
|
@@ -3532,7 +3517,7 @@ var DropDownList = function DropDownList() {
|
|
|
3532
3517
|
};
|
|
3533
3518
|
|
|
3534
3519
|
var SheetOverlay = function SheetOverlay() {
|
|
3535
|
-
var _refs$cellArea$curren, _refs$cellArea$curren2, _context$
|
|
3520
|
+
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;
|
|
3536
3521
|
var _useContext = React.useContext(WorkbookContext),
|
|
3537
3522
|
context = _useContext.context,
|
|
3538
3523
|
setContext = _useContext.setContext,
|
|
@@ -3546,6 +3531,14 @@ var SheetOverlay = function SheetOverlay() {
|
|
|
3546
3531
|
var containerRef = React.useRef(null);
|
|
3547
3532
|
var bottomAddRowInputRef = React.useRef(null);
|
|
3548
3533
|
var dataVerificationHintBoxRef = React.useRef(null);
|
|
3534
|
+
var _useState = React.useState(""),
|
|
3535
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
3536
|
+
lastRangeText = _useState2[0],
|
|
3537
|
+
setLastRangeText = _useState2[1];
|
|
3538
|
+
var _useState3 = React.useState(""),
|
|
3539
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
3540
|
+
lastCellValue = _useState4[0],
|
|
3541
|
+
setLastCellValue = _useState4[1];
|
|
3549
3542
|
var _useAlert = useAlert(),
|
|
3550
3543
|
showAlert = _useAlert.showAlert;
|
|
3551
3544
|
var cellAreaMouseDown = React.useCallback(function (e) {
|
|
@@ -3668,6 +3661,20 @@ var SheetOverlay = function SheetOverlay() {
|
|
|
3668
3661
|
insertRowColOp: insertRowColOp
|
|
3669
3662
|
});
|
|
3670
3663
|
}, [context, rightclick.rowOverLimit, setContext, showAlert]);
|
|
3664
|
+
React.useEffect(function () {
|
|
3665
|
+
setContext(function (draftCtx) {
|
|
3666
|
+
var _currentSheet$luckysh;
|
|
3667
|
+
var sheetIndex = fortuneCore.getSheetIndex(draftCtx, draftCtx.currentSheetId);
|
|
3668
|
+
if (sheetIndex === undefined || sheetIndex === null) return;
|
|
3669
|
+
var currentSheet = draftCtx.luckysheetfile[sheetIndex];
|
|
3670
|
+
if (!((_currentSheet$luckysh = currentSheet.luckysheet_select_save) === null || _currentSheet$luckysh === void 0 ? void 0 : _currentSheet$luckysh.length)) {
|
|
3671
|
+
fortuneCore.api.setSelection(draftCtx, [{
|
|
3672
|
+
row: [0],
|
|
3673
|
+
column: [0]
|
|
3674
|
+
}], {});
|
|
3675
|
+
}
|
|
3676
|
+
});
|
|
3677
|
+
}, [context.currentSheetId, setContext]);
|
|
3671
3678
|
React.useEffect(function () {
|
|
3672
3679
|
if (context.warnDialog) {
|
|
3673
3680
|
setTimeout(function () {
|
|
@@ -3710,7 +3717,43 @@ var SheetOverlay = function SheetOverlay() {
|
|
|
3710
3717
|
document.removeEventListener("keydown", onKeyDownForZoom);
|
|
3711
3718
|
};
|
|
3712
3719
|
}, [onKeyDownForZoom]);
|
|
3713
|
-
|
|
3720
|
+
var rangeText = React.useMemo(function () {
|
|
3721
|
+
var lastSelection = ___default['default'].last(context.luckysheet_select_save);
|
|
3722
|
+
if (!(lastSelection && lastSelection.row_focus != null && lastSelection.column_focus != null)) return "";
|
|
3723
|
+
var rf = lastSelection.row_focus;
|
|
3724
|
+
var cf = lastSelection.column_focus;
|
|
3725
|
+
if (context.config.merge != null && "".concat(rf, "_").concat(cf) in context.config.merge) {
|
|
3726
|
+
return fortuneCore.getRangetxt(context, context.currentSheetId, {
|
|
3727
|
+
column: [cf, cf],
|
|
3728
|
+
row: [rf, rf]
|
|
3729
|
+
});
|
|
3730
|
+
}
|
|
3731
|
+
var rawRangeTxt = fortuneCore.getRangetxt(context, context.currentSheetId, lastSelection);
|
|
3732
|
+
return rawRangeTxt.replace(/([A-Z]+)(\d+)/g, "$1. $2");
|
|
3733
|
+
}, [context.currentSheetId, context.luckysheet_select_save]);
|
|
3734
|
+
var cellValue = function cellValue() {
|
|
3735
|
+
var _context$luckysheet_s, _context$luckysheet_s2;
|
|
3736
|
+
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) {
|
|
3737
|
+
var _context$luckysheet_s3, _selection$row_focus, _selection$column_foc, _context$luckysheetfi, _context$luckysheetfi2, _context$luckysheetfi3, _context$luckysheetfi4;
|
|
3738
|
+
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];
|
|
3739
|
+
if (!selection) return "";
|
|
3740
|
+
var sheetIndex = fortuneCore.getSheetIndex(context, context.currentSheetId);
|
|
3741
|
+
if (sheetIndex === undefined || sheetIndex === null) return "";
|
|
3742
|
+
var rowFocus = (_selection$row_focus = selection.row_focus) !== null && _selection$row_focus !== void 0 ? _selection$row_focus : 0;
|
|
3743
|
+
var columnFocus = (_selection$column_foc = selection.column_focus) !== null && _selection$column_foc !== void 0 ? _selection$column_foc : 0;
|
|
3744
|
+
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) || "";
|
|
3745
|
+
return cellVal;
|
|
3746
|
+
}
|
|
3747
|
+
return "";
|
|
3748
|
+
};
|
|
3749
|
+
var computedCellValue = cellValue();
|
|
3750
|
+
React.useEffect(function () {
|
|
3751
|
+
if (context.sheetFocused) {
|
|
3752
|
+
setLastRangeText(String(rangeText));
|
|
3753
|
+
setLastCellValue(String(cellValue()));
|
|
3754
|
+
}
|
|
3755
|
+
}, [context.sheetFocused]);
|
|
3756
|
+
return /*#__PURE__*/React__default['default'].createElement("main", {
|
|
3714
3757
|
className: "fortune-sheet-overlay",
|
|
3715
3758
|
ref: containerRef,
|
|
3716
3759
|
onTouchStart: onTouchStart,
|
|
@@ -3813,20 +3856,20 @@ var SheetOverlay = function SheetOverlay() {
|
|
|
3813
3856
|
hidden: !context.luckysheet_cols_freeze_drag && !context.luckysheet_rows_freeze_drag
|
|
3814
3857
|
}), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
3815
3858
|
className: "luckysheet-cell-selected-focus",
|
|
3816
|
-
style: ((_context$
|
|
3859
|
+
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) {
|
|
3817
3860
|
var selection = ___default['default'].last(context.luckysheet_select_save);
|
|
3818
3861
|
return ___default['default'].assign({
|
|
3819
3862
|
left: selection.left,
|
|
3820
3863
|
top: selection.top,
|
|
3821
|
-
width: selection.width,
|
|
3822
|
-
height: selection.height,
|
|
3864
|
+
width: (selection === null || selection === void 0 ? void 0 : selection.width) || 0,
|
|
3865
|
+
height: (selection === null || selection === void 0 ? void 0 : selection.height) || 0,
|
|
3823
3866
|
display: "block"
|
|
3824
3867
|
}, fortuneCore.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]), fortuneCore.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]));
|
|
3825
3868
|
}() : {},
|
|
3826
3869
|
onMouseDown: function onMouseDown(e) {
|
|
3827
3870
|
return e.preventDefault();
|
|
3828
3871
|
}
|
|
3829
|
-
}), ((_context$
|
|
3872
|
+
}), ((_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__default['default'].createElement("div", {
|
|
3830
3873
|
id: "fortune-selection-copy"
|
|
3831
3874
|
}, context.luckysheet_selection_range.map(function (range) {
|
|
3832
3875
|
var r1 = range.row[0];
|
|
@@ -3867,7 +3910,7 @@ var SheetOverlay = function SheetOverlay() {
|
|
|
3867
3910
|
onMouseDown: function onMouseDown(e) {
|
|
3868
3911
|
return e.preventDefault();
|
|
3869
3912
|
}
|
|
3870
|
-
}), ((_context$
|
|
3913
|
+
}), ((_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__default['default'].createElement("div", {
|
|
3871
3914
|
id: "luckysheet-cell-selected-boxs"
|
|
3872
3915
|
}, context.luckysheet_select_save.map(function (selection, index) {
|
|
3873
3916
|
var _refs$globalCache$fre3, _refs$globalCache$fre4;
|
|
@@ -3878,8 +3921,8 @@ var SheetOverlay = function SheetOverlay() {
|
|
|
3878
3921
|
style: ___default['default'].assign({
|
|
3879
3922
|
left: selection.left_move,
|
|
3880
3923
|
top: selection.top_move,
|
|
3881
|
-
width: selection.width_move,
|
|
3882
|
-
height: selection.height_move,
|
|
3924
|
+
width: (selection === null || selection === void 0 ? void 0 : selection.width_move) || 0,
|
|
3925
|
+
height: (selection === null || selection === void 0 ? void 0 : selection.height_move) || 0,
|
|
3883
3926
|
display: "block"
|
|
3884
3927
|
}, fortuneCore.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]), fortuneCore.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])),
|
|
3885
3928
|
onMouseDown: function onMouseDown(e) {
|
|
@@ -4072,7 +4115,15 @@ var SheetOverlay = function SheetOverlay() {
|
|
|
4072
4115
|
});
|
|
4073
4116
|
},
|
|
4074
4117
|
tabIndex: 0
|
|
4075
|
-
}, info.backTop)))))))
|
|
4118
|
+
}, info.backTop))))))), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
4119
|
+
id: "sr-selection",
|
|
4120
|
+
className: "sr-only",
|
|
4121
|
+
role: "alert"
|
|
4122
|
+
}, !rangeText.includes("NaN") ? "".concat(rangeText, " ").concat(computedCellValue) : "A1. ".concat(info.sheetSrIntro)), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
4123
|
+
id: "sr-sheetFocus",
|
|
4124
|
+
className: "sr-only",
|
|
4125
|
+
role: "alert"
|
|
4126
|
+
}, context.sheetFocused ? "".concat(lastRangeText, " ").concat(lastCellValue ? "".concat(lastCellValue, ".") : "", " ").concat(info.sheetIsFocused) : "Toolbar. ".concat(info.sheetNotFocused)));
|
|
4076
4127
|
};
|
|
4077
4128
|
|
|
4078
4129
|
var Sheet = function Sheet(_ref) {
|
|
@@ -4091,7 +4142,7 @@ var Sheet = function Sheet(_ref) {
|
|
|
4091
4142
|
if (!data) return;
|
|
4092
4143
|
setContext(function (draftCtx) {
|
|
4093
4144
|
if (settings.devicePixelRatio === 0) {
|
|
4094
|
-
draftCtx.devicePixelRatio = (globalThis
|
|
4145
|
+
draftCtx.devicePixelRatio = (typeof globalThis !== "undefined" ? globalThis : window).devicePixelRatio;
|
|
4095
4146
|
}
|
|
4096
4147
|
fortuneCore.updateContextWithSheetData(draftCtx, data);
|
|
4097
4148
|
fortuneCore.updateContextWithCanvas(draftCtx, refs.canvas.current, placeholderRef.current);
|
|
@@ -4241,7 +4292,8 @@ var Sheet = function Sheet(_ref) {
|
|
|
4241
4292
|
className: "fortune-sheet-canvas-placeholder"
|
|
4242
4293
|
}), /*#__PURE__*/React__default['default'].createElement("canvas", {
|
|
4243
4294
|
className: "fortune-sheet-canvas",
|
|
4244
|
-
ref: refs.canvas
|
|
4295
|
+
ref: refs.canvas,
|
|
4296
|
+
"aria-hidden": "true"
|
|
4245
4297
|
}), /*#__PURE__*/React__default['default'].createElement(SheetOverlay, null));
|
|
4246
4298
|
};
|
|
4247
4299
|
|
|
@@ -5531,16 +5583,17 @@ var FormatSearch = function FormatSearch(_ref) {
|
|
|
5531
5583
|
button = _locale.button,
|
|
5532
5584
|
format = _locale.format,
|
|
5533
5585
|
currencyDetail = _locale.currencyDetail,
|
|
5534
|
-
dateFmtList = _locale.dateFmtList
|
|
5586
|
+
dateFmtList = _locale.dateFmtList,
|
|
5587
|
+
numberFmtList = _locale.numberFmtList;
|
|
5535
5588
|
var _useDialog = useDialog(),
|
|
5536
5589
|
showDialog = _useDialog.showDialog;
|
|
5537
5590
|
var toolbarFormatAll = React.useMemo(function () {
|
|
5538
5591
|
return {
|
|
5539
5592
|
currency: currencyDetail,
|
|
5540
5593
|
date: dateFmtList,
|
|
5541
|
-
number:
|
|
5594
|
+
number: numberFmtList
|
|
5542
5595
|
};
|
|
5543
|
-
}, [currencyDetail, dateFmtList]);
|
|
5596
|
+
}, [currencyDetail, dateFmtList, numberFmtList]);
|
|
5544
5597
|
var toolbarFormat = React.useMemo(function () {
|
|
5545
5598
|
return toolbarFormatAll[type];
|
|
5546
5599
|
}, [toolbarFormatAll, type]);
|
|
@@ -5554,15 +5607,22 @@ var FormatSearch = function FormatSearch(_ref) {
|
|
|
5554
5607
|
setContext(function (ctx) {
|
|
5555
5608
|
var index = fortuneCore.getSheetIndex(ctx, ctx.currentSheetId);
|
|
5556
5609
|
if (___default['default'].isNil(index)) return;
|
|
5557
|
-
var
|
|
5610
|
+
var selectedFormatVal = toolbarFormat[selectedFormatIndex].value;
|
|
5611
|
+
var selectedFormatPos;
|
|
5612
|
+
if ("pos" in toolbarFormat[selectedFormatIndex]) selectedFormatPos = toolbarFormat[selectedFormatIndex].pos || "before";
|
|
5558
5613
|
___default['default'].forEach(ctx.luckysheet_select_save, function (selection) {
|
|
5559
5614
|
for (var r = selection.row[0]; r <= selection.row[1]; r += 1) {
|
|
5560
5615
|
for (var c = selection.column[0]; c <= selection.column[1]; c += 1) {
|
|
5561
5616
|
var _ctx$luckysheetfile$i, _ctx$luckysheetfile$i2, _ctx$luckysheetfile$i3, _ctx$luckysheetfile$i4;
|
|
5562
5617
|
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") {
|
|
5563
5618
|
var zero = 0;
|
|
5564
|
-
|
|
5565
|
-
|
|
5619
|
+
if (selectedFormatPos === "after") {
|
|
5620
|
+
ctx.luckysheetfile[index].data[r][c].ct.fa = zero.toFixed(decimalPlace).concat("".concat(selectedFormatVal));
|
|
5621
|
+
ctx.luckysheetfile[index].data[r][c].m = fortuneCore.update(zero.toFixed(decimalPlace).concat("".concat(selectedFormatVal)), ctx.luckysheetfile[index].data[r][c].v);
|
|
5622
|
+
} else {
|
|
5623
|
+
ctx.luckysheetfile[index].data[r][c].ct.fa = "".concat(selectedFormatVal).concat(zero.toFixed(decimalPlace));
|
|
5624
|
+
ctx.luckysheetfile[index].data[r][c].m = fortuneCore.update("".concat(selectedFormatVal).concat(zero.toFixed(decimalPlace)), ctx.luckysheetfile[index].data[r][c].v);
|
|
5625
|
+
}
|
|
5566
5626
|
}
|
|
5567
5627
|
}
|
|
5568
5628
|
}
|
|
@@ -5592,10 +5652,8 @@ var FormatSearch = function FormatSearch(_ref) {
|
|
|
5592
5652
|
}
|
|
5593
5653
|
}, tips, format.format, "\uFF1A"), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
5594
5654
|
className: "inpbox",
|
|
5595
|
-
style:
|
|
5655
|
+
style: {
|
|
5596
5656
|
display: "block"
|
|
5597
|
-
} : {
|
|
5598
|
-
display: "none"
|
|
5599
5657
|
}
|
|
5600
5658
|
}, format.decimalPlaces, "\uFF1A", /*#__PURE__*/React__default['default'].createElement("input", {
|
|
5601
5659
|
className: "decimal-places-input",
|
|
@@ -5620,10 +5678,8 @@ var FormatSearch = function FormatSearch(_ref) {
|
|
|
5620
5678
|
}, /*#__PURE__*/React__default['default'].createElement("div", null, v.name), /*#__PURE__*/React__default['default'].createElement("div", null, v.value));
|
|
5621
5679
|
}))), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
5622
5680
|
className: "fortune-dialog-box-button-container",
|
|
5623
|
-
style:
|
|
5681
|
+
style: {
|
|
5624
5682
|
marginTop: 40
|
|
5625
|
-
} : {
|
|
5626
|
-
marginTop: 30
|
|
5627
5683
|
}
|
|
5628
5684
|
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
5629
5685
|
className: "fortune-message-box-button button-primary",
|
|
@@ -6806,8 +6862,7 @@ var LocationBox = function LocationBox() {
|
|
|
6806
6862
|
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
6807
6863
|
className: "fortune-name-box",
|
|
6808
6864
|
tabIndex: 0,
|
|
6809
|
-
dir: "ltr"
|
|
6810
|
-
"aria-autocomplete": "list"
|
|
6865
|
+
dir: "ltr"
|
|
6811
6866
|
}, rangeText));
|
|
6812
6867
|
};
|
|
6813
6868
|
|
|
@@ -6831,6 +6886,8 @@ var FxEditor = function FxEditor() {
|
|
|
6831
6886
|
var prevFirstSelection = usePrevious(firstSelection);
|
|
6832
6887
|
var prevSheetId = usePrevious(context.currentSheetId);
|
|
6833
6888
|
var recentText = React.useRef("");
|
|
6889
|
+
var _locale = fortuneCore.locale(context),
|
|
6890
|
+
info = _locale.info;
|
|
6834
6891
|
React.useEffect(function () {
|
|
6835
6892
|
setIsHidenRC(fortuneCore.isShowHidenCR(context));
|
|
6836
6893
|
if (___default['default'].isEqual(prevFirstSelection, firstSelection) && context.currentSheetId === prevSheetId) {
|
|
@@ -6947,7 +7004,7 @@ var FxEditor = function FxEditor() {
|
|
|
6947
7004
|
}
|
|
6948
7005
|
return true;
|
|
6949
7006
|
}, [context.config, context.luckysheet_select_save, context.luckysheetfile, context.currentSheetId, isHidenRC]);
|
|
6950
|
-
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
7007
|
+
return /*#__PURE__*/React__default['default'].createElement("aside", null, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
6951
7008
|
className: "fortune-fx-editor"
|
|
6952
7009
|
}, /*#__PURE__*/React__default['default'].createElement(LocationBox, null), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
6953
7010
|
className: "fortune-fx-icon"
|
|
@@ -6963,8 +7020,9 @@ var FxEditor = function FxEditor() {
|
|
|
6963
7020
|
refs.fxInput.current = e;
|
|
6964
7021
|
},
|
|
6965
7022
|
className: "fortune-fx-input",
|
|
7023
|
+
role: "textbox",
|
|
6966
7024
|
id: "luckysheet-functionbox-cell",
|
|
6967
|
-
"aria-
|
|
7025
|
+
"aria-label": info.currentCellInput,
|
|
6968
7026
|
onFocus: onFocus,
|
|
6969
7027
|
onKeyDown: onKeyDown,
|
|
6970
7028
|
onChange: onChange,
|
|
@@ -6981,7 +7039,7 @@ var FxEditor = function FxEditor() {
|
|
|
6981
7039
|
style: {
|
|
6982
7040
|
top: inputContainerRef.current.clientHeight
|
|
6983
7041
|
}
|
|
6984
|
-
})))));
|
|
7042
|
+
}))))));
|
|
6985
7043
|
};
|
|
6986
7044
|
|
|
6987
7045
|
var SheetItem = function SheetItem(_ref) {
|
|
@@ -7007,6 +7065,8 @@ var SheetItem = function SheetItem(_ref) {
|
|
|
7007
7065
|
setSvgColor = _useState6[1];
|
|
7008
7066
|
var _useAlert = useAlert(),
|
|
7009
7067
|
showAlert = _useAlert.showAlert;
|
|
7068
|
+
var _locale = fortuneCore.locale(context),
|
|
7069
|
+
info = _locale.info;
|
|
7010
7070
|
React.useEffect(function () {
|
|
7011
7071
|
setContext(function (draftCtx) {
|
|
7012
7072
|
var r = context.sheetScrollRecord[draftCtx === null || draftCtx === void 0 ? void 0 : draftCtx.currentSheetId];
|
|
@@ -7093,6 +7153,7 @@ var SheetItem = function SheetItem(_ref) {
|
|
|
7093
7153
|
e.stopPropagation();
|
|
7094
7154
|
}, [context.allowEdit, isDropPlaceholder, setContext, sheet.id]);
|
|
7095
7155
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
7156
|
+
role: "button",
|
|
7096
7157
|
onDragOver: function onDragOver(e) {
|
|
7097
7158
|
e.preventDefault();
|
|
7098
7159
|
e.stopPropagation();
|
|
@@ -7195,7 +7256,8 @@ var SheetItem = function SheetItem(_ref) {
|
|
|
7195
7256
|
};
|
|
7196
7257
|
});
|
|
7197
7258
|
},
|
|
7198
|
-
tabIndex: 0
|
|
7259
|
+
tabIndex: 0,
|
|
7260
|
+
"aria-label": info.sheetOptions
|
|
7199
7261
|
}, /*#__PURE__*/React__default['default'].createElement(SVGIcon, {
|
|
7200
7262
|
name: "downArrow",
|
|
7201
7263
|
width: 12,
|
|
@@ -7247,6 +7309,8 @@ var ZoomControl = function ZoomControl() {
|
|
|
7247
7309
|
_useState2 = _slicedToArray(_useState, 2),
|
|
7248
7310
|
radioMenuOpen = _useState2[0],
|
|
7249
7311
|
setRadioMenuOpen = _useState2[1];
|
|
7312
|
+
var _locale = fortuneCore.locale(context),
|
|
7313
|
+
info = _locale.info;
|
|
7250
7314
|
useOutsideClick(menuRef, function () {
|
|
7251
7315
|
setRadioMenuOpen(false);
|
|
7252
7316
|
}, []);
|
|
@@ -7266,15 +7330,18 @@ var ZoomControl = function ZoomControl() {
|
|
|
7266
7330
|
noHistory: true
|
|
7267
7331
|
});
|
|
7268
7332
|
}, [setContext]);
|
|
7269
|
-
return /*#__PURE__*/React__default['default'].createElement("
|
|
7333
|
+
return /*#__PURE__*/React__default['default'].createElement("aside", {
|
|
7334
|
+
title: "Zoom settings",
|
|
7270
7335
|
className: "fortune-zoom-container"
|
|
7271
7336
|
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
7272
7337
|
className: "fortune-zoom-button",
|
|
7338
|
+
"aria-label": info.zoomOut,
|
|
7273
7339
|
onClick: function onClick(e) {
|
|
7274
7340
|
zoomTo(context.zoomRatio - 0.1);
|
|
7275
7341
|
e.stopPropagation();
|
|
7276
7342
|
},
|
|
7277
|
-
tabIndex: 0
|
|
7343
|
+
tabIndex: 0,
|
|
7344
|
+
role: "button"
|
|
7278
7345
|
}, /*#__PURE__*/React__default['default'].createElement(SVGIcon, {
|
|
7279
7346
|
name: "minus",
|
|
7280
7347
|
width: 16,
|
|
@@ -7304,11 +7371,13 @@ var ZoomControl = function ZoomControl() {
|
|
|
7304
7371
|
}, v.text));
|
|
7305
7372
|
})))), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
7306
7373
|
className: "fortune-zoom-button",
|
|
7374
|
+
"aria-label": info.zoomIn,
|
|
7307
7375
|
onClick: function onClick(e) {
|
|
7308
7376
|
zoomTo(context.zoomRatio + 0.1);
|
|
7309
7377
|
e.stopPropagation();
|
|
7310
7378
|
},
|
|
7311
|
-
tabIndex: 0
|
|
7379
|
+
tabIndex: 0,
|
|
7380
|
+
role: "button"
|
|
7312
7381
|
}, /*#__PURE__*/React__default['default'].createElement(SVGIcon, {
|
|
7313
7382
|
name: "plus",
|
|
7314
7383
|
width: 16,
|
|
@@ -7333,6 +7402,8 @@ var SheetTab = function SheetTab() {
|
|
|
7333
7402
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
7334
7403
|
isShowBoundary = _useState4[0],
|
|
7335
7404
|
setIsShowBoundary = _useState4[1];
|
|
7405
|
+
var _locale = fortuneCore.locale(context),
|
|
7406
|
+
info = _locale.info;
|
|
7336
7407
|
var scrollDelta = 150;
|
|
7337
7408
|
var scrollBy = React.useCallback(function (amount) {
|
|
7338
7409
|
var _tabContainerRef$curr;
|
|
@@ -7375,7 +7446,10 @@ var SheetTab = function SheetTab() {
|
|
|
7375
7446
|
id: "luckysheet-sheet-content"
|
|
7376
7447
|
}, context.allowEdit && (/*#__PURE__*/React__default['default'].createElement("div", {
|
|
7377
7448
|
className: "fortune-sheettab-button",
|
|
7378
|
-
onClick: onAddSheetClick
|
|
7449
|
+
onClick: onAddSheetClick,
|
|
7450
|
+
tabIndex: 0,
|
|
7451
|
+
"aria-label": info.newSheet,
|
|
7452
|
+
role: "button"
|
|
7379
7453
|
}, /*#__PURE__*/React__default['default'].createElement(SVGIcon, {
|
|
7380
7454
|
name: "plus",
|
|
7381
7455
|
width: 16,
|
|
@@ -7460,6 +7534,12 @@ var Menu = function Menu(_ref) {
|
|
|
7460
7534
|
_onMouseLeave = _ref.onMouseLeave,
|
|
7461
7535
|
_onMouseEnter = _ref.onMouseEnter,
|
|
7462
7536
|
children = _ref.children;
|
|
7537
|
+
React.useEffect(function () {
|
|
7538
|
+
var element = document.querySelector(".luckysheet-cols-menuitem");
|
|
7539
|
+
if (element) {
|
|
7540
|
+
element.focus();
|
|
7541
|
+
}
|
|
7542
|
+
}, []);
|
|
7463
7543
|
var containerRef = React.useRef(null);
|
|
7464
7544
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
7465
7545
|
ref: containerRef,
|
|
@@ -7640,23 +7720,34 @@ var ContextMenu = function ContextMenu() {
|
|
|
7640
7720
|
key: name,
|
|
7641
7721
|
onClick: function () {
|
|
7642
7722
|
var _onClick = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
7643
|
-
var clipboardText;
|
|
7723
|
+
var clipboardText, sessionClipboardText, finalText;
|
|
7644
7724
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
7645
7725
|
while (1) switch (_context.prev = _context.next) {
|
|
7646
7726
|
case 0:
|
|
7647
|
-
|
|
7727
|
+
clipboardText = "";
|
|
7728
|
+
sessionClipboardText = sessionStorage.getItem("localClipboard") || "";
|
|
7729
|
+
_context.prev = 2;
|
|
7730
|
+
_context.next = 5;
|
|
7648
7731
|
return navigator.clipboard.readText();
|
|
7649
|
-
case
|
|
7732
|
+
case 5:
|
|
7650
7733
|
clipboardText = _context.sent;
|
|
7734
|
+
_context.next = 11;
|
|
7735
|
+
break;
|
|
7736
|
+
case 8:
|
|
7737
|
+
_context.prev = 8;
|
|
7738
|
+
_context.t0 = _context["catch"](2);
|
|
7739
|
+
console.warn("Clipboard access blocked. Attempting to use sessionStorage fallback.");
|
|
7740
|
+
case 11:
|
|
7741
|
+
finalText = clipboardText || sessionClipboardText;
|
|
7651
7742
|
setContext(function (draftCtx) {
|
|
7652
|
-
fortuneCore.handlePasteByClick(draftCtx,
|
|
7743
|
+
fortuneCore.handlePasteByClick(draftCtx, finalText);
|
|
7653
7744
|
draftCtx.contextMenu = {};
|
|
7654
7745
|
});
|
|
7655
|
-
case
|
|
7746
|
+
case 13:
|
|
7656
7747
|
case "end":
|
|
7657
7748
|
return _context.stop();
|
|
7658
7749
|
}
|
|
7659
|
-
}, _callee);
|
|
7750
|
+
}, _callee, null, [[2, 8]]);
|
|
7660
7751
|
}));
|
|
7661
7752
|
function onClick() {
|
|
7662
7753
|
return _onClick.apply(this, arguments);
|
|
@@ -10180,10 +10271,17 @@ function generateAPIs(context, setContext, handleUndo, handleRedo, settings, cel
|
|
|
10180
10271
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
10181
10272
|
return fortuneCore.api.getSheetWithLatestCelldata(context, options);
|
|
10182
10273
|
},
|
|
10183
|
-
addSheet: function addSheet() {
|
|
10184
|
-
|
|
10185
|
-
return
|
|
10274
|
+
addSheet: function addSheet(sheetId) {
|
|
10275
|
+
var existingSheetIds = fortuneCore.api.getAllSheets(context).map(function (sheet) {
|
|
10276
|
+
return sheet.id || "";
|
|
10186
10277
|
});
|
|
10278
|
+
if (sheetId && existingSheetIds.includes(sheetId)) {
|
|
10279
|
+
console.error("Failed to add new sheet: A sheet with the id \"".concat(sheetId, "\" already exists. Please use a unique sheet id."));
|
|
10280
|
+
} else {
|
|
10281
|
+
setContext(function (draftCtx) {
|
|
10282
|
+
return fortuneCore.api.addSheet(draftCtx, settings, sheetId);
|
|
10283
|
+
});
|
|
10284
|
+
}
|
|
10187
10285
|
},
|
|
10188
10286
|
deleteSheet: function deleteSheet() {
|
|
10189
10287
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
@@ -10234,11 +10332,9 @@ function generateAPIs(context, setContext, handleUndo, handleRedo, settings, cel
|
|
|
10234
10332
|
},
|
|
10235
10333
|
handleUndo: handleUndo,
|
|
10236
10334
|
handleRedo: handleRedo,
|
|
10237
|
-
calculateFormula: function calculateFormula() {
|
|
10335
|
+
calculateFormula: function calculateFormula(id, range) {
|
|
10238
10336
|
setContext(function (draftCtx) {
|
|
10239
|
-
|
|
10240
|
-
fortuneCore.api.calculateSheetFromula(draftCtx, sheet_obj.id);
|
|
10241
|
-
});
|
|
10337
|
+
fortuneCore.api.calculateFormula(draftCtx, id, range);
|
|
10242
10338
|
});
|
|
10243
10339
|
},
|
|
10244
10340
|
dataToCelldata: function dataToCelldata(data) {
|
|
@@ -10246,6 +10342,19 @@ function generateAPIs(context, setContext, handleUndo, handleRedo, settings, cel
|
|
|
10246
10342
|
},
|
|
10247
10343
|
celldataToData: function celldataToData(celldata, rowCount, colCount) {
|
|
10248
10344
|
return fortuneCore.api.celldataToData(celldata, rowCount, colCount);
|
|
10345
|
+
},
|
|
10346
|
+
batchCallApis: function batchCallApis(apiCalls) {
|
|
10347
|
+
setContext(function (draftCtx) {
|
|
10348
|
+
apiCalls.forEach(function (apiCall) {
|
|
10349
|
+
var name = apiCall.name,
|
|
10350
|
+
args = apiCall.args;
|
|
10351
|
+
if (typeof fortuneCore.api[name] === "function") {
|
|
10352
|
+
fortuneCore.api[name].apply(fortuneCore.api, [draftCtx].concat(_toConsumableArray(args)));
|
|
10353
|
+
} else {
|
|
10354
|
+
console.warn("API ".concat(name, " does not exist"));
|
|
10355
|
+
}
|
|
10356
|
+
});
|
|
10357
|
+
});
|
|
10249
10358
|
}
|
|
10250
10359
|
};
|
|
10251
10360
|
}
|
|
@@ -11026,7 +11135,8 @@ var Workbook = /*#__PURE__*/React__default['default'].forwardRef(function (_ref,
|
|
|
11026
11135
|
context = _useState2[0],
|
|
11027
11136
|
setContext = _useState2[1];
|
|
11028
11137
|
var _locale = fortuneCore.locale(context),
|
|
11029
|
-
formula = _locale.formula
|
|
11138
|
+
formula = _locale.formula,
|
|
11139
|
+
info = _locale.info;
|
|
11030
11140
|
var _useState3 = React.useState(null),
|
|
11031
11141
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
11032
11142
|
moreToolbarItems = _useState4[0],
|
|
@@ -11212,7 +11322,7 @@ var Workbook = /*#__PURE__*/React__default['default'].forwardRef(function (_ref,
|
|
|
11212
11322
|
var history = globalCache.current.undoList.pop();
|
|
11213
11323
|
if (history) {
|
|
11214
11324
|
setContext(function (ctx_) {
|
|
11215
|
-
var _history$options, _history$options3;
|
|
11325
|
+
var _history$options, _history$options3, _history$options4, _history$options5, _history$options6;
|
|
11216
11326
|
if ((_history$options = history.options) === null || _history$options === void 0 ? void 0 : _history$options.deleteSheetOp) {
|
|
11217
11327
|
var _history$options$dele, _history$options$dele2;
|
|
11218
11328
|
history.inversePatches[0].path[1] = ctx_.luckysheetfile.length;
|
|
@@ -11247,6 +11357,7 @@ var Workbook = /*#__PURE__*/React__default['default'].forwardRef(function (_ref,
|
|
|
11247
11357
|
delete inversedOptions.addSheet.value.data;
|
|
11248
11358
|
}
|
|
11249
11359
|
emitOp(newContext, history.inversePatches, inversedOptions, true);
|
|
11360
|
+
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");
|
|
11250
11361
|
return newContext;
|
|
11251
11362
|
});
|
|
11252
11363
|
}
|
|
@@ -11255,9 +11366,11 @@ var Workbook = /*#__PURE__*/React__default['default'].forwardRef(function (_ref,
|
|
|
11255
11366
|
var history = globalCache.current.redoList.pop();
|
|
11256
11367
|
if (history) {
|
|
11257
11368
|
setContext(function (ctx_) {
|
|
11369
|
+
var _history$options7, _history$options8, _history$options9;
|
|
11258
11370
|
var newContext = produce.applyPatches(ctx_, history.patches);
|
|
11259
11371
|
globalCache.current.undoList.push(history);
|
|
11260
11372
|
emitOp(newContext, history.patches, history.options);
|
|
11373
|
+
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");
|
|
11261
11374
|
return newContext;
|
|
11262
11375
|
});
|
|
11263
11376
|
}
|
|
@@ -11298,7 +11411,8 @@ var Workbook = /*#__PURE__*/React__default['default'].forwardRef(function (_ref,
|
|
|
11298
11411
|
var _draftCtx$luckysheetf;
|
|
11299
11412
|
var index = fortuneCore.getSheetIndex(draftCtx, newDatum.id);
|
|
11300
11413
|
var sheet = (_draftCtx$luckysheetf = draftCtx.luckysheetfile) === null || _draftCtx$luckysheetf === void 0 ? void 0 : _draftCtx$luckysheetf[index];
|
|
11301
|
-
initSheetData(draftCtx, sheet, index);
|
|
11414
|
+
var cellMatrixData = initSheetData(draftCtx, sheet, index);
|
|
11415
|
+
fortuneCore.setFormulaCellInfoMap(draftCtx, sheet.calcChain, cellMatrixData || undefined);
|
|
11302
11416
|
});
|
|
11303
11417
|
}
|
|
11304
11418
|
if (mergedSettings.devicePixelRatio > 0) {
|
|
@@ -11469,7 +11583,15 @@ var Workbook = /*#__PURE__*/React__default['default'].forwardRef(function (_ref,
|
|
|
11469
11583
|
className: "fortune-container",
|
|
11470
11584
|
ref: workbookContainer,
|
|
11471
11585
|
onKeyDown: onKeyDown
|
|
11472
|
-
}, /*#__PURE__*/React__default['default'].createElement(
|
|
11586
|
+
}, /*#__PURE__*/React__default['default'].createElement("section", {
|
|
11587
|
+
"aria-labelledby": "shortcuts-heading",
|
|
11588
|
+
id: "shortcut-list",
|
|
11589
|
+
className: "sr-only",
|
|
11590
|
+
tabIndex: 0,
|
|
11591
|
+
"aria-live": "polite"
|
|
11592
|
+
}, /*#__PURE__*/React__default['default'].createElement("h2", {
|
|
11593
|
+
id: "shortcuts-heading"
|
|
11594
|
+
}, info.shortcuts), /*#__PURE__*/React__default['default'].createElement("ul", null, /*#__PURE__*/React__default['default'].createElement("li", null, info.toggleSheetFocusShortcut), /*#__PURE__*/React__default['default'].createElement("li", null, info.selectRangeShortcut), /*#__PURE__*/React__default['default'].createElement("li", null, info.autoFillDownShortcut), /*#__PURE__*/React__default['default'].createElement("li", null, info.autoFillRightShortcut), /*#__PURE__*/React__default['default'].createElement("li", null, info.boldTextShortcut), /*#__PURE__*/React__default['default'].createElement("li", null, info.copyShortcut), /*#__PURE__*/React__default['default'].createElement("li", null, info.pasteShortcut), /*#__PURE__*/React__default['default'].createElement("li", null, info.undoShortcut), /*#__PURE__*/React__default['default'].createElement("li", null, info.redoShortcut), /*#__PURE__*/React__default['default'].createElement("li", null, info.deleteCellContentShortcut), /*#__PURE__*/React__default['default'].createElement("li", null, info.confirmCellEditShortcut), /*#__PURE__*/React__default['default'].createElement("li", null, info.moveRightShortcut), /*#__PURE__*/React__default['default'].createElement("li", null, info.moveLeftShortcut))), /*#__PURE__*/React__default['default'].createElement(SVGDefines, {
|
|
11473
11595
|
currency: mergedSettings.currency
|
|
11474
11596
|
}), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
11475
11597
|
className: "fortune-workarea"
|