@fileverse-dev/fortune-react 1.0.2-mod-25-patch-1 → 1.0.2-mod-27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Workbook/api.d.ts +2 -1050
- package/dist/components/Workbook/index.d.ts +0 -1048
- package/dist/index.css +163 -2
- package/dist/index.esm.css +163 -2
- package/dist/index.esm.js +372 -69
- package/dist/index.js +370 -67
- package/dist/index.umd.css +163 -2
- package/dist/index.umd.js +3574 -4959
- package/dist/index.umd.min.css +1 -1
- package/dist/index.umd.min.js +9 -9
- package/package.json +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { defaultContext, defaultSettings, getSheetIndex, colLocationByIndex, fixPositionOnFrozenCells, colLocation, getFlowdata, isAllowEdit, handleColumnHeaderMouseDown, handleColSizeHandleMouseDown, handleColFreezeHandleMouseDown, handleContextMenu, selectTitlesMap, selectTitlesRange, fixColumnStyleOverflowInFreeze, rowLocationByIndex, rowLocation, handleRowHeaderMouseDown, handleRowSizeHandleMouseDown, handleRowFreezeHandleMouseDown, fixRowStyleOverflowInFreeze, locale, getStyleByCell, getCellValue, createRangeHightlight, isInlineStringCell, getInlineStringHTML, valueShowEs, escapeHTMLTag, escapeScriptTag, moveToEnd, isShowHidenCR, getrangeseleciton, cancelNormalSelected, moveHighlightCell, israngeseleciton, handleFormulaInput, onSearchDialogMoveStart, replaceAll, replace, searchAll, searchNext, normalizeSelection, scrollToHighlightCell, isLinkValid, getRangetxt, goToLink, replaceHtml, removeHyperlink, onRangeSelectionModalMoveStart, saveHyperlink, createFilterOptions, onImageMoveStart, onImageResizeStart, showComments, setEditingComment, onCommentBoxMoveStart, confirmMessage, getRangeByTxt, getDropdownList, setCellValue, setConditionRules, mergeBorder, setDropcownValue, handleCellAreaMouseDown, handleCellAreaDoubleClick, selectAll, showLinkCard, getCellRowColumn, getCellHyperlink, handleOverlayMouseMove, handleOverlayMouseUp, handleKeydownForZoom, handleOverlayTouchStart, handleOverlayTouchMove, handleOverlayTouchEnd, insertRowCol, drawArrow, onCellsMoveStart, createDropCellRange, updateContextWithSheetData, updateContextWithCanvas, initFreeze, Canvas, handleGlobalWheel, getDataArr, updateMoreCell, getRegStr, getOptionValue, getSelectRange, applyLocation, updateItem, update, normalizedCellAttr, updateFormat, handleTextSize, handleHorizontalAlign, handleVerticalAlign, handleScreenShot, showImgChooser, insertImage, editComment, deleteComment, showHideComment, showHideAllComments, newComment, handleSum, autoSelectionFormula, handleMerge, handleBorder, handleFreeze, handleSort, createFilter, clearFilter, toolbarItemSelectedFunc, toolbarItemClickHandler, handleTextColor, handleTextBackground, getInlineStringNoStyle, rangeHightlightselected, updateCell, editSheetName, cancelActiveImgItem, MAX_ZOOM_RATIO, MIN_ZOOM_RATIO, addSheet, getFreezeState, toggleFreeze, jfrefreshgrid, handleCopy, deleteRowCol, hideSelected, showSelected, api, removeActiveImage, deleteSelectedCellText, sortSelection, handleLink, handlePasteByClick, deleteSheet, opToPatch,
|
|
1
|
+
import { defaultContext, defaultSettings, getSheetIndex, colLocationByIndex, fixPositionOnFrozenCells, colLocation, getFlowdata, isAllowEdit, handleColumnHeaderMouseDown, handleColSizeHandleMouseDown, handleColFreezeHandleMouseDown, handleContextMenu, selectTitlesMap, selectTitlesRange, fixColumnStyleOverflowInFreeze, rowLocationByIndex, rowLocation, handleRowHeaderMouseDown, handleRowSizeHandleMouseDown, handleRowFreezeHandleMouseDown, fixRowStyleOverflowInFreeze, locale, getStyleByCell, getCellValue, createRangeHightlight, isInlineStringCell, getInlineStringHTML, valueShowEs, escapeHTMLTag, escapeScriptTag, moveToEnd, isShowHidenCR, getrangeseleciton, cancelNormalSelected, moveHighlightCell, israngeseleciton, handleFormulaInput, onSearchDialogMoveStart, replaceAll, replace, searchAll, searchNext, normalizeSelection, scrollToHighlightCell, isLinkValid, getRangetxt, goToLink, replaceHtml, removeHyperlink, onRangeSelectionModalMoveStart, saveHyperlink, createFilterOptions, onImageMoveStart, onImageResizeStart, showComments, setEditingComment, onCommentBoxMoveStart, confirmMessage, getRangeByTxt, getDropdownList, setCellValue, setConditionRules, mergeBorder, setDropcownValue, handleCellAreaMouseDown, handleCellAreaDoubleClick, selectAll, showLinkCard, getCellRowColumn, getCellHyperlink, handleOverlayMouseMove, handleOverlayMouseUp, handleKeydownForZoom, handleOverlayTouchStart, handleOverlayTouchMove, handleOverlayTouchEnd, insertRowCol, drawArrow, onCellsMoveStart, createDropCellRange, updateContextWithSheetData, updateContextWithCanvas, initFreeze, Canvas, handleGlobalWheel, setCaretPosition, getDataArr, updateMoreCell, getRegStr, getOptionValue, getSelectRange, applyLocation, updateItem, update, normalizedCellAttr, updateFormat, handleTextSize, handleHorizontalAlign, handleVerticalAlign, handleScreenShot, showImgChooser, insertImage, editComment, deleteComment, showHideComment, showHideAllComments, newComment, handleSum, autoSelectionFormula, handleMerge, handleBorder, handleFreeze, handleSort, createFilter, clearFilter, toolbarItemSelectedFunc, toolbarItemClickHandler, handleTextColor, handleTextBackground, getInlineStringNoStyle, rangeHightlightselected, updateCell, editSheetName, cancelActiveImgItem, MAX_ZOOM_RATIO, MIN_ZOOM_RATIO, addSheet, getFreezeState, toggleFreeze, jfrefreshgrid, handleCopy, deleteRowCol, hideSelected, showSelected, api, removeActiveImage, deleteSelectedCellText, sortSelection, handleLink, handlePasteByClick, deleteSheet, opToPatch, orderbydatafiler, getFilterColumnValues, getFilterColumnColors, saveFilter, calcSelectionInfo, patchToOp, filterPatch, inverseRowColOptions, ensureSheetIndex, initSheetIndex, handleGlobalKeyDown, handlePaste, groupValuesRefresh } from '@fileverse-dev/fortune-core';
|
|
2
2
|
import React, { useContext, useRef, useState, useMemo, useCallback, useEffect, useLayoutEffect, useImperativeHandle } from 'react';
|
|
3
3
|
import produce, { applyPatches, enablePatches, produceWithPatches } from 'immer';
|
|
4
4
|
import _ from 'lodash';
|
|
5
|
-
import {
|
|
5
|
+
import { LucideIcon, TextField, Button as Button$1, cn, IconButton, Checkbox, Divider as Divider$2, Table, TableHeader, TableRow, TableHead, TableBody, TableCell, Select as Select$1, SelectTrigger, SelectValue, SelectContent, SelectItem as SelectItem$1 } from '@fileverse/ui';
|
|
6
6
|
import regeneratorRuntime from 'regenerator-runtime';
|
|
7
7
|
import Tippy from '@tippyjs/react';
|
|
8
8
|
|
|
@@ -795,25 +795,77 @@ var FormulaSearch = function FormulaSearch(props) {
|
|
|
795
795
|
key: v.n,
|
|
796
796
|
"data-func": v.n,
|
|
797
797
|
className: "luckysheet-formula-search-item ".concat(index === 0 ? "luckysheet-formula-search-item-active" : "")
|
|
798
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
799
|
+
style: {
|
|
800
|
+
display: "flex",
|
|
801
|
+
justifyContent: "space-between"
|
|
802
|
+
}
|
|
798
803
|
}, /*#__PURE__*/React.createElement("div", {
|
|
799
804
|
className: "luckysheet-formula-search-func"
|
|
800
805
|
}, v.n), /*#__PURE__*/React.createElement("div", {
|
|
806
|
+
style: {
|
|
807
|
+
display: "flex",
|
|
808
|
+
gap: "4px"
|
|
809
|
+
}
|
|
810
|
+
}, v.LOGO && (/*#__PURE__*/React.createElement("img", {
|
|
811
|
+
src: v.LOGO,
|
|
812
|
+
alt: "Service Logo",
|
|
813
|
+
width: 32,
|
|
814
|
+
height: 32
|
|
815
|
+
})), v.API_KEY && (/*#__PURE__*/React.createElement("div", {
|
|
816
|
+
style: {
|
|
817
|
+
borderRadius: "4px",
|
|
818
|
+
width: "20px",
|
|
819
|
+
height: "20px",
|
|
820
|
+
backgroundColor: "".concat(localStorage.getItem(v.API_KEY) ? "#177E23" : "#F9A92B")
|
|
821
|
+
}
|
|
822
|
+
}, /*#__PURE__*/React.createElement(LucideIcon, {
|
|
823
|
+
name: "Key",
|
|
824
|
+
style: {
|
|
825
|
+
color: "white"
|
|
826
|
+
}
|
|
827
|
+
}))))), /*#__PURE__*/React.createElement("div", {
|
|
801
828
|
className: "luckysheet-formula-search-detail"
|
|
802
829
|
}, v.d));
|
|
803
830
|
}));
|
|
804
831
|
};
|
|
805
832
|
|
|
833
|
+
function lightenHexColor(hex) {
|
|
834
|
+
var amount = 100;
|
|
835
|
+
if (hex.startsWith("#")) {
|
|
836
|
+
hex = hex.slice(1);
|
|
837
|
+
}
|
|
838
|
+
var r = parseInt(hex.slice(0, 2), 16);
|
|
839
|
+
var g = parseInt(hex.slice(2, 4), 16);
|
|
840
|
+
var b = parseInt(hex.slice(4, 6), 16);
|
|
841
|
+
r = Math.min(255, r + amount);
|
|
842
|
+
g = Math.min(255, g + amount);
|
|
843
|
+
b = Math.min(255, b + amount);
|
|
844
|
+
var newHex = "#".concat((1 << 24 | r << 16 | g << 8 | b).toString(16).slice(1).toUpperCase());
|
|
845
|
+
return newHex;
|
|
846
|
+
}
|
|
806
847
|
var FormulaHint = function FormulaHint(props) {
|
|
807
848
|
var _useContext = useContext(WorkbookContext),
|
|
808
849
|
context = _useContext.context;
|
|
809
850
|
var _locale = locale(context),
|
|
810
851
|
formulaMore = _locale.formulaMore;
|
|
811
|
-
if (!context.functionHint) return null;
|
|
812
852
|
var fn = context.formulaCache.functionlistMap[context.functionHint];
|
|
853
|
+
var _useState = useState(localStorage.getItem(fn === null || fn === void 0 ? void 0 : fn.API_KEY)),
|
|
854
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
855
|
+
API_KEY = _useState2[0],
|
|
856
|
+
setAPI_KEY = _useState2[1];
|
|
857
|
+
var _useState3 = useState(!API_KEY),
|
|
858
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
859
|
+
showAPInput = _useState4[0],
|
|
860
|
+
setShowAPInput = _useState4[1];
|
|
813
861
|
if (!fn) return null;
|
|
814
862
|
return /*#__PURE__*/React.createElement("div", _objectSpread2(_objectSpread2({}, props), {}, {
|
|
815
863
|
id: "luckysheet-formula-help-c",
|
|
816
|
-
className: "luckysheet-formula-help-c"
|
|
864
|
+
className: "luckysheet-formula-help-c",
|
|
865
|
+
style: {
|
|
866
|
+
border: "1px solid ".concat(fn.BRAND_COLOR),
|
|
867
|
+
backgroundColor: "".concat(fn.BRAND_COLOR ? lightenHexColor(fn.BRAND_COLOR) : "#F8F9FA")
|
|
868
|
+
}
|
|
817
869
|
}), /*#__PURE__*/React.createElement("div", {
|
|
818
870
|
className: "luckysheet-formula-help-close",
|
|
819
871
|
title: "\u5173\u95ED"
|
|
@@ -827,7 +879,10 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
827
879
|
className: "fa fa-angle-up",
|
|
828
880
|
"aria-hidden": "true"
|
|
829
881
|
})), /*#__PURE__*/React.createElement("div", {
|
|
830
|
-
className: "luckysheet-formula-help-title"
|
|
882
|
+
className: "luckysheet-formula-help-title formula-title",
|
|
883
|
+
style: {
|
|
884
|
+
backgroundColor: "".concat(fn.BRAND_COLOR ? lightenHexColor(fn.BRAND_COLOR) : "#F8F9FA")
|
|
885
|
+
}
|
|
831
886
|
}, /*#__PURE__*/React.createElement("div", {
|
|
832
887
|
className: "luckysheet-formula-help-title-formula"
|
|
833
888
|
}, /*#__PURE__*/React.createElement("span", {
|
|
@@ -851,16 +906,98 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
851
906
|
}, name, i !== fn.p.length - 1 && ", ");
|
|
852
907
|
})), /*#__PURE__*/React.createElement("span", {
|
|
853
908
|
className: "luckysheet-arguments-paren"
|
|
854
|
-
}, ")"))
|
|
855
|
-
|
|
909
|
+
}, ")")), /*#__PURE__*/React.createElement("div", {
|
|
910
|
+
style: {
|
|
911
|
+
display: "flex",
|
|
912
|
+
gap: "4px"
|
|
913
|
+
}
|
|
914
|
+
}, fn.LOGO && (/*#__PURE__*/React.createElement("img", {
|
|
915
|
+
src: fn.LOGO,
|
|
916
|
+
alt: "Service Logo",
|
|
917
|
+
width: 32,
|
|
918
|
+
height: 32
|
|
919
|
+
})), fn.API_KEY && (/*#__PURE__*/React.createElement("div", {
|
|
920
|
+
style: {
|
|
921
|
+
borderRadius: "4px",
|
|
922
|
+
width: "20px",
|
|
923
|
+
height: "20px",
|
|
924
|
+
backgroundColor: "".concat(localStorage.getItem(fn.API_KEY) ? "#177E23" : "#F9A92B")
|
|
925
|
+
}
|
|
926
|
+
}, /*#__PURE__*/React.createElement(LucideIcon, {
|
|
927
|
+
name: "Key",
|
|
928
|
+
style: {
|
|
929
|
+
color: "white"
|
|
930
|
+
}
|
|
931
|
+
}))))), /*#__PURE__*/React.createElement("div", {
|
|
932
|
+
className: "luckysheet-formula-help-content",
|
|
933
|
+
style: {
|
|
934
|
+
backgroundColor: "".concat(fn.BRAND_COLOR ? lightenHexColor(fn.BRAND_COLOR) : "#F8F9FA")
|
|
935
|
+
}
|
|
936
|
+
}, fn.API_KEY && (/*#__PURE__*/React.createElement("div", {
|
|
937
|
+
style: {
|
|
938
|
+
borderLeft: "4px solid ".concat(API_KEY ? "#177E23" : "#fb923c"),
|
|
939
|
+
backgroundColor: "white",
|
|
940
|
+
padding: "16px",
|
|
941
|
+
margin: "4px 4px 0px 4px",
|
|
942
|
+
borderRadius: "4px"
|
|
943
|
+
}
|
|
944
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
945
|
+
style: {
|
|
946
|
+
display: "flex",
|
|
947
|
+
justifyContent: "space-between",
|
|
948
|
+
cursor: "pointer"
|
|
949
|
+
},
|
|
950
|
+
onClick: function onClick() {
|
|
951
|
+
return setShowAPInput(!showAPInput);
|
|
952
|
+
}
|
|
953
|
+
}, /*#__PURE__*/React.createElement("h3", {
|
|
954
|
+
style: {
|
|
955
|
+
fontSize: "14px",
|
|
956
|
+
fontWeight: "600",
|
|
957
|
+
color: "#1f2937",
|
|
958
|
+
margin: "0 0 8px 0"
|
|
959
|
+
}
|
|
960
|
+
}, "API key is required"), /*#__PURE__*/React.createElement(LucideIcon, {
|
|
961
|
+
name: "ChevronDown",
|
|
962
|
+
width: 24,
|
|
963
|
+
height: 24
|
|
964
|
+
})), showAPInput && (/*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("p", {
|
|
965
|
+
style: {
|
|
966
|
+
color: "#6b7280",
|
|
967
|
+
margin: "0 0 16px 0"
|
|
968
|
+
}
|
|
969
|
+
}, "This function is require API key. Please paste it below and\n press 'Ok'."), /*#__PURE__*/React.createElement("div", {
|
|
970
|
+
style: {
|
|
971
|
+
display: "flex",
|
|
972
|
+
gap: "12px"
|
|
973
|
+
}
|
|
974
|
+
}, /*#__PURE__*/React.createElement(TextField, {
|
|
975
|
+
value: API_KEY,
|
|
976
|
+
id: "function-api-key",
|
|
977
|
+
type: "text",
|
|
978
|
+
placeholder: "API key",
|
|
979
|
+
onChange: function onChange(e) {
|
|
980
|
+
setAPI_KEY(e.target.value);
|
|
981
|
+
}
|
|
982
|
+
}), /*#__PURE__*/React.createElement(Button$1, {
|
|
983
|
+
onClick: function onClick() {
|
|
984
|
+
localStorage.setItem(fn.API_KEY, API_KEY);
|
|
985
|
+
}
|
|
986
|
+
}, "Ok")))))), /*#__PURE__*/React.createElement("div", {
|
|
987
|
+
style: {
|
|
988
|
+
backgroundColor: "white",
|
|
989
|
+
padding: "6px",
|
|
990
|
+
margin: "4px 4px 0px 4px",
|
|
991
|
+
borderRadius: "4px"
|
|
992
|
+
}
|
|
856
993
|
}, /*#__PURE__*/React.createElement("div", {
|
|
857
994
|
className: "luckysheet-formula-help-content-example"
|
|
858
995
|
}, /*#__PURE__*/React.createElement("div", {
|
|
859
|
-
className: "luckysheet-arguments-help-section-title"
|
|
996
|
+
className: "luckysheet-arguments-help-section-title example-title"
|
|
860
997
|
}, formulaMore.helpExample), /*#__PURE__*/React.createElement("div", {
|
|
861
998
|
className: "luckysheet-arguments-help-formula"
|
|
862
999
|
}, /*#__PURE__*/React.createElement("span", {
|
|
863
|
-
className: "luckysheet-arguments-help-function-name"
|
|
1000
|
+
className: "luckysheet-arguments-help-function-name example-value"
|
|
864
1001
|
}, fn.n), /*#__PURE__*/React.createElement("span", {
|
|
865
1002
|
className: "luckysheet-arguments-paren"
|
|
866
1003
|
}, "("), /*#__PURE__*/React.createElement("span", {
|
|
@@ -874,13 +1011,16 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
874
1011
|
})), /*#__PURE__*/React.createElement("span", {
|
|
875
1012
|
className: "luckysheet-arguments-paren"
|
|
876
1013
|
}, ")"))), /*#__PURE__*/React.createElement("div", {
|
|
877
|
-
className: "luckysheet-formula-help-content-detail"
|
|
1014
|
+
className: "luckysheet-formula-help-content-detail",
|
|
1015
|
+
style: {
|
|
1016
|
+
paddingBottom: "6px"
|
|
1017
|
+
}
|
|
878
1018
|
}, /*#__PURE__*/React.createElement("div", {
|
|
879
1019
|
className: "luckysheet-arguments-help-section"
|
|
880
1020
|
}, /*#__PURE__*/React.createElement("div", {
|
|
881
|
-
className: "luckysheet-arguments-help-section-title luckysheet-arguments-help-parameter-name"
|
|
882
|
-
},
|
|
883
|
-
className: "luckysheet-arguments-help-parameter-content"
|
|
1021
|
+
className: "luckysheet-arguments-help-section-title luckysheet-arguments-help-parameter-name example-title"
|
|
1022
|
+
}, "About"), /*#__PURE__*/React.createElement("span", {
|
|
1023
|
+
className: "luckysheet-arguments-help-parameter-content example-value"
|
|
884
1024
|
}, fn.d))), /*#__PURE__*/React.createElement("div", {
|
|
885
1025
|
className: "luckysheet-formula-help-content-param"
|
|
886
1026
|
}, fn.p.map(function (param) {
|
|
@@ -888,15 +1028,24 @@ var FormulaHint = function FormulaHint(props) {
|
|
|
888
1028
|
className: "luckysheet-arguments-help-section",
|
|
889
1029
|
key: param.name
|
|
890
1030
|
}, /*#__PURE__*/React.createElement("div", {
|
|
891
|
-
className: "luckysheet-arguments-help-section-title"
|
|
1031
|
+
className: "luckysheet-arguments-help-section-title example-title"
|
|
892
1032
|
}, param.name, param.repeat === "y" && (/*#__PURE__*/React.createElement("span", {
|
|
893
|
-
className: "luckysheet-arguments-help-argument-info"
|
|
1033
|
+
className: "luckysheet-arguments-help-argument-info example-value",
|
|
1034
|
+
style: {
|
|
1035
|
+
marginTop: "2px"
|
|
1036
|
+
}
|
|
894
1037
|
}, "...-", formulaMore.allowRepeatText)), param.require === "o" && (/*#__PURE__*/React.createElement("span", {
|
|
895
|
-
className: "luckysheet-arguments-help-argument-info"
|
|
1038
|
+
className: "luckysheet-arguments-help-argument-info example-value",
|
|
1039
|
+
style: {
|
|
1040
|
+
marginTop: "2px"
|
|
1041
|
+
}
|
|
896
1042
|
}, "-[", formulaMore.allowOptionText, "]"))), /*#__PURE__*/React.createElement("span", {
|
|
897
|
-
className: "luckysheet-arguments-help-parameter-content"
|
|
1043
|
+
className: "luckysheet-arguments-help-parameter-content example-value",
|
|
1044
|
+
style: {
|
|
1045
|
+
marginTop: "2px"
|
|
1046
|
+
}
|
|
898
1047
|
}, param.detail));
|
|
899
|
-
}))), /*#__PURE__*/React.createElement("div", {
|
|
1048
|
+
})))), /*#__PURE__*/React.createElement("div", {
|
|
900
1049
|
className: "luckysheet-formula-help-foot"
|
|
901
1050
|
}));
|
|
902
1051
|
};
|
|
@@ -4304,6 +4453,205 @@ var Option = function Option(_ref2) {
|
|
|
4304
4453
|
}, children));
|
|
4305
4454
|
};
|
|
4306
4455
|
|
|
4456
|
+
var FormulaSearch$1 = function FormulaSearch(_ref) {
|
|
4457
|
+
var _onCancel = _ref.onCancel;
|
|
4458
|
+
var _useContext = useContext(WorkbookContext),
|
|
4459
|
+
context = _useContext.context,
|
|
4460
|
+
setContext = _useContext.setContext,
|
|
4461
|
+
_useContext$refs = _useContext.refs,
|
|
4462
|
+
cellInput = _useContext$refs.cellInput,
|
|
4463
|
+
globalCache = _useContext$refs.globalCache;
|
|
4464
|
+
var _useState = useState(20),
|
|
4465
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
4466
|
+
selectedType = _useState2[0],
|
|
4467
|
+
setSelectedType = _useState2[1];
|
|
4468
|
+
var _useState3 = useState(0),
|
|
4469
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
4470
|
+
selectedFuncIndex = _useState4[0],
|
|
4471
|
+
setSelectedFuncIndex = _useState4[1];
|
|
4472
|
+
var _useState5 = useState(""),
|
|
4473
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
4474
|
+
searchText = _useState6[0],
|
|
4475
|
+
setSearchText = _useState6[1];
|
|
4476
|
+
var _locale = locale(context),
|
|
4477
|
+
formulaMore = _locale.formulaMore,
|
|
4478
|
+
functionlist = _locale.functionlist,
|
|
4479
|
+
button = _locale.button;
|
|
4480
|
+
var typeList = useMemo(function () {
|
|
4481
|
+
return [{
|
|
4482
|
+
t: 20,
|
|
4483
|
+
n: formulaMore.Crypto
|
|
4484
|
+
}, {
|
|
4485
|
+
t: 0,
|
|
4486
|
+
n: formulaMore.Math
|
|
4487
|
+
}, {
|
|
4488
|
+
t: 1,
|
|
4489
|
+
n: formulaMore.Statistical
|
|
4490
|
+
}, {
|
|
4491
|
+
t: 2,
|
|
4492
|
+
n: formulaMore.Lookup
|
|
4493
|
+
}, {
|
|
4494
|
+
t: 3,
|
|
4495
|
+
n: formulaMore.luckysheet
|
|
4496
|
+
}, {
|
|
4497
|
+
t: 4,
|
|
4498
|
+
n: formulaMore.dataMining
|
|
4499
|
+
}, {
|
|
4500
|
+
t: 5,
|
|
4501
|
+
n: formulaMore.Database
|
|
4502
|
+
}, {
|
|
4503
|
+
t: 6,
|
|
4504
|
+
n: formulaMore.Date
|
|
4505
|
+
}, {
|
|
4506
|
+
t: 7,
|
|
4507
|
+
n: formulaMore.Filter
|
|
4508
|
+
}, {
|
|
4509
|
+
t: 8,
|
|
4510
|
+
n: formulaMore.Financial
|
|
4511
|
+
}, {
|
|
4512
|
+
t: 9,
|
|
4513
|
+
n: formulaMore.Engineering
|
|
4514
|
+
}, {
|
|
4515
|
+
t: 10,
|
|
4516
|
+
n: formulaMore.Logical
|
|
4517
|
+
}, {
|
|
4518
|
+
t: 11,
|
|
4519
|
+
n: formulaMore.Operator
|
|
4520
|
+
}, {
|
|
4521
|
+
t: 12,
|
|
4522
|
+
n: formulaMore.Text
|
|
4523
|
+
}, {
|
|
4524
|
+
t: 13,
|
|
4525
|
+
n: formulaMore.Parser
|
|
4526
|
+
}, {
|
|
4527
|
+
t: 14,
|
|
4528
|
+
n: formulaMore.Array
|
|
4529
|
+
}, {
|
|
4530
|
+
t: -1,
|
|
4531
|
+
n: formulaMore.other
|
|
4532
|
+
}];
|
|
4533
|
+
}, [formulaMore]);
|
|
4534
|
+
var filteredFunctionList = useMemo(function () {
|
|
4535
|
+
if (searchText) {
|
|
4536
|
+
var list = [];
|
|
4537
|
+
var text = _.cloneDeep(searchText.toUpperCase());
|
|
4538
|
+
for (var i = 0; i < functionlist.length; i += 1) {
|
|
4539
|
+
if (/^[a-zA-Z]+$/.test(text)) {
|
|
4540
|
+
if (functionlist[i].n.indexOf(text) !== -1) {
|
|
4541
|
+
list.push(functionlist[i]);
|
|
4542
|
+
}
|
|
4543
|
+
} else if (functionlist[i].a.indexOf(text) !== -1) {
|
|
4544
|
+
list.push(functionlist[i]);
|
|
4545
|
+
}
|
|
4546
|
+
}
|
|
4547
|
+
return list;
|
|
4548
|
+
}
|
|
4549
|
+
return _.filter(functionlist, function (v) {
|
|
4550
|
+
return v.t === selectedType;
|
|
4551
|
+
});
|
|
4552
|
+
}, [functionlist, selectedType, searchText]);
|
|
4553
|
+
var onConfirm = useCallback(function () {
|
|
4554
|
+
var _context$luckysheet_s;
|
|
4555
|
+
var last = (_context$luckysheet_s = context.luckysheet_select_save) === null || _context$luckysheet_s === void 0 ? void 0 : _context$luckysheet_s[context.luckysheet_select_save.length - 1];
|
|
4556
|
+
var row_index = last === null || last === void 0 ? void 0 : last.row_focus;
|
|
4557
|
+
var col_index = last === null || last === void 0 ? void 0 : last.column_focus;
|
|
4558
|
+
if (!last) {
|
|
4559
|
+
row_index = 0;
|
|
4560
|
+
col_index = 0;
|
|
4561
|
+
} else {
|
|
4562
|
+
if (row_index == null) {
|
|
4563
|
+
var _last$row = _slicedToArray(last.row, 1);
|
|
4564
|
+
row_index = _last$row[0];
|
|
4565
|
+
}
|
|
4566
|
+
if (col_index == null) {
|
|
4567
|
+
var _last$column = _slicedToArray(last.column, 1);
|
|
4568
|
+
col_index = _last$column[0];
|
|
4569
|
+
}
|
|
4570
|
+
}
|
|
4571
|
+
var formulaTxt = "<span dir=\"auto\" class=\"luckysheet-formula-text-color\">=</span><span dir=\"auto\" class=\"luckysheet-formula-text-color\">".concat(filteredFunctionList[selectedFuncIndex].n.toUpperCase(), "</span><span dir=\"auto\" class=\"luckysheet-formula-text-color\">(</span>");
|
|
4572
|
+
setContext(function (ctx) {
|
|
4573
|
+
if (cellInput.current != null) {
|
|
4574
|
+
ctx.luckysheetCellUpdate = [row_index, col_index];
|
|
4575
|
+
globalCache.doNotUpdateCell = true;
|
|
4576
|
+
cellInput.current.innerHTML = formulaTxt;
|
|
4577
|
+
var spans = cellInput.current.childNodes;
|
|
4578
|
+
if (!_.isEmpty(spans)) {
|
|
4579
|
+
setCaretPosition(ctx, spans[spans.length - 1], 0, 1);
|
|
4580
|
+
}
|
|
4581
|
+
ctx.functionHint = filteredFunctionList[selectedFuncIndex].n.toUpperCase();
|
|
4582
|
+
ctx.functionCandidates = [];
|
|
4583
|
+
if (_.isEmpty(ctx.formulaCache.functionlistMap)) {
|
|
4584
|
+
for (var i = 0; i < functionlist.length; i += 1) {
|
|
4585
|
+
ctx.formulaCache.functionlistMap[functionlist[i].n] = functionlist[i];
|
|
4586
|
+
}
|
|
4587
|
+
}
|
|
4588
|
+
_onCancel();
|
|
4589
|
+
}
|
|
4590
|
+
});
|
|
4591
|
+
}, [cellInput, context.luckysheet_select_save, filteredFunctionList, globalCache, selectedFuncIndex, setContext, _onCancel, functionlist]);
|
|
4592
|
+
var onCancel = useCallback(function () {
|
|
4593
|
+
setContext(function (ctx) {
|
|
4594
|
+
cancelNormalSelected(ctx);
|
|
4595
|
+
if (cellInput.current) {
|
|
4596
|
+
cellInput.current.innerHTML = "";
|
|
4597
|
+
}
|
|
4598
|
+
});
|
|
4599
|
+
_onCancel();
|
|
4600
|
+
}, [_onCancel, cellInput, setContext]);
|
|
4601
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
4602
|
+
id: "luckysheet-search-formula"
|
|
4603
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
4604
|
+
className: "inpbox"
|
|
4605
|
+
}, /*#__PURE__*/React.createElement("div", null, formulaMore.findFunctionTitle, "\uFF1A"), /*#__PURE__*/React.createElement("input", {
|
|
4606
|
+
className: "formulaInputFocus",
|
|
4607
|
+
id: "searchFormulaListInput",
|
|
4608
|
+
placeholder: formulaMore.tipInputFunctionName,
|
|
4609
|
+
spellCheck: "false",
|
|
4610
|
+
onChange: function onChange(e) {
|
|
4611
|
+
return setSearchText(e.target.value);
|
|
4612
|
+
}
|
|
4613
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
4614
|
+
className: "selbox"
|
|
4615
|
+
}, /*#__PURE__*/React.createElement("span", null, formulaMore.selectCategory, "\uFF1A"), /*#__PURE__*/React.createElement("select", {
|
|
4616
|
+
id: "formulaTypeSelect",
|
|
4617
|
+
onChange: function onChange(e) {
|
|
4618
|
+
setSelectedType(parseInt(e.target.value, 10));
|
|
4619
|
+
setSelectedFuncIndex(0);
|
|
4620
|
+
}
|
|
4621
|
+
}, typeList.map(function (v) {
|
|
4622
|
+
return /*#__PURE__*/React.createElement("option", {
|
|
4623
|
+
key: v.t,
|
|
4624
|
+
value: v.t
|
|
4625
|
+
}, v.n);
|
|
4626
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
4627
|
+
className: "listbox",
|
|
4628
|
+
style: {
|
|
4629
|
+
height: 200
|
|
4630
|
+
}
|
|
4631
|
+
}, /*#__PURE__*/React.createElement("div", null, formulaMore.selectFunctionTitle, "\uFF1A"), /*#__PURE__*/React.createElement("div", {
|
|
4632
|
+
className: "formulaList"
|
|
4633
|
+
}, filteredFunctionList.map(function (v, index) {
|
|
4634
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
4635
|
+
className: "listBox".concat(index === selectedFuncIndex ? " on" : ""),
|
|
4636
|
+
key: v.n,
|
|
4637
|
+
onClick: function onClick() {
|
|
4638
|
+
return setSelectedFuncIndex(index);
|
|
4639
|
+
},
|
|
4640
|
+
tabIndex: 0
|
|
4641
|
+
}, /*#__PURE__*/React.createElement("div", null, v.n), /*#__PURE__*/React.createElement("div", null, v.a));
|
|
4642
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
4643
|
+
className: "fortune-dialog-box-button-container"
|
|
4644
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
4645
|
+
className: "fortune-message-box-button button-primary",
|
|
4646
|
+
onClick: onConfirm,
|
|
4647
|
+
tabIndex: 0
|
|
4648
|
+
}, button.confirm), /*#__PURE__*/React.createElement("div", {
|
|
4649
|
+
className: "fortune-message-box-button button-default",
|
|
4650
|
+
onClick: onCancel,
|
|
4651
|
+
tabIndex: 0
|
|
4652
|
+
}, button.cancel)));
|
|
4653
|
+
};
|
|
4654
|
+
|
|
4307
4655
|
var SplitColumn = function SplitColumn() {
|
|
4308
4656
|
var _useContext = useContext(WorkbookContext),
|
|
4309
4657
|
context = _useContext.context,
|
|
@@ -6107,10 +6455,9 @@ var Toolbar = function Toolbar(_ref) {
|
|
|
6107
6455
|
}), /*#__PURE__*/React.createElement(MenuDivider, null), /*#__PURE__*/React.createElement(Option, {
|
|
6108
6456
|
key: "formula",
|
|
6109
6457
|
onClick: function onClick() {
|
|
6110
|
-
|
|
6111
|
-
|
|
6112
|
-
|
|
6113
|
-
}
|
|
6458
|
+
showDialog(/*#__PURE__*/React.createElement(FormulaSearch$1, {
|
|
6459
|
+
onCancel: hideDialog
|
|
6460
|
+
}));
|
|
6114
6461
|
setOpen(false);
|
|
6115
6462
|
}
|
|
6116
6463
|
}, "".concat(formula.find, "...")));
|
|
@@ -9939,7 +10286,7 @@ var MoreItemsContaier = function MoreItemsContaier(_ref) {
|
|
|
9939
10286
|
}, children);
|
|
9940
10287
|
};
|
|
9941
10288
|
|
|
9942
|
-
function generateAPIs(context, setContext, handleUndo, handleRedo, settings, cellInput, scrollbarX, scrollbarY
|
|
10289
|
+
function generateAPIs(context, setContext, handleUndo, handleRedo, settings, cellInput, scrollbarX, scrollbarY) {
|
|
9943
10290
|
return {
|
|
9944
10291
|
applyOp: function applyOp(ops) {
|
|
9945
10292
|
setContext(function (ctx_) {
|
|
@@ -10240,50 +10587,6 @@ function generateAPIs(context, setContext, handleUndo, handleRedo, settings, cel
|
|
|
10240
10587
|
},
|
|
10241
10588
|
celldataToData: function celldataToData(celldata, rowCount, colCount) {
|
|
10242
10589
|
return api.celldataToData(celldata, rowCount, colCount);
|
|
10243
|
-
},
|
|
10244
|
-
insertFunction: function insertFunction(selectedFuncIndex, filteredFunctionList, callback) {
|
|
10245
|
-
var _context$luckysheet_s2;
|
|
10246
|
-
var last = (_context$luckysheet_s2 = context.luckysheet_select_save) === null || _context$luckysheet_s2 === void 0 ? void 0 : _context$luckysheet_s2[context.luckysheet_select_save.length - 1];
|
|
10247
|
-
var row_index = last === null || last === void 0 ? void 0 : last.row_focus;
|
|
10248
|
-
var col_index = last === null || last === void 0 ? void 0 : last.column_focus;
|
|
10249
|
-
if (!last) {
|
|
10250
|
-
row_index = 0;
|
|
10251
|
-
col_index = 0;
|
|
10252
|
-
} else {
|
|
10253
|
-
if (row_index == null) {
|
|
10254
|
-
var _last$row2 = _slicedToArray(last.row, 1);
|
|
10255
|
-
row_index = _last$row2[0];
|
|
10256
|
-
}
|
|
10257
|
-
if (col_index == null) {
|
|
10258
|
-
var _last$column2 = _slicedToArray(last.column, 1);
|
|
10259
|
-
col_index = _last$column2[0];
|
|
10260
|
-
}
|
|
10261
|
-
}
|
|
10262
|
-
var formulaTxt = "<span dir=\"auto\" class=\"luckysheet-formula-text-color\">=</span><span dir=\"auto\" class=\"luckysheet-formula-text-color\">".concat(filteredFunctionList[selectedFuncIndex].n.toUpperCase(), "</span><span dir=\"auto\" class=\"luckysheet-formula-text-color\">(</span>");
|
|
10263
|
-
var _locale2 = locale(context),
|
|
10264
|
-
functionlist = _locale2.functionlist;
|
|
10265
|
-
setContext(function (ctx) {
|
|
10266
|
-
if (cellInput != null && globalCache != null) {
|
|
10267
|
-
ctx.luckysheetCellUpdate = [row_index, col_index];
|
|
10268
|
-
globalCache.doNotUpdateCell = true;
|
|
10269
|
-
cellInput.innerHTML = formulaTxt;
|
|
10270
|
-
var spans = cellInput.childNodes;
|
|
10271
|
-
if (!_.isEmpty(spans)) {
|
|
10272
|
-
setCaretPosition(ctx, spans[spans.length - 1], 0, 1);
|
|
10273
|
-
}
|
|
10274
|
-
ctx.functionHint = filteredFunctionList[selectedFuncIndex].n.toUpperCase();
|
|
10275
|
-
ctx.functionCandidates = [];
|
|
10276
|
-
if (_.isEmpty(ctx.formulaCache.functionlistMap)) {
|
|
10277
|
-
for (var i = 0; i < functionlist.length; i += 1) {
|
|
10278
|
-
ctx.formulaCache.functionlistMap[functionlist[i].n] = functionlist[i];
|
|
10279
|
-
}
|
|
10280
|
-
}
|
|
10281
|
-
callback === null || callback === void 0 ? void 0 : callback();
|
|
10282
|
-
}
|
|
10283
|
-
});
|
|
10284
|
-
},
|
|
10285
|
-
getLocaleContext: function getLocaleContext() {
|
|
10286
|
-
return locale(context);
|
|
10287
10590
|
}
|
|
10288
10591
|
};
|
|
10289
10592
|
}
|
|
@@ -11491,8 +11794,8 @@ var Workbook = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
11491
11794
|
};
|
|
11492
11795
|
}, [onPaste]);
|
|
11493
11796
|
useImperativeHandle(ref, function () {
|
|
11494
|
-
return generateAPIs(context, setContextWithProduce, handleUndo, handleRedo, mergedSettings, cellInput.current, scrollbarX.current, scrollbarY.current
|
|
11495
|
-
}, [context, setContextWithProduce, handleUndo, handleRedo, mergedSettings
|
|
11797
|
+
return generateAPIs(context, setContextWithProduce, handleUndo, handleRedo, mergedSettings, cellInput.current, scrollbarX.current, scrollbarY.current);
|
|
11798
|
+
}, [context, setContextWithProduce, handleUndo, handleRedo, mergedSettings]);
|
|
11496
11799
|
var i = getSheetIndex(context, context.currentSheetId);
|
|
11497
11800
|
if (i == null) {
|
|
11498
11801
|
return null;
|