@leankylin-sheet/react 4.0.35 → 4.0.37
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.css +1 -0
- package/dist/index.esm.css +1 -0
- package/dist/index.esm.js +86 -30
- package/dist/index.js +85 -29
- package/dist/index.umd.css +1 -0
- package/dist/index.umd.js +85 -29
- package/dist/index.umd.min.css +1 -1
- package/dist/index.umd.min.js +1 -1
- package/package.json +3 -3
package/dist/index.css
CHANGED
package/dist/index.esm.css
CHANGED
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, functionHTMLGenerate, locale, getCellValue, createRangeHightlight, isInlineStringCell, getInlineStringHTML, valueShowEs, escapeHTMLTag, escapeScriptTag,
|
|
1
|
+
import { defaultContext, defaultSettings, getSheetIndex, colLocationByIndex, fixPositionOnFrozenCells, colLocation, getFlowdata, isAllowEdit, handleColumnHeaderMouseDown, handleColSizeHandleMouseDown, handleColFreezeHandleMouseDown, handleContextMenu, selectTitlesMap, selectTitlesRange, fixColumnStyleOverflowInFreeze, rowLocationByIndex, rowLocation, handleRowHeaderMouseDown, handleRowSizeHandleMouseDown, handleRowFreezeHandleMouseDown, fixRowStyleOverflowInFreeze, functionHTMLGenerate, locale, getCellValue, createRangeHightlight, isInlineStringCell, getInlineStringHTML, valueShowEs, escapeHTMLTag, escapeScriptTag, isShowHidenCR, cancelNormalSelected, moveHighlightCell, updateCell, 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, handleCellAreaMouseMove, handleCellAreaDragOver, handleCellDrop, handleCellAreaDoubleClick, selectAll, showLinkCard, getCellRowColumn, getCellHyperlink, handleOverlayMouseMove, handleOverlayMouseUp, handleKeydownForZoom, handleOverlayTouchStart, handleOverlayTouchMove, handleOverlayTouchEnd, 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, getDataBySelectionNoCopy, getInlineStringNoStyle, rangeHightlightselected, editSheetName, moveToEnd, cancelActiveImgItem, MAX_ZOOM_RATIO, MIN_ZOOM_RATIO, addSheet, indexToColumnChar, sortSelection, handleCopy, insertRowCol, deleteRowCol, hideSelected, showSelected, api, removeActiveImage, deleteSelectedCellText, jfrefreshgrid, handleLink, deleteSheet, opToPatch, orderbydatafiler, getFilterColumnValues, getFilterColumnColors, saveFilter, patchToOp, filterPatch, inverseRowColOptions, ensureSheetIndex, initSheetIndex, handleGlobalKeyDown, handlePasteByLeanklin, groupValuesRefresh } from '@leankylin-sheet/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';
|
|
@@ -1165,9 +1165,6 @@ var InputBox = function InputBox() {
|
|
|
1165
1165
|
var row_index = firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.row_focus;
|
|
1166
1166
|
var col_index = firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.column_focus;
|
|
1167
1167
|
var preText = useRef("");
|
|
1168
|
-
var inputBoxStyle = useMemo(function () {
|
|
1169
|
-
return {};
|
|
1170
|
-
}, [context.luckysheetfile, context.currentSheetId, context.luckysheetCellUpdate, firstSelection]);
|
|
1171
1168
|
useLayoutEffect(function () {
|
|
1172
1169
|
if (!context.allowEdit) {
|
|
1173
1170
|
setContext(function (ctx) {
|
|
@@ -1209,20 +1206,18 @@ var InputBox = function InputBox() {
|
|
|
1209
1206
|
if (!refs.globalCache.ignoreWriteCell) inputRef.current.innerHTML = escapeHTMLTag(escapeScriptTag(value));
|
|
1210
1207
|
refs.globalCache.ignoreWriteCell = false;
|
|
1211
1208
|
if (!refs.globalCache.doNotFocus) {
|
|
1212
|
-
setTimeout(function () {
|
|
1213
|
-
moveToEnd(inputRef.current);
|
|
1214
|
-
});
|
|
1209
|
+
setTimeout(function () {});
|
|
1215
1210
|
}
|
|
1216
1211
|
delete refs.globalCache.doNotFocus;
|
|
1217
1212
|
}
|
|
1218
1213
|
}, [context.luckysheetCellUpdate, context.luckysheetfile, context.currentSheetId, firstSelection]);
|
|
1219
1214
|
useEffect(function () {
|
|
1220
|
-
if (_.isEmpty(context.luckysheetCellUpdate)) {
|
|
1215
|
+
if (_.isEmpty(context.luckysheetCellUpdate) && !context.active_f) {
|
|
1221
1216
|
if (inputRef.current) {
|
|
1222
1217
|
inputRef.current.innerHTML = "";
|
|
1223
1218
|
}
|
|
1224
1219
|
}
|
|
1225
|
-
}, [context.luckysheetCellUpdate]);
|
|
1220
|
+
}, [context.luckysheetCellUpdate, context.active_f]);
|
|
1226
1221
|
useEffect(function () {
|
|
1227
1222
|
setIsHidenRC(isShowHidenCR(context));
|
|
1228
1223
|
}, [context.luckysheet_select_save]);
|
|
@@ -1264,6 +1259,7 @@ var InputBox = function InputBox() {
|
|
|
1264
1259
|
handleFormulaInput(draftCtx, refs.fxInput.current, refs.cellInput.current, kcode, preText.current);
|
|
1265
1260
|
});
|
|
1266
1261
|
}
|
|
1262
|
+
lastKeyDownEventRef.current = undefined;
|
|
1267
1263
|
}, [refs.cellInput, refs.fxInput, setContext]);
|
|
1268
1264
|
var onPaste = useCallback(function (e) {
|
|
1269
1265
|
if (_.isEmpty(context.luckysheetCellUpdate)) {
|
|
@@ -1297,10 +1293,10 @@ var InputBox = function InputBox() {
|
|
|
1297
1293
|
}
|
|
1298
1294
|
}, /*#__PURE__*/React.createElement("div", {
|
|
1299
1295
|
className: "luckysheet-input-box-inner",
|
|
1300
|
-
style: firstSelection ?
|
|
1296
|
+
style: firstSelection ? {
|
|
1301
1297
|
minWidth: firstSelection.width,
|
|
1302
1298
|
minHeight: firstSelection.height
|
|
1303
|
-
}
|
|
1299
|
+
} : {}
|
|
1304
1300
|
}, /*#__PURE__*/React.createElement(ContentEditable, {
|
|
1305
1301
|
innerRef: function innerRef(e) {
|
|
1306
1302
|
inputRef.current = e;
|
|
@@ -2099,6 +2095,17 @@ var FilterOptions = function FilterOptions(_ref) {
|
|
|
2099
2095
|
frozenColumns = (frozen === null || frozen === void 0 ? void 0 : (_frozen$range = frozen.range) === null || _frozen$range === void 0 ? void 0 : _frozen$range.column_focus) || -1;
|
|
2100
2096
|
frozenRows = (frozen === null || frozen === void 0 ? void 0 : (_frozen$range2 = frozen.range) === null || _frozen$range2 === void 0 ? void 0 : _frozen$range2.row_focus) || -1;
|
|
2101
2097
|
}
|
|
2098
|
+
function hiddenFilter(index) {
|
|
2099
|
+
var _context$config$colhi;
|
|
2100
|
+
if (!filterOptions) {
|
|
2101
|
+
return true;
|
|
2102
|
+
}
|
|
2103
|
+
var col = filterOptions.startCol + index;
|
|
2104
|
+
if (((_context$config$colhi = context.config.colhidden) === null || _context$config$colhi === void 0 ? void 0 : _context$config$colhi[col]) === 0) {
|
|
2105
|
+
return true;
|
|
2106
|
+
}
|
|
2107
|
+
return false;
|
|
2108
|
+
}
|
|
2102
2109
|
return filterOptions == null ? ( /*#__PURE__*/React.createElement("div", null)) : ( /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
2103
2110
|
id: "luckysheet-filter-selected-sheet",
|
|
2104
2111
|
className: "luckysheet-cell-selected luckysheet-filter-selected",
|
|
@@ -2122,6 +2129,9 @@ var FilterOptions = function FilterOptions(_ref) {
|
|
|
2122
2129
|
left: left,
|
|
2123
2130
|
top: top
|
|
2124
2131
|
});
|
|
2132
|
+
if (hiddenFilter(i)) {
|
|
2133
|
+
return null;
|
|
2134
|
+
}
|
|
2125
2135
|
if (settings.renderFilter) {
|
|
2126
2136
|
return settings.renderFilter({
|
|
2127
2137
|
style: _.assign(rowOverflowFreezeStyle, columnOverflowFreezeStyle, {
|
|
@@ -6955,6 +6965,9 @@ var FxEditor = function FxEditor() {
|
|
|
6955
6965
|
return;
|
|
6956
6966
|
}
|
|
6957
6967
|
var d = getFlowdata(context);
|
|
6968
|
+
if (context.active_f) {
|
|
6969
|
+
return;
|
|
6970
|
+
}
|
|
6958
6971
|
var value = "";
|
|
6959
6972
|
if (firstSelection) {
|
|
6960
6973
|
var _d$r;
|
|
@@ -6975,12 +6988,17 @@ var FxEditor = function FxEditor() {
|
|
|
6975
6988
|
} else {
|
|
6976
6989
|
refs.fxInput.current.innerHTML = "";
|
|
6977
6990
|
}
|
|
6978
|
-
}, [context.luckysheetfile, context.currentSheetId, context.luckysheet_select_save]);
|
|
6991
|
+
}, [context.active_f, context.luckysheetfile, context.currentSheetId, context.luckysheet_select_save]);
|
|
6979
6992
|
var onFocus = useCallback(function () {
|
|
6980
6993
|
var _context$luckysheet_s2, _context$luckysheet_s3;
|
|
6981
6994
|
if (context.allowEdit === false) {
|
|
6982
6995
|
return;
|
|
6983
6996
|
}
|
|
6997
|
+
if (context.active_f) {
|
|
6998
|
+
setFocused(true);
|
|
6999
|
+
refs.globalCache.doNotFocus = true;
|
|
7000
|
+
return;
|
|
7001
|
+
}
|
|
6984
7002
|
if (((_context$luckysheet_s2 = (_context$luckysheet_s3 = context.luckysheet_select_save) === null || _context$luckysheet_s3 === void 0 ? void 0 : _context$luckysheet_s3.length) !== null && _context$luckysheet_s2 !== void 0 ? _context$luckysheet_s2 : 0) > 0 && !context.luckysheet_cell_selected_move && isAllowEdit(context, context.luckysheet_select_save)) {
|
|
6985
7003
|
setFocused(true);
|
|
6986
7004
|
setContext(function (draftCtx) {
|
|
@@ -6991,7 +7009,7 @@ var FxEditor = function FxEditor() {
|
|
|
6991
7009
|
refs.globalCache.doNotFocus = true;
|
|
6992
7010
|
});
|
|
6993
7011
|
}
|
|
6994
|
-
}, [context.config, context.luckysheet_select_save, context.luckysheetfile, context.currentSheetId, refs.globalCache, setContext]);
|
|
7012
|
+
}, [context.config, context.luckysheet_select_save, context.luckysheetfile, context.currentSheetId, refs.globalCache, context.active_f, setContext]);
|
|
6995
7013
|
var onKeyDown = useCallback(function (e) {
|
|
6996
7014
|
if (context.allowEdit === false) {
|
|
6997
7015
|
return;
|
|
@@ -7002,6 +7020,9 @@ var FxEditor = function FxEditor() {
|
|
|
7002
7020
|
if (key === "ArrowLeft" || key === "ArrowRight") {
|
|
7003
7021
|
e.stopPropagation();
|
|
7004
7022
|
}
|
|
7023
|
+
if (!["Enter", "Escape", "ArrowLeft", "ArrowRight"].includes(key)) {
|
|
7024
|
+
return;
|
|
7025
|
+
}
|
|
7005
7026
|
setContext(function (draftCtx) {
|
|
7006
7027
|
if (context.luckysheetCellUpdate.length > 0) {
|
|
7007
7028
|
switch (key) {
|
|
@@ -7210,6 +7231,57 @@ var SheetItem = function SheetItem(_ref) {
|
|
|
7210
7231
|
setDragOver(false);
|
|
7211
7232
|
e.stopPropagation();
|
|
7212
7233
|
}, [context.allowEdit, isDropPlaceholder, setContext, sheet.id]);
|
|
7234
|
+
var onChangeSheet = useMemoizedFn(function () {
|
|
7235
|
+
if (isDropPlaceholder) return;
|
|
7236
|
+
setContext(function (draftCtx) {
|
|
7237
|
+
var _luckysheetCellUpdate;
|
|
7238
|
+
draftCtx.sheetScrollRecord[draftCtx.currentSheetId] = {
|
|
7239
|
+
scrollLeft: draftCtx.scrollLeft,
|
|
7240
|
+
scrollTop: draftCtx.scrollTop,
|
|
7241
|
+
luckysheet_select_status: draftCtx.luckysheet_select_status,
|
|
7242
|
+
luckysheet_select_save: draftCtx.luckysheet_select_save,
|
|
7243
|
+
luckysheet_selection_range: draftCtx.luckysheet_selection_range
|
|
7244
|
+
};
|
|
7245
|
+
var isBack = false;
|
|
7246
|
+
var luckysheetCellUpdate = [];
|
|
7247
|
+
var sheetId = sheet.id;
|
|
7248
|
+
if ((israngeseleciton(draftCtx) || draftCtx.formulaCache.rangestart) && !draftCtx.active_f) {
|
|
7249
|
+
var _refs$fxInput$current, _draftCtx$sheetScroll;
|
|
7250
|
+
draftCtx.active_f = {
|
|
7251
|
+
r: draftCtx.luckysheet_select_save[0].row_focus,
|
|
7252
|
+
c: draftCtx.luckysheet_select_save[0].column_focus,
|
|
7253
|
+
sheetId: draftCtx.currentSheetId,
|
|
7254
|
+
text: (_refs$fxInput$current = refs.fxInput.current) === null || _refs$fxInput$current === void 0 ? void 0 : _refs$fxInput$current.innerText
|
|
7255
|
+
};
|
|
7256
|
+
if ((_draftCtx$sheetScroll = draftCtx.sheetScrollRecord[sheet.id]) === null || _draftCtx$sheetScroll === void 0 ? void 0 : _draftCtx$sheetScroll.luckysheet_select_save) {
|
|
7257
|
+
draftCtx.sheetScrollRecord[sheet.id].luckysheet_select_save = undefined;
|
|
7258
|
+
}
|
|
7259
|
+
moveToEnd(refs.fxInput.current);
|
|
7260
|
+
} else if (draftCtx.active_f && draftCtx.active_f.sheetId === sheet.id) {
|
|
7261
|
+
var _refs$fxInput$current2;
|
|
7262
|
+
luckysheetCellUpdate = [draftCtx.active_f.r, draftCtx.active_f.c];
|
|
7263
|
+
isBack = true;
|
|
7264
|
+
refs.cellInput.current.innerHTML = ((_refs$fxInput$current2 = refs.fxInput.current) === null || _refs$fxInput$current2 === void 0 ? void 0 : _refs$fxInput$current2.innerHTML) || "";
|
|
7265
|
+
moveToEnd(refs.cellInput.current);
|
|
7266
|
+
}
|
|
7267
|
+
if (draftCtx.active_f) {
|
|
7268
|
+
sheetId = draftCtx.active_f.sheetId;
|
|
7269
|
+
}
|
|
7270
|
+
var _update = ((_luckysheetCellUpdate = luckysheetCellUpdate) === null || _luckysheetCellUpdate === void 0 ? void 0 : _luckysheetCellUpdate.length) > 0 ? luckysheetCellUpdate : draftCtx.luckysheetCellUpdate;
|
|
7271
|
+
if ((_update === null || _update === void 0 ? void 0 : _update.length) > 0) {
|
|
7272
|
+
updateCell(draftCtx, _update[0], _update[1], refs.cellInput.current, undefined, refs.canvas.current.getContext("2d"), sheetId);
|
|
7273
|
+
}
|
|
7274
|
+
draftCtx.dataVerificationDropDownList = false;
|
|
7275
|
+
draftCtx.currentSheetId = sheet.id;
|
|
7276
|
+
draftCtx.zoomRatio = sheet.zoomRatio || 1;
|
|
7277
|
+
cancelActiveImgItem(draftCtx, refs.globalCache);
|
|
7278
|
+
cancelNormalSelected(draftCtx);
|
|
7279
|
+
if (isBack) {
|
|
7280
|
+
draftCtx.luckysheetCellUpdate = luckysheetCellUpdate;
|
|
7281
|
+
draftCtx.active_f = undefined;
|
|
7282
|
+
}
|
|
7283
|
+
});
|
|
7284
|
+
});
|
|
7213
7285
|
return /*#__PURE__*/React.createElement("div", {
|
|
7214
7286
|
onDragOver: function onDragOver(e) {
|
|
7215
7287
|
e.preventDefault();
|
|
@@ -7233,23 +7305,7 @@ var SheetItem = function SheetItem(_ref) {
|
|
|
7233
7305
|
key: sheet.id,
|
|
7234
7306
|
ref: containerRef,
|
|
7235
7307
|
className: isDropPlaceholder ? "leankylin-sheettab-placeholder" : "luckysheet-sheets-item".concat(context.currentSheetId === sheet.id ? " luckysheet-sheets-item-active" : ""),
|
|
7236
|
-
onClick:
|
|
7237
|
-
if (isDropPlaceholder) return;
|
|
7238
|
-
setContext(function (draftCtx) {
|
|
7239
|
-
draftCtx.sheetScrollRecord[draftCtx.currentSheetId] = {
|
|
7240
|
-
scrollLeft: draftCtx.scrollLeft,
|
|
7241
|
-
scrollTop: draftCtx.scrollTop,
|
|
7242
|
-
luckysheet_select_status: draftCtx.luckysheet_select_status,
|
|
7243
|
-
luckysheet_select_save: draftCtx.luckysheet_select_save,
|
|
7244
|
-
luckysheet_selection_range: draftCtx.luckysheet_selection_range
|
|
7245
|
-
};
|
|
7246
|
-
draftCtx.dataVerificationDropDownList = false;
|
|
7247
|
-
draftCtx.currentSheetId = sheet.id;
|
|
7248
|
-
draftCtx.zoomRatio = sheet.zoomRatio || 1;
|
|
7249
|
-
cancelActiveImgItem(draftCtx, refs.globalCache);
|
|
7250
|
-
cancelNormalSelected(draftCtx);
|
|
7251
|
-
});
|
|
7252
|
-
},
|
|
7308
|
+
onClick: onChangeSheet,
|
|
7253
7309
|
onContextMenu: function onContextMenu(e) {
|
|
7254
7310
|
if (isDropPlaceholder) return;
|
|
7255
7311
|
var rect = refs.workbookContainer.current.getBoundingClientRect();
|
package/dist/index.js
CHANGED
|
@@ -1175,9 +1175,6 @@ var InputBox = function InputBox() {
|
|
|
1175
1175
|
var row_index = firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.row_focus;
|
|
1176
1176
|
var col_index = firstSelection === null || firstSelection === void 0 ? void 0 : firstSelection.column_focus;
|
|
1177
1177
|
var preText = React.useRef("");
|
|
1178
|
-
var inputBoxStyle = React.useMemo(function () {
|
|
1179
|
-
return {};
|
|
1180
|
-
}, [context.luckysheetfile, context.currentSheetId, context.luckysheetCellUpdate, firstSelection]);
|
|
1181
1178
|
React.useLayoutEffect(function () {
|
|
1182
1179
|
if (!context.allowEdit) {
|
|
1183
1180
|
setContext(function (ctx) {
|
|
@@ -1219,20 +1216,18 @@ var InputBox = function InputBox() {
|
|
|
1219
1216
|
if (!refs.globalCache.ignoreWriteCell) inputRef.current.innerHTML = core.escapeHTMLTag(core.escapeScriptTag(value));
|
|
1220
1217
|
refs.globalCache.ignoreWriteCell = false;
|
|
1221
1218
|
if (!refs.globalCache.doNotFocus) {
|
|
1222
|
-
setTimeout(function () {
|
|
1223
|
-
core.moveToEnd(inputRef.current);
|
|
1224
|
-
});
|
|
1219
|
+
setTimeout(function () {});
|
|
1225
1220
|
}
|
|
1226
1221
|
delete refs.globalCache.doNotFocus;
|
|
1227
1222
|
}
|
|
1228
1223
|
}, [context.luckysheetCellUpdate, context.luckysheetfile, context.currentSheetId, firstSelection]);
|
|
1229
1224
|
React.useEffect(function () {
|
|
1230
|
-
if (___default['default'].isEmpty(context.luckysheetCellUpdate)) {
|
|
1225
|
+
if (___default['default'].isEmpty(context.luckysheetCellUpdate) && !context.active_f) {
|
|
1231
1226
|
if (inputRef.current) {
|
|
1232
1227
|
inputRef.current.innerHTML = "";
|
|
1233
1228
|
}
|
|
1234
1229
|
}
|
|
1235
|
-
}, [context.luckysheetCellUpdate]);
|
|
1230
|
+
}, [context.luckysheetCellUpdate, context.active_f]);
|
|
1236
1231
|
React.useEffect(function () {
|
|
1237
1232
|
setIsHidenRC(core.isShowHidenCR(context));
|
|
1238
1233
|
}, [context.luckysheet_select_save]);
|
|
@@ -1274,6 +1269,7 @@ var InputBox = function InputBox() {
|
|
|
1274
1269
|
core.handleFormulaInput(draftCtx, refs.fxInput.current, refs.cellInput.current, kcode, preText.current);
|
|
1275
1270
|
});
|
|
1276
1271
|
}
|
|
1272
|
+
lastKeyDownEventRef.current = undefined;
|
|
1277
1273
|
}, [refs.cellInput, refs.fxInput, setContext]);
|
|
1278
1274
|
var onPaste = React.useCallback(function (e) {
|
|
1279
1275
|
if (___default['default'].isEmpty(context.luckysheetCellUpdate)) {
|
|
@@ -1307,10 +1303,10 @@ var InputBox = function InputBox() {
|
|
|
1307
1303
|
}
|
|
1308
1304
|
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
1309
1305
|
className: "luckysheet-input-box-inner",
|
|
1310
|
-
style: firstSelection ?
|
|
1306
|
+
style: firstSelection ? {
|
|
1311
1307
|
minWidth: firstSelection.width,
|
|
1312
1308
|
minHeight: firstSelection.height
|
|
1313
|
-
}
|
|
1309
|
+
} : {}
|
|
1314
1310
|
}, /*#__PURE__*/React__default['default'].createElement(ContentEditable, {
|
|
1315
1311
|
innerRef: function innerRef(e) {
|
|
1316
1312
|
inputRef.current = e;
|
|
@@ -2109,6 +2105,17 @@ var FilterOptions = function FilterOptions(_ref) {
|
|
|
2109
2105
|
frozenColumns = (frozen === null || frozen === void 0 ? void 0 : (_frozen$range = frozen.range) === null || _frozen$range === void 0 ? void 0 : _frozen$range.column_focus) || -1;
|
|
2110
2106
|
frozenRows = (frozen === null || frozen === void 0 ? void 0 : (_frozen$range2 = frozen.range) === null || _frozen$range2 === void 0 ? void 0 : _frozen$range2.row_focus) || -1;
|
|
2111
2107
|
}
|
|
2108
|
+
function hiddenFilter(index) {
|
|
2109
|
+
var _context$config$colhi;
|
|
2110
|
+
if (!filterOptions) {
|
|
2111
|
+
return true;
|
|
2112
|
+
}
|
|
2113
|
+
var col = filterOptions.startCol + index;
|
|
2114
|
+
if (((_context$config$colhi = context.config.colhidden) === null || _context$config$colhi === void 0 ? void 0 : _context$config$colhi[col]) === 0) {
|
|
2115
|
+
return true;
|
|
2116
|
+
}
|
|
2117
|
+
return false;
|
|
2118
|
+
}
|
|
2112
2119
|
return filterOptions == null ? ( /*#__PURE__*/React__default['default'].createElement("div", null)) : ( /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2113
2120
|
id: "luckysheet-filter-selected-sheet",
|
|
2114
2121
|
className: "luckysheet-cell-selected luckysheet-filter-selected",
|
|
@@ -2132,6 +2139,9 @@ var FilterOptions = function FilterOptions(_ref) {
|
|
|
2132
2139
|
left: left,
|
|
2133
2140
|
top: top
|
|
2134
2141
|
});
|
|
2142
|
+
if (hiddenFilter(i)) {
|
|
2143
|
+
return null;
|
|
2144
|
+
}
|
|
2135
2145
|
if (settings.renderFilter) {
|
|
2136
2146
|
return settings.renderFilter({
|
|
2137
2147
|
style: ___default['default'].assign(rowOverflowFreezeStyle, columnOverflowFreezeStyle, {
|
|
@@ -6965,6 +6975,9 @@ var FxEditor = function FxEditor() {
|
|
|
6965
6975
|
return;
|
|
6966
6976
|
}
|
|
6967
6977
|
var d = core.getFlowdata(context);
|
|
6978
|
+
if (context.active_f) {
|
|
6979
|
+
return;
|
|
6980
|
+
}
|
|
6968
6981
|
var value = "";
|
|
6969
6982
|
if (firstSelection) {
|
|
6970
6983
|
var _d$r;
|
|
@@ -6985,12 +6998,17 @@ var FxEditor = function FxEditor() {
|
|
|
6985
6998
|
} else {
|
|
6986
6999
|
refs.fxInput.current.innerHTML = "";
|
|
6987
7000
|
}
|
|
6988
|
-
}, [context.luckysheetfile, context.currentSheetId, context.luckysheet_select_save]);
|
|
7001
|
+
}, [context.active_f, context.luckysheetfile, context.currentSheetId, context.luckysheet_select_save]);
|
|
6989
7002
|
var onFocus = React.useCallback(function () {
|
|
6990
7003
|
var _context$luckysheet_s2, _context$luckysheet_s3;
|
|
6991
7004
|
if (context.allowEdit === false) {
|
|
6992
7005
|
return;
|
|
6993
7006
|
}
|
|
7007
|
+
if (context.active_f) {
|
|
7008
|
+
setFocused(true);
|
|
7009
|
+
refs.globalCache.doNotFocus = true;
|
|
7010
|
+
return;
|
|
7011
|
+
}
|
|
6994
7012
|
if (((_context$luckysheet_s2 = (_context$luckysheet_s3 = context.luckysheet_select_save) === null || _context$luckysheet_s3 === void 0 ? void 0 : _context$luckysheet_s3.length) !== null && _context$luckysheet_s2 !== void 0 ? _context$luckysheet_s2 : 0) > 0 && !context.luckysheet_cell_selected_move && core.isAllowEdit(context, context.luckysheet_select_save)) {
|
|
6995
7013
|
setFocused(true);
|
|
6996
7014
|
setContext(function (draftCtx) {
|
|
@@ -7001,7 +7019,7 @@ var FxEditor = function FxEditor() {
|
|
|
7001
7019
|
refs.globalCache.doNotFocus = true;
|
|
7002
7020
|
});
|
|
7003
7021
|
}
|
|
7004
|
-
}, [context.config, context.luckysheet_select_save, context.luckysheetfile, context.currentSheetId, refs.globalCache, setContext]);
|
|
7022
|
+
}, [context.config, context.luckysheet_select_save, context.luckysheetfile, context.currentSheetId, refs.globalCache, context.active_f, setContext]);
|
|
7005
7023
|
var onKeyDown = React.useCallback(function (e) {
|
|
7006
7024
|
if (context.allowEdit === false) {
|
|
7007
7025
|
return;
|
|
@@ -7012,6 +7030,9 @@ var FxEditor = function FxEditor() {
|
|
|
7012
7030
|
if (key === "ArrowLeft" || key === "ArrowRight") {
|
|
7013
7031
|
e.stopPropagation();
|
|
7014
7032
|
}
|
|
7033
|
+
if (!["Enter", "Escape", "ArrowLeft", "ArrowRight"].includes(key)) {
|
|
7034
|
+
return;
|
|
7035
|
+
}
|
|
7015
7036
|
setContext(function (draftCtx) {
|
|
7016
7037
|
if (context.luckysheetCellUpdate.length > 0) {
|
|
7017
7038
|
switch (key) {
|
|
@@ -7220,6 +7241,57 @@ var SheetItem = function SheetItem(_ref) {
|
|
|
7220
7241
|
setDragOver(false);
|
|
7221
7242
|
e.stopPropagation();
|
|
7222
7243
|
}, [context.allowEdit, isDropPlaceholder, setContext, sheet.id]);
|
|
7244
|
+
var onChangeSheet = ahooks.useMemoizedFn(function () {
|
|
7245
|
+
if (isDropPlaceholder) return;
|
|
7246
|
+
setContext(function (draftCtx) {
|
|
7247
|
+
var _luckysheetCellUpdate;
|
|
7248
|
+
draftCtx.sheetScrollRecord[draftCtx.currentSheetId] = {
|
|
7249
|
+
scrollLeft: draftCtx.scrollLeft,
|
|
7250
|
+
scrollTop: draftCtx.scrollTop,
|
|
7251
|
+
luckysheet_select_status: draftCtx.luckysheet_select_status,
|
|
7252
|
+
luckysheet_select_save: draftCtx.luckysheet_select_save,
|
|
7253
|
+
luckysheet_selection_range: draftCtx.luckysheet_selection_range
|
|
7254
|
+
};
|
|
7255
|
+
var isBack = false;
|
|
7256
|
+
var luckysheetCellUpdate = [];
|
|
7257
|
+
var sheetId = sheet.id;
|
|
7258
|
+
if ((core.israngeseleciton(draftCtx) || draftCtx.formulaCache.rangestart) && !draftCtx.active_f) {
|
|
7259
|
+
var _refs$fxInput$current, _draftCtx$sheetScroll;
|
|
7260
|
+
draftCtx.active_f = {
|
|
7261
|
+
r: draftCtx.luckysheet_select_save[0].row_focus,
|
|
7262
|
+
c: draftCtx.luckysheet_select_save[0].column_focus,
|
|
7263
|
+
sheetId: draftCtx.currentSheetId,
|
|
7264
|
+
text: (_refs$fxInput$current = refs.fxInput.current) === null || _refs$fxInput$current === void 0 ? void 0 : _refs$fxInput$current.innerText
|
|
7265
|
+
};
|
|
7266
|
+
if ((_draftCtx$sheetScroll = draftCtx.sheetScrollRecord[sheet.id]) === null || _draftCtx$sheetScroll === void 0 ? void 0 : _draftCtx$sheetScroll.luckysheet_select_save) {
|
|
7267
|
+
draftCtx.sheetScrollRecord[sheet.id].luckysheet_select_save = undefined;
|
|
7268
|
+
}
|
|
7269
|
+
core.moveToEnd(refs.fxInput.current);
|
|
7270
|
+
} else if (draftCtx.active_f && draftCtx.active_f.sheetId === sheet.id) {
|
|
7271
|
+
var _refs$fxInput$current2;
|
|
7272
|
+
luckysheetCellUpdate = [draftCtx.active_f.r, draftCtx.active_f.c];
|
|
7273
|
+
isBack = true;
|
|
7274
|
+
refs.cellInput.current.innerHTML = ((_refs$fxInput$current2 = refs.fxInput.current) === null || _refs$fxInput$current2 === void 0 ? void 0 : _refs$fxInput$current2.innerHTML) || "";
|
|
7275
|
+
core.moveToEnd(refs.cellInput.current);
|
|
7276
|
+
}
|
|
7277
|
+
if (draftCtx.active_f) {
|
|
7278
|
+
sheetId = draftCtx.active_f.sheetId;
|
|
7279
|
+
}
|
|
7280
|
+
var _update = ((_luckysheetCellUpdate = luckysheetCellUpdate) === null || _luckysheetCellUpdate === void 0 ? void 0 : _luckysheetCellUpdate.length) > 0 ? luckysheetCellUpdate : draftCtx.luckysheetCellUpdate;
|
|
7281
|
+
if ((_update === null || _update === void 0 ? void 0 : _update.length) > 0) {
|
|
7282
|
+
core.updateCell(draftCtx, _update[0], _update[1], refs.cellInput.current, undefined, refs.canvas.current.getContext("2d"), sheetId);
|
|
7283
|
+
}
|
|
7284
|
+
draftCtx.dataVerificationDropDownList = false;
|
|
7285
|
+
draftCtx.currentSheetId = sheet.id;
|
|
7286
|
+
draftCtx.zoomRatio = sheet.zoomRatio || 1;
|
|
7287
|
+
core.cancelActiveImgItem(draftCtx, refs.globalCache);
|
|
7288
|
+
core.cancelNormalSelected(draftCtx);
|
|
7289
|
+
if (isBack) {
|
|
7290
|
+
draftCtx.luckysheetCellUpdate = luckysheetCellUpdate;
|
|
7291
|
+
draftCtx.active_f = undefined;
|
|
7292
|
+
}
|
|
7293
|
+
});
|
|
7294
|
+
});
|
|
7223
7295
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
7224
7296
|
onDragOver: function onDragOver(e) {
|
|
7225
7297
|
e.preventDefault();
|
|
@@ -7243,23 +7315,7 @@ var SheetItem = function SheetItem(_ref) {
|
|
|
7243
7315
|
key: sheet.id,
|
|
7244
7316
|
ref: containerRef,
|
|
7245
7317
|
className: isDropPlaceholder ? "leankylin-sheettab-placeholder" : "luckysheet-sheets-item".concat(context.currentSheetId === sheet.id ? " luckysheet-sheets-item-active" : ""),
|
|
7246
|
-
onClick:
|
|
7247
|
-
if (isDropPlaceholder) return;
|
|
7248
|
-
setContext(function (draftCtx) {
|
|
7249
|
-
draftCtx.sheetScrollRecord[draftCtx.currentSheetId] = {
|
|
7250
|
-
scrollLeft: draftCtx.scrollLeft,
|
|
7251
|
-
scrollTop: draftCtx.scrollTop,
|
|
7252
|
-
luckysheet_select_status: draftCtx.luckysheet_select_status,
|
|
7253
|
-
luckysheet_select_save: draftCtx.luckysheet_select_save,
|
|
7254
|
-
luckysheet_selection_range: draftCtx.luckysheet_selection_range
|
|
7255
|
-
};
|
|
7256
|
-
draftCtx.dataVerificationDropDownList = false;
|
|
7257
|
-
draftCtx.currentSheetId = sheet.id;
|
|
7258
|
-
draftCtx.zoomRatio = sheet.zoomRatio || 1;
|
|
7259
|
-
core.cancelActiveImgItem(draftCtx, refs.globalCache);
|
|
7260
|
-
core.cancelNormalSelected(draftCtx);
|
|
7261
|
-
});
|
|
7262
|
-
},
|
|
7318
|
+
onClick: onChangeSheet,
|
|
7263
7319
|
onContextMenu: function onContextMenu(e) {
|
|
7264
7320
|
if (isDropPlaceholder) return;
|
|
7265
7321
|
var rect = refs.workbookContainer.current.getBoundingClientRect();
|
package/dist/index.umd.css
CHANGED