@leankylin-sheet/react 7.0.41 → 7.0.43
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/SheetOverlay/UpdatingMask.d.ts +3 -0
- package/dist/context/index.d.ts +1 -0
- package/dist/index.css +45 -1
- package/dist/index.esm.css +45 -1
- package/dist/index.esm.js +173 -39
- package/dist/index.js +171 -37
- package/dist/index.umd.css +45 -1
- package/dist/index.umd.js +171 -37
- package/dist/index.umd.min.css +1 -1
- package/dist/index.umd.min.js +1 -1
- package/dist/utils/commitWithMask.d.ts +5 -0
- package/package.json +3 -3
package/dist/index.umd.js
CHANGED
|
@@ -19641,6 +19641,7 @@
|
|
|
19641
19641
|
context: core.defaultContext(defaultRefs),
|
|
19642
19642
|
setContext: function setContext() {},
|
|
19643
19643
|
setScrollContext: function setScrollContext() {},
|
|
19644
|
+
commitWithMask: function commitWithMask() {},
|
|
19644
19645
|
settings: core.defaultSettings,
|
|
19645
19646
|
handleUndo: function handleUndo() {},
|
|
19646
19647
|
handleRedo: function handleRedo() {},
|
|
@@ -19675,11 +19676,51 @@
|
|
|
19675
19676
|
}));
|
|
19676
19677
|
};
|
|
19677
19678
|
|
|
19679
|
+
function isBlurCommitContext(ctx) {
|
|
19680
|
+
if (ctx.isUpdatingCell) return false;
|
|
19681
|
+
if (!ctx.luckysheetCellUpdate || ctx.luckysheetCellUpdate.length === 0) {
|
|
19682
|
+
return false;
|
|
19683
|
+
}
|
|
19684
|
+
if (ctx.active_f) return false;
|
|
19685
|
+
var _ctx$formulaCache = ctx.formulaCache,
|
|
19686
|
+
rangestart = _ctx$formulaCache.rangestart,
|
|
19687
|
+
rangedrag_column_start = _ctx$formulaCache.rangedrag_column_start,
|
|
19688
|
+
rangedrag_row_start = _ctx$formulaCache.rangedrag_row_start;
|
|
19689
|
+
if (rangestart || rangedrag_column_start || rangedrag_row_start) return false;
|
|
19690
|
+
if (core.israngeseleciton(ctx)) return false;
|
|
19691
|
+
return true;
|
|
19692
|
+
}
|
|
19693
|
+
function createCommitWithMask(setContext) {
|
|
19694
|
+
return function (recipe, options) {
|
|
19695
|
+
reactDom.flushSync(function () {
|
|
19696
|
+
setContext(function (ctx) {
|
|
19697
|
+
ctx.isUpdatingCell = true;
|
|
19698
|
+
}, {
|
|
19699
|
+
noHistory: true
|
|
19700
|
+
});
|
|
19701
|
+
});
|
|
19702
|
+
requestAnimationFrame(function () {
|
|
19703
|
+
requestAnimationFrame(function () {
|
|
19704
|
+
try {
|
|
19705
|
+
setContext(recipe, options);
|
|
19706
|
+
} finally {
|
|
19707
|
+
setContext(function (ctx) {
|
|
19708
|
+
ctx.isUpdatingCell = false;
|
|
19709
|
+
}, {
|
|
19710
|
+
noHistory: true
|
|
19711
|
+
});
|
|
19712
|
+
}
|
|
19713
|
+
});
|
|
19714
|
+
});
|
|
19715
|
+
};
|
|
19716
|
+
}
|
|
19717
|
+
|
|
19678
19718
|
var ColumnHeader = function ColumnHeader() {
|
|
19679
19719
|
var _refs$globalCache$fre2, _settings$renderFreez;
|
|
19680
19720
|
var _useContext = React.useContext(WorkbookContext),
|
|
19681
19721
|
context = _useContext.context,
|
|
19682
19722
|
setContext = _useContext.setContext,
|
|
19723
|
+
commitWithMask = _useContext.commitWithMask,
|
|
19683
19724
|
settings = _useContext.settings,
|
|
19684
19725
|
refs = _useContext.refs;
|
|
19685
19726
|
var containerRef = React.useRef(null);
|
|
@@ -19743,10 +19784,15 @@
|
|
|
19743
19784
|
}, [context, hoverLocation.col_index, refs.globalCache.freezen]);
|
|
19744
19785
|
var onMouseDown = React.useCallback(function (e) {
|
|
19745
19786
|
var nativeEvent = e.nativeEvent;
|
|
19746
|
-
|
|
19787
|
+
var runRecipe = function runRecipe(draftCtx) {
|
|
19747
19788
|
core.handleColumnHeaderMouseDown(draftCtx, refs.globalCache, nativeEvent, containerRef.current, refs.cellInput.current, refs.fxInput.current);
|
|
19748
|
-
}
|
|
19749
|
-
|
|
19789
|
+
};
|
|
19790
|
+
if (isBlurCommitContext(context)) {
|
|
19791
|
+
commitWithMask(runRecipe);
|
|
19792
|
+
} else {
|
|
19793
|
+
setContext(runRecipe);
|
|
19794
|
+
}
|
|
19795
|
+
}, [context, commitWithMask, refs.globalCache, refs.cellInput, refs.fxInput, setContext]);
|
|
19750
19796
|
var onMouseLeave = React.useCallback(function () {
|
|
19751
19797
|
if (context.luckysheet_cols_change_size) {
|
|
19752
19798
|
return;
|
|
@@ -19902,6 +19948,7 @@
|
|
|
19902
19948
|
var _useContext = React.useContext(WorkbookContext),
|
|
19903
19949
|
context = _useContext.context,
|
|
19904
19950
|
setContext = _useContext.setContext,
|
|
19951
|
+
commitWithMask = _useContext.commitWithMask,
|
|
19905
19952
|
settings = _useContext.settings,
|
|
19906
19953
|
refs = _useContext.refs;
|
|
19907
19954
|
var rowChangeSizeRef = React.useRef(null);
|
|
@@ -19959,10 +20006,15 @@
|
|
|
19959
20006
|
}, [context.luckysheet_rows_change_size, context.visibledatarow, hoverLocation.row, hoverLocation.row_pre, refs.globalCache.freezen, context.currentSheetId]);
|
|
19960
20007
|
var onMouseDown = React.useCallback(function (e) {
|
|
19961
20008
|
var nativeEvent = e.nativeEvent;
|
|
19962
|
-
|
|
20009
|
+
var runRecipe = function runRecipe(draftCtx) {
|
|
19963
20010
|
core.handleRowHeaderMouseDown(draftCtx, refs.globalCache, nativeEvent, containerRef.current, refs.cellInput.current, refs.fxInput.current);
|
|
19964
|
-
}
|
|
19965
|
-
|
|
20011
|
+
};
|
|
20012
|
+
if (isBlurCommitContext(context)) {
|
|
20013
|
+
commitWithMask(runRecipe);
|
|
20014
|
+
} else {
|
|
20015
|
+
setContext(runRecipe);
|
|
20016
|
+
}
|
|
20017
|
+
}, [context, commitWithMask, refs.globalCache, refs.cellInput, refs.fxInput, setContext]);
|
|
19966
20018
|
var onMouseLeave = React.useCallback(function () {
|
|
19967
20019
|
if (context.luckysheet_rows_change_size) {
|
|
19968
20020
|
return;
|
|
@@ -20567,6 +20619,7 @@
|
|
|
20567
20619
|
var _useContext = React.useContext(WorkbookContext),
|
|
20568
20620
|
context = _useContext.context,
|
|
20569
20621
|
setContext = _useContext.setContext,
|
|
20622
|
+
commitWithMask = _useContext.commitWithMask,
|
|
20570
20623
|
refs = _useContext.refs,
|
|
20571
20624
|
settings = _useContext.settings;
|
|
20572
20625
|
var inputRef = React.useRef(null);
|
|
@@ -20648,6 +20701,11 @@
|
|
|
20648
20701
|
var onKeyDown = React.useCallback(function (e) {
|
|
20649
20702
|
lastKeyDownEventRef.current = new KeyboardEvent(e.type, e.nativeEvent);
|
|
20650
20703
|
preText.current = inputRef.current.innerText;
|
|
20704
|
+
if (context.isUpdatingCell) {
|
|
20705
|
+
e.preventDefault();
|
|
20706
|
+
e.stopPropagation();
|
|
20707
|
+
return;
|
|
20708
|
+
}
|
|
20651
20709
|
if (e.key === "Escape" && context.luckysheetCellUpdate.length > 0) {
|
|
20652
20710
|
setContext(function (draftCtx) {
|
|
20653
20711
|
core.cancelNormalSelected(draftCtx);
|
|
@@ -20661,17 +20719,18 @@
|
|
|
20661
20719
|
e.stopPropagation();
|
|
20662
20720
|
}
|
|
20663
20721
|
} else if (e.key === "Tab" && context.luckysheetCellUpdate.length > 0) {
|
|
20664
|
-
setContext(function (draftCtx) {
|
|
20665
|
-
core.updateCell(draftCtx, draftCtx.luckysheetCellUpdate[0], draftCtx.luckysheetCellUpdate[1], refs.cellInput.current);
|
|
20666
|
-
core.moveHighlightCell(draftCtx, "right", 1, "rangeOfSelect");
|
|
20667
|
-
});
|
|
20668
20722
|
e.preventDefault();
|
|
20669
20723
|
e.stopPropagation();
|
|
20724
|
+
commitWithMask(function (draftCtx) {
|
|
20725
|
+
core.updateCell(draftCtx, draftCtx.luckysheetCellUpdate[0], draftCtx.luckysheetCellUpdate[1], refs.cellInput.current);
|
|
20726
|
+
core.moveHighlightCell(draftCtx, "right", 1, "rangeOfSelect");
|
|
20727
|
+
}, undefined, refs.cellInput.current);
|
|
20670
20728
|
} else if (e.key === "F4" && context.luckysheetCellUpdate.length > 0) {
|
|
20671
20729
|
e.preventDefault();
|
|
20672
20730
|
}
|
|
20673
|
-
}, [context.luckysheetCellUpdate.length, refs.cellInput, setContext]);
|
|
20731
|
+
}, [context.luckysheetCellUpdate.length, context.isUpdatingCell, commitWithMask, refs.cellInput, setContext]);
|
|
20674
20732
|
var onChange = React.useCallback(function (__, isBlur) {
|
|
20733
|
+
if (context.isUpdatingCell) return;
|
|
20675
20734
|
var e = lastKeyDownEventRef.current;
|
|
20676
20735
|
if (!e) return;
|
|
20677
20736
|
var kcode = e.keyCode;
|
|
@@ -20684,7 +20743,7 @@
|
|
|
20684
20743
|
});
|
|
20685
20744
|
}
|
|
20686
20745
|
lastKeyDownEventRef.current = undefined;
|
|
20687
|
-
}, [refs.cellInput, refs.fxInput, setContext]);
|
|
20746
|
+
}, [context.isUpdatingCell, refs.cellInput, refs.fxInput, setContext]);
|
|
20688
20747
|
var onPaste = React.useCallback(function (e) {
|
|
20689
20748
|
if (lodash.isEmpty(context.luckysheetCellUpdate)) {
|
|
20690
20749
|
e.preventDefault();
|
|
@@ -20738,7 +20797,7 @@
|
|
|
20738
20797
|
onChange: onChange,
|
|
20739
20798
|
onKeyDown: onKeyDown,
|
|
20740
20799
|
onPaste: onPaste,
|
|
20741
|
-
allowEdit: edit ? !isHidenRC : edit
|
|
20800
|
+
allowEdit: edit ? !isHidenRC && !context.isUpdatingCell : edit
|
|
20742
20801
|
})), document.activeElement === inputRef.current && ( /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, (_settings$renderEdito = settings.renderEditorSelector) === null || _settings$renderEdito === void 0 ? void 0 : _settings$renderEdito.call(settings, inputRef.current, context.functionCandidates, context.functionHint, context.formulaCache.functionlistMap), /*#__PURE__*/React__default['default'].createElement(FormulaSearch, {
|
|
20743
20802
|
style: {
|
|
20744
20803
|
top: ((firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.height_move) || 0) + 4
|
|
@@ -20750,6 +20809,30 @@
|
|
|
20750
20809
|
}))));
|
|
20751
20810
|
};
|
|
20752
20811
|
|
|
20812
|
+
var UpdatingMask = function UpdatingMask() {
|
|
20813
|
+
var _context$luckysheet_s;
|
|
20814
|
+
var _useContext = React.useContext(WorkbookContext),
|
|
20815
|
+
context = _useContext.context;
|
|
20816
|
+
if (!context.isUpdatingCell) return null;
|
|
20817
|
+
var selection = (_context$luckysheet_s = context.luckysheet_select_save) === null || _context$luckysheet_s === void 0 ? void 0 : _context$luckysheet_s[0];
|
|
20818
|
+
if (!selection || selection.left == null || selection.top == null) {
|
|
20819
|
+
return null;
|
|
20820
|
+
}
|
|
20821
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
20822
|
+
className: "luckysheet-updating-mask",
|
|
20823
|
+
style: {
|
|
20824
|
+
left: selection.left,
|
|
20825
|
+
top: selection.top,
|
|
20826
|
+
width: selection.width,
|
|
20827
|
+
height: selection.height
|
|
20828
|
+
}
|
|
20829
|
+
}, /*#__PURE__*/React__default['default'].createElement("span", {
|
|
20830
|
+
className: "luckysheet-updating-mask-spinner"
|
|
20831
|
+
}), /*#__PURE__*/React__default['default'].createElement("span", {
|
|
20832
|
+
className: "luckysheet-updating-mask-text"
|
|
20833
|
+
}, core.locale(context).edit.updatingRelatedCells));
|
|
20834
|
+
};
|
|
20835
|
+
|
|
20753
20836
|
var ScrollBar = function ScrollBar(_ref) {
|
|
20754
20837
|
var axis = _ref.axis;
|
|
20755
20838
|
var _useContext = React.useContext(WorkbookContext),
|
|
@@ -23560,6 +23643,7 @@
|
|
|
23560
23643
|
var _useContext = React.useContext(WorkbookContext),
|
|
23561
23644
|
context = _useContext.context,
|
|
23562
23645
|
setContext = _useContext.setContext,
|
|
23646
|
+
commitWithMask = _useContext.commitWithMask,
|
|
23563
23647
|
settings = _useContext.settings,
|
|
23564
23648
|
refs = _useContext.refs;
|
|
23565
23649
|
var _useInViewport = useInViewport(refs.cellArea),
|
|
@@ -23574,7 +23658,7 @@
|
|
|
23574
23658
|
var cellAreaMouseDown = React.useCallback(function (e) {
|
|
23575
23659
|
var nativeEvent = e.nativeEvent;
|
|
23576
23660
|
if (e.button !== 2) {
|
|
23577
|
-
|
|
23661
|
+
var runRecipe = function runRecipe(draftCtx) {
|
|
23578
23662
|
var _draftCtx$luckysheet_;
|
|
23579
23663
|
core.handleCellAreaMouseDown(draftCtx, refs.globalCache, nativeEvent, refs.cellInput.current, refs.cellArea.current, refs.fxInput.current, refs.canvas.current.getContext("2d"));
|
|
23580
23664
|
if (!lodash.isEmpty((_draftCtx$luckysheet_ = draftCtx.luckysheet_select_save) === null || _draftCtx$luckysheet_ === void 0 ? void 0 : _draftCtx$luckysheet_[0]) && refs.cellInput.current) {
|
|
@@ -23583,9 +23667,14 @@
|
|
|
23583
23667
|
(_refs$cellInput$curre = refs.cellInput.current) === null || _refs$cellInput$curre === void 0 ? void 0 : _refs$cellInput$curre.focus();
|
|
23584
23668
|
});
|
|
23585
23669
|
}
|
|
23586
|
-
}
|
|
23670
|
+
};
|
|
23671
|
+
if (isBlurCommitContext(context)) {
|
|
23672
|
+
commitWithMask(runRecipe);
|
|
23673
|
+
} else {
|
|
23674
|
+
setContext(runRecipe);
|
|
23675
|
+
}
|
|
23587
23676
|
}
|
|
23588
|
-
}, [setContext, refs.globalCache, refs.cellInput, refs.cellArea, refs.fxInput, refs.canvas]);
|
|
23677
|
+
}, [context, commitWithMask, setContext, refs.globalCache, refs.cellInput, refs.cellArea, refs.fxInput, refs.canvas]);
|
|
23589
23678
|
var debounceMouseMove = useMemoizedFn(function (e) {
|
|
23590
23679
|
var nativeEvent = e.nativeEvent;
|
|
23591
23680
|
core.handleCellAreaMouseMove(context, refs.globalCache, nativeEvent, refs.cellArea.current);
|
|
@@ -23628,10 +23717,11 @@
|
|
|
23628
23717
|
}, [refs.workbookContainer, setContext, settings, refs.cellArea]);
|
|
23629
23718
|
var cellAreaDoubleClick = React.useCallback(function (e) {
|
|
23630
23719
|
var nativeEvent = e.nativeEvent;
|
|
23720
|
+
if (context.isUpdatingCell) return;
|
|
23631
23721
|
setContext(function (draftCtx) {
|
|
23632
23722
|
core.handleCellAreaDoubleClick(draftCtx, refs.globalCache, settings, nativeEvent, refs.cellArea.current);
|
|
23633
23723
|
});
|
|
23634
|
-
}, [refs.cellArea, refs.globalCache, setContext, settings]);
|
|
23724
|
+
}, [context.isUpdatingCell, refs.cellArea, refs.globalCache, setContext, settings]);
|
|
23635
23725
|
var onLeftTopClick = React.useCallback(function () {
|
|
23636
23726
|
setContext(function (draftCtx) {
|
|
23637
23727
|
core.selectAll(draftCtx);
|
|
@@ -24031,7 +24121,7 @@
|
|
|
24031
24121
|
getContainer: function getContainer() {
|
|
24032
24122
|
return containerRef.current;
|
|
24033
24123
|
}
|
|
24034
|
-
}), /*#__PURE__*/React__default['default'].createElement(InputBox, null), /*#__PURE__*/React__default['default'].createElement(NotationBoxes, null), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
24124
|
+
}), /*#__PURE__*/React__default['default'].createElement(InputBox, null), /*#__PURE__*/React__default['default'].createElement(UpdatingMask, null), /*#__PURE__*/React__default['default'].createElement(NotationBoxes, null), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
24035
24125
|
id: "luckysheet-multipleRange-show"
|
|
24036
24126
|
}), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
24037
24127
|
id: "luckysheet-dynamicArray-hightShow"
|
|
@@ -26976,6 +27066,7 @@
|
|
|
26976
27066
|
var _useContext = React.useContext(WorkbookContext),
|
|
26977
27067
|
context = _useContext.context,
|
|
26978
27068
|
setContext = _useContext.setContext,
|
|
27069
|
+
commitWithMask = _useContext.commitWithMask,
|
|
26979
27070
|
refs = _useContext.refs,
|
|
26980
27071
|
settings = _useContext.settings;
|
|
26981
27072
|
var _useState = React.useState(false),
|
|
@@ -27056,6 +27147,9 @@
|
|
|
27056
27147
|
if (context.allowEdit === false) {
|
|
27057
27148
|
return;
|
|
27058
27149
|
}
|
|
27150
|
+
if (context.isUpdatingCell) {
|
|
27151
|
+
return;
|
|
27152
|
+
}
|
|
27059
27153
|
lastKeyDownEventRef.current = new KeyboardEvent(e.type, e.nativeEvent);
|
|
27060
27154
|
var key = e.key;
|
|
27061
27155
|
recentText.current = refs.fxInput.current.innerText;
|
|
@@ -27065,7 +27159,7 @@
|
|
|
27065
27159
|
if (!["Enter", "Escape", "ArrowLeft", "ArrowRight"].includes(key)) {
|
|
27066
27160
|
return;
|
|
27067
27161
|
}
|
|
27068
|
-
|
|
27162
|
+
var runRecipe = function runRecipe(draftCtx) {
|
|
27069
27163
|
if (context.luckysheetCellUpdate.length > 0) {
|
|
27070
27164
|
switch (key) {
|
|
27071
27165
|
case "Enter":
|
|
@@ -27079,8 +27173,6 @@
|
|
|
27079
27173
|
column_focus: lastCellUpdate[1]
|
|
27080
27174
|
}];
|
|
27081
27175
|
core.moveHighlightCell(draftCtx, "down", 1, "rangeOfSelect");
|
|
27082
|
-
e.preventDefault();
|
|
27083
|
-
e.stopPropagation();
|
|
27084
27176
|
break;
|
|
27085
27177
|
}
|
|
27086
27178
|
case "Escape":
|
|
@@ -27103,8 +27195,15 @@
|
|
|
27103
27195
|
}
|
|
27104
27196
|
}
|
|
27105
27197
|
}
|
|
27106
|
-
}
|
|
27107
|
-
|
|
27198
|
+
};
|
|
27199
|
+
if (key === "Enter" && context.luckysheetCellUpdate.length > 0) {
|
|
27200
|
+
e.preventDefault();
|
|
27201
|
+
e.stopPropagation();
|
|
27202
|
+
commitWithMask(runRecipe, undefined, refs.fxInput.current);
|
|
27203
|
+
return;
|
|
27204
|
+
}
|
|
27205
|
+
setContext(runRecipe);
|
|
27206
|
+
}, [context.allowEdit, context.luckysheetCellUpdate.length, context.isUpdatingCell, commitWithMask, refs.fxInput, setContext]);
|
|
27108
27207
|
var onChange = React.useCallback(function () {
|
|
27109
27208
|
var e = lastKeyDownEventRef.current;
|
|
27110
27209
|
if (!e) return;
|
|
@@ -27123,11 +27222,14 @@
|
|
|
27123
27222
|
if (isHidenRC) {
|
|
27124
27223
|
return false;
|
|
27125
27224
|
}
|
|
27225
|
+
if (context.isUpdatingCell) {
|
|
27226
|
+
return false;
|
|
27227
|
+
}
|
|
27126
27228
|
if (!core.isAllowEdit(context, context.luckysheet_select_save)) {
|
|
27127
27229
|
return false;
|
|
27128
27230
|
}
|
|
27129
27231
|
return true;
|
|
27130
|
-
}, [context.config, context.luckysheet_select_save, context.luckysheetfile, context.currentSheetId, isHidenRC]);
|
|
27232
|
+
}, [context.config, context.luckysheet_select_save, context.luckysheetfile, context.currentSheetId, context.isUpdatingCell, isHidenRC]);
|
|
27131
27233
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
27132
27234
|
className: "leankylin-fx-editor"
|
|
27133
27235
|
}, /*#__PURE__*/React__default['default'].createElement(LocationBox, null), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
@@ -31316,10 +31418,7 @@
|
|
|
31316
31418
|
}, (sheet === null || sheet === void 0 ? void 0 : sheet.hide) === 1 ? ( /*#__PURE__*/React__default['default'].createElement(SVGIcon, {
|
|
31317
31419
|
name: "hidden",
|
|
31318
31420
|
width: 16,
|
|
31319
|
-
height: 16
|
|
31320
|
-
style: {
|
|
31321
|
-
marginTop: "7px"
|
|
31322
|
-
}
|
|
31421
|
+
height: 16
|
|
31323
31422
|
})) : "");
|
|
31324
31423
|
};
|
|
31325
31424
|
|
|
@@ -31702,6 +31801,19 @@
|
|
|
31702
31801
|
return result;
|
|
31703
31802
|
});
|
|
31704
31803
|
});
|
|
31804
|
+
var commitWithMask = useMemoizedFn(function (recipe, options, $input, force) {
|
|
31805
|
+
var _ctx$luckysheetCellUp;
|
|
31806
|
+
var ctx = contextRef.current;
|
|
31807
|
+
var _ref2 = (_ctx$luckysheetCellUp = ctx.luckysheetCellUpdate) !== null && _ctx$luckysheetCellUp !== void 0 ? _ctx$luckysheetCellUp : [],
|
|
31808
|
+
_ref3 = _slicedToArray(_ref2, 2),
|
|
31809
|
+
r = _ref3[0],
|
|
31810
|
+
c = _ref3[1];
|
|
31811
|
+
if (!force && (lodash.isNil(r) || lodash.isNil(c) || core.isCellEditUnchanged(ctx, r, c, $input !== null && $input !== void 0 ? $input : cellInput.current, undefined, ctx.currentSheetId))) {
|
|
31812
|
+
setContextWithProduce(recipe, options);
|
|
31813
|
+
return;
|
|
31814
|
+
}
|
|
31815
|
+
createCommitWithMask(setContextWithProduce)(recipe, options);
|
|
31816
|
+
});
|
|
31705
31817
|
var handleUndo = React.useCallback(function () {
|
|
31706
31818
|
var history = globalCache.current.undoList.pop();
|
|
31707
31819
|
if (history) {
|
|
@@ -31775,12 +31887,13 @@
|
|
|
31775
31887
|
context: context,
|
|
31776
31888
|
setContext: setContextWithProduce,
|
|
31777
31889
|
setScrollContext: setScrollContext,
|
|
31890
|
+
commitWithMask: commitWithMask,
|
|
31778
31891
|
settings: mergedSettings,
|
|
31779
31892
|
handleUndo: handleUndo,
|
|
31780
31893
|
handleRedo: handleRedo,
|
|
31781
31894
|
refs: refs
|
|
31782
31895
|
};
|
|
31783
|
-
}, [context, handleRedo, handleUndo, mergedSettings, refs, setContextWithProduce, setScrollContext]);
|
|
31896
|
+
}, [context, handleRedo, handleUndo, mergedSettings, refs, setContextWithProduce, setScrollContext, commitWithMask]);
|
|
31784
31897
|
React.useEffect(function () {
|
|
31785
31898
|
if (!lodash.isEmpty(context.luckysheetfile)) {
|
|
31786
31899
|
onChange === null || onChange === void 0 ? void 0 : onChange(context.luckysheetfile);
|
|
@@ -31931,21 +32044,42 @@
|
|
|
31931
32044
|
e.preventDefault();
|
|
31932
32045
|
return;
|
|
31933
32046
|
}
|
|
31934
|
-
|
|
32047
|
+
var runRecipe = function runRecipe(draftCtx) {
|
|
31935
32048
|
core.handleGlobalKeyDown(draftCtx, cellInput.current, fxInput.current, nativeEvent, globalCache.current, handleUndo, handleRedo, canvas.current.getContext("2d"), refs);
|
|
31936
|
-
}
|
|
31937
|
-
|
|
32049
|
+
};
|
|
32050
|
+
if (nativeEvent.key === "Enter" && !nativeEvent.altKey && !nativeEvent.metaKey && !contextRef.current.isUpdatingCell && contextRef.current.luckysheetCellUpdate.length > 0) {
|
|
32051
|
+
nativeEvent.preventDefault();
|
|
32052
|
+
commitWithMask(runRecipe);
|
|
32053
|
+
return;
|
|
32054
|
+
}
|
|
32055
|
+
setContextWithProduce(runRecipe);
|
|
32056
|
+
}, [handleRedo, handleUndo, setContextWithProduce, commitWithMask, mergedSettings.disabledKeyboardCodes]);
|
|
31938
32057
|
var onPaste = React.useCallback(function (e) {
|
|
31939
|
-
if (isFocusRef.current && lodash.isEmpty(
|
|
31940
|
-
|
|
32058
|
+
if (isFocusRef.current && lodash.isEmpty(contextRef.current.luckysheetCellUpdate)) {
|
|
32059
|
+
var _e$clipboardData$getD, _e$clipboardData, _e$clipboardData$getD2, _e$clipboardData2, _e$clipboardData$getD3, _e$clipboardData3;
|
|
32060
|
+
var snapshot = {
|
|
32061
|
+
"text/html": (_e$clipboardData$getD = (_e$clipboardData = e.clipboardData) === null || _e$clipboardData === void 0 ? void 0 : _e$clipboardData.getData("text/html")) !== null && _e$clipboardData$getD !== void 0 ? _e$clipboardData$getD : "",
|
|
32062
|
+
"text/plain": (_e$clipboardData$getD2 = (_e$clipboardData2 = e.clipboardData) === null || _e$clipboardData2 === void 0 ? void 0 : _e$clipboardData2.getData("text/plain")) !== null && _e$clipboardData$getD2 !== void 0 ? _e$clipboardData$getD2 : "",
|
|
32063
|
+
text: (_e$clipboardData$getD3 = (_e$clipboardData3 = e.clipboardData) === null || _e$clipboardData3 === void 0 ? void 0 : _e$clipboardData3.getData("text")) !== null && _e$clipboardData$getD3 !== void 0 ? _e$clipboardData$getD3 : ""
|
|
32064
|
+
};
|
|
32065
|
+
var hasText = Boolean(snapshot["text/html"] || snapshot["text/plain"] || snapshot.text);
|
|
32066
|
+
var snapshotEvent = {
|
|
32067
|
+
clipboardData: {
|
|
32068
|
+
getData: function getData(type) {
|
|
32069
|
+
var _snapshot$type;
|
|
32070
|
+
return (_snapshot$type = snapshot[type]) !== null && _snapshot$type !== void 0 ? _snapshot$type : "";
|
|
32071
|
+
}
|
|
32072
|
+
}
|
|
32073
|
+
};
|
|
32074
|
+
commitWithMask(function (draftCtx) {
|
|
31941
32075
|
try {
|
|
31942
|
-
core.handlePasteByLeanklin(draftCtx,
|
|
32076
|
+
core.handlePasteByLeanklin(draftCtx, snapshotEvent, mergedSettings.copyRich);
|
|
31943
32077
|
} catch (err) {
|
|
31944
32078
|
console.error(err);
|
|
31945
32079
|
}
|
|
31946
|
-
});
|
|
32080
|
+
}, undefined, undefined, hasText);
|
|
31947
32081
|
}
|
|
31948
|
-
}, [
|
|
32082
|
+
}, [commitWithMask, mergedSettings.copyRich]);
|
|
31949
32083
|
var onMoreToolbarItemsClose = React.useCallback(function () {
|
|
31950
32084
|
setMoreToolbarItems(null);
|
|
31951
32085
|
}, []);
|