@leankylin-sheet/react 1.2.9 → 1.2.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.js +11 -4
- package/dist/index.js +11 -4
- package/dist/index.umd.js +15 -9
- package/dist/index.umd.min.js +2 -2
- package/package.json +3 -2
package/dist/index.esm.js
CHANGED
|
@@ -2,6 +2,7 @@ import { defaultContext, defaultSettings, getSheetIndex, colLocationByIndex, fix
|
|
|
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';
|
|
5
|
+
import { createPortal } from 'react-dom';
|
|
5
6
|
|
|
6
7
|
function _iterableToArrayLimit(r, l) {
|
|
7
8
|
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
@@ -1202,7 +1203,7 @@ var SearchReplace = function SearchReplace(_ref) {
|
|
|
1202
1203
|
top: (rect.height - 200) / 3
|
|
1203
1204
|
};
|
|
1204
1205
|
}, []);
|
|
1205
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
1206
|
+
return /*#__PURE__*/createPortal( /*#__PURE__*/React.createElement("div", {
|
|
1206
1207
|
id: "leankylin-search-replace",
|
|
1207
1208
|
className: "leankylin-search-replace leankylin-dialog",
|
|
1208
1209
|
style: getInitialPosition(getContainer()),
|
|
@@ -1351,7 +1352,10 @@ var SearchReplace = function SearchReplace(_ref) {
|
|
|
1351
1352
|
className: "close-button leankylin-message-box-button button-default",
|
|
1352
1353
|
onClick: closeDialog
|
|
1353
1354
|
}, button.close), searchResult.length > 0 && ( /*#__PURE__*/React.createElement("div", {
|
|
1354
|
-
id: "searchAllbox"
|
|
1355
|
+
id: "searchAllbox",
|
|
1356
|
+
onScroll: function onScroll(e) {
|
|
1357
|
+
return e.stopPropagation();
|
|
1358
|
+
}
|
|
1355
1359
|
}, /*#__PURE__*/React.createElement("div", {
|
|
1356
1360
|
className: "boxTitle"
|
|
1357
1361
|
}, /*#__PURE__*/React.createElement("span", null, findAndReplace.searchTargetSheet), /*#__PURE__*/React.createElement("span", null, findAndReplace.searchTargetCell), /*#__PURE__*/React.createElement("span", null, findAndReplace.searchTargetValue)), /*#__PURE__*/React.createElement("div", {
|
|
@@ -1377,7 +1381,7 @@ var SearchReplace = function SearchReplace(_ref) {
|
|
|
1377
1381
|
});
|
|
1378
1382
|
}
|
|
1379
1383
|
}, /*#__PURE__*/React.createElement("span", null, v.sheetName), /*#__PURE__*/React.createElement("span", null, v.cellPosition), /*#__PURE__*/React.createElement("span", null, v.value));
|
|
1380
|
-
}))))));
|
|
1384
|
+
})))))), document.querySelector("body"));
|
|
1381
1385
|
};
|
|
1382
1386
|
|
|
1383
1387
|
var LinkEditCard = function LinkEditCard(_ref) {
|
|
@@ -10683,6 +10687,9 @@ var Workbook = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
10683
10687
|
}, [context.currentSheetId, context.luckysheetfile.length, originalData, mergedSettings.defaultRowHeight, mergedSettings.defaultColWidth, mergedSettings.column, mergedSettings.row, mergedSettings.defaultFontSize, mergedSettings.devicePixelRatio, mergedSettings.lang, mergedSettings.allowEdit, mergedSettings.hooks, mergedSettings.generateSheetId, setContextWithProduce, initSheetData, mergedSettings.rowHeaderWidth, mergedSettings.columnHeaderHeight, mergedSettings.addRows]);
|
|
10684
10688
|
var onKeyDown = useCallback(function (e) {
|
|
10685
10689
|
var nativeEvent = e.nativeEvent;
|
|
10690
|
+
if ((e.ctrlKey || e.metaKey) && mergedSettings.disabledKeyboardCodes.includes(e.code)) {
|
|
10691
|
+
return;
|
|
10692
|
+
}
|
|
10686
10693
|
if ((e.ctrlKey || e.metaKey) && e.code === "KeyZ") {
|
|
10687
10694
|
if (e.shiftKey) {
|
|
10688
10695
|
handleRedo();
|
|
@@ -10701,7 +10708,7 @@ var Workbook = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
10701
10708
|
setContextWithProduce(function (draftCtx) {
|
|
10702
10709
|
handleGlobalKeyDown(draftCtx, cellInput.current, fxInput.current, nativeEvent, globalCache.current, handleUndo, handleRedo, canvas.current.getContext("2d"));
|
|
10703
10710
|
});
|
|
10704
|
-
}, [handleRedo, handleUndo, setContextWithProduce]);
|
|
10711
|
+
}, [handleRedo, handleUndo, setContextWithProduce, mergedSettings.disabledKeyboardCodes]);
|
|
10705
10712
|
var onPaste = useCallback(function (e) {
|
|
10706
10713
|
var _document$activeEleme;
|
|
10707
10714
|
if (cellInput.current === document.activeElement || ((_document$activeEleme = document.activeElement) === null || _document$activeEleme === void 0 ? void 0 : _document$activeEleme.className) === "leankylin-sheet-overlay") {
|
package/dist/index.js
CHANGED
|
@@ -6,6 +6,7 @@ var core = require('@leankylin-sheet/core');
|
|
|
6
6
|
var React = require('react');
|
|
7
7
|
var produce = require('immer');
|
|
8
8
|
var _ = require('lodash');
|
|
9
|
+
var reactDom = require('react-dom');
|
|
9
10
|
|
|
10
11
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
11
12
|
|
|
@@ -1212,7 +1213,7 @@ var SearchReplace = function SearchReplace(_ref) {
|
|
|
1212
1213
|
top: (rect.height - 200) / 3
|
|
1213
1214
|
};
|
|
1214
1215
|
}, []);
|
|
1215
|
-
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
1216
|
+
return /*#__PURE__*/reactDom.createPortal( /*#__PURE__*/React__default['default'].createElement("div", {
|
|
1216
1217
|
id: "leankylin-search-replace",
|
|
1217
1218
|
className: "leankylin-search-replace leankylin-dialog",
|
|
1218
1219
|
style: getInitialPosition(getContainer()),
|
|
@@ -1361,7 +1362,10 @@ var SearchReplace = function SearchReplace(_ref) {
|
|
|
1361
1362
|
className: "close-button leankylin-message-box-button button-default",
|
|
1362
1363
|
onClick: closeDialog
|
|
1363
1364
|
}, button.close), searchResult.length > 0 && ( /*#__PURE__*/React__default['default'].createElement("div", {
|
|
1364
|
-
id: "searchAllbox"
|
|
1365
|
+
id: "searchAllbox",
|
|
1366
|
+
onScroll: function onScroll(e) {
|
|
1367
|
+
return e.stopPropagation();
|
|
1368
|
+
}
|
|
1365
1369
|
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
1366
1370
|
className: "boxTitle"
|
|
1367
1371
|
}, /*#__PURE__*/React__default['default'].createElement("span", null, findAndReplace.searchTargetSheet), /*#__PURE__*/React__default['default'].createElement("span", null, findAndReplace.searchTargetCell), /*#__PURE__*/React__default['default'].createElement("span", null, findAndReplace.searchTargetValue)), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
@@ -1387,7 +1391,7 @@ var SearchReplace = function SearchReplace(_ref) {
|
|
|
1387
1391
|
});
|
|
1388
1392
|
}
|
|
1389
1393
|
}, /*#__PURE__*/React__default['default'].createElement("span", null, v.sheetName), /*#__PURE__*/React__default['default'].createElement("span", null, v.cellPosition), /*#__PURE__*/React__default['default'].createElement("span", null, v.value));
|
|
1390
|
-
}))))));
|
|
1394
|
+
})))))), document.querySelector("body"));
|
|
1391
1395
|
};
|
|
1392
1396
|
|
|
1393
1397
|
var LinkEditCard = function LinkEditCard(_ref) {
|
|
@@ -10693,6 +10697,9 @@ var Workbook = /*#__PURE__*/React__default['default'].forwardRef(function (_ref,
|
|
|
10693
10697
|
}, [context.currentSheetId, context.luckysheetfile.length, originalData, mergedSettings.defaultRowHeight, mergedSettings.defaultColWidth, mergedSettings.column, mergedSettings.row, mergedSettings.defaultFontSize, mergedSettings.devicePixelRatio, mergedSettings.lang, mergedSettings.allowEdit, mergedSettings.hooks, mergedSettings.generateSheetId, setContextWithProduce, initSheetData, mergedSettings.rowHeaderWidth, mergedSettings.columnHeaderHeight, mergedSettings.addRows]);
|
|
10694
10698
|
var onKeyDown = React.useCallback(function (e) {
|
|
10695
10699
|
var nativeEvent = e.nativeEvent;
|
|
10700
|
+
if ((e.ctrlKey || e.metaKey) && mergedSettings.disabledKeyboardCodes.includes(e.code)) {
|
|
10701
|
+
return;
|
|
10702
|
+
}
|
|
10696
10703
|
if ((e.ctrlKey || e.metaKey) && e.code === "KeyZ") {
|
|
10697
10704
|
if (e.shiftKey) {
|
|
10698
10705
|
handleRedo();
|
|
@@ -10711,7 +10718,7 @@ var Workbook = /*#__PURE__*/React__default['default'].forwardRef(function (_ref,
|
|
|
10711
10718
|
setContextWithProduce(function (draftCtx) {
|
|
10712
10719
|
core.handleGlobalKeyDown(draftCtx, cellInput.current, fxInput.current, nativeEvent, globalCache.current, handleUndo, handleRedo, canvas.current.getContext("2d"));
|
|
10713
10720
|
});
|
|
10714
|
-
}, [handleRedo, handleUndo, setContextWithProduce]);
|
|
10721
|
+
}, [handleRedo, handleUndo, setContextWithProduce, mergedSettings.disabledKeyboardCodes]);
|
|
10715
10722
|
var onPaste = React.useCallback(function (e) {
|
|
10716
10723
|
var _document$activeEleme;
|
|
10717
10724
|
if (cellInput.current === document.activeElement || ((_document$activeEleme = document.activeElement) === null || _document$activeEleme === void 0 ? void 0 : _document$activeEleme.className) === "leankylin-sheet-overlay") {
|