@fileverse-dev/fortune-core 1.0.2-mod-67-patch-4 → 1.0.2-mod-72

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/context.d.ts CHANGED
@@ -112,6 +112,7 @@ export type Context = {
112
112
  rangeIndex: number;
113
113
  } & Rect) | undefined;
114
114
  functionCandidates: any[];
115
+ defaultCandidates: any[];
115
116
  functionHint: string | null | undefined;
116
117
  luckysheet_copy_save?: {
117
118
  dataSheetId: string;
package/dist/index.esm.js CHANGED
@@ -56992,16 +56992,47 @@ function helpFunctionExe($editer, currSelection, ctx) {
56992
56992
  }
56993
56993
  return funcName;
56994
56994
  }
56995
+ function filterAndPickOthers(allItems, nameArray) {
56996
+ var nameSet = new Set(nameArray);
56997
+ var matched = [];
56998
+ var unmatched = [];
56999
+ allItems.forEach(function (item) {
57000
+ if (nameSet.has(item.n)) {
57001
+ matched.push(item);
57002
+ } else if (item.t !== 20) {
57003
+ unmatched.push(item);
57004
+ }
57005
+ });
57006
+ var shuffled = unmatched.reduce(function (acc, curr, index) {
57007
+ var rand = Math.floor(Math.random() * (index + 1));
57008
+ acc[index] = acc[rand];
57009
+ acc[rand] = curr;
57010
+ return acc;
57011
+ }, []);
57012
+ var others = shuffled.slice(0, 5);
57013
+ var result = [].concat(matched, _toConsumableArray(others));
57014
+ return result;
57015
+ }
57016
+ var PROMOTED_CRYPTO_FUNCTIONS = ["ETHERSCAN", "BLOCKSCOUT", "COINGECKO", "GNOSIS", "SAFE"];
56995
57017
  function rangeHightlightselected(ctx, $editor) {
56996
57018
  var currSelection = getrangeseleciton();
56997
57019
  if (!currSelection) return;
56998
57020
  var currText = _.trim(currSelection.textContent || "");
57021
+ if (currText === "=") {
57022
+ var _locale3 = locale(ctx),
57023
+ functionlist = _locale3.functionlist;
57024
+ ctx.defaultCandidates = filterAndPickOthers(functionlist, PROMOTED_CRYPTO_FUNCTIONS);
57025
+ var funcName = helpFunctionExe($editor, currSelection, ctx);
57026
+ ctx.functionHint = funcName === null || funcName === void 0 ? void 0 : funcName.toUpperCase();
57027
+ return;
57028
+ }
56999
57029
  if (currText === null || currText === void 0 ? void 0 : currText.match(/^[a-zA-Z_]+$/)) {
57030
+ ctx.defaultCandidates = [];
57000
57031
  searchFunction(ctx, currText.toUpperCase());
57001
57032
  ctx.functionHint = null;
57002
57033
  } else {
57003
- var funcName = helpFunctionExe($editor, currSelection, ctx);
57004
- ctx.functionHint = funcName === null || funcName === void 0 ? void 0 : funcName.toUpperCase();
57034
+ var _funcName = helpFunctionExe($editor, currSelection, ctx);
57035
+ ctx.functionHint = _funcName === null || _funcName === void 0 ? void 0 : _funcName.toUpperCase();
57005
57036
  ctx.functionCandidates = [];
57006
57037
  }
57007
57038
  }
@@ -63021,6 +63052,7 @@ function defaultContext(refs) {
63021
63052
  formulaRangeHighlight: [],
63022
63053
  formulaRangeSelect: undefined,
63023
63054
  functionCandidates: [],
63055
+ defaultCandidates: [],
63024
63056
  functionHint: null,
63025
63057
  luckysheet_copy_save: undefined,
63026
63058
  luckysheet_paste_iscut: false,
@@ -80209,4 +80241,4 @@ function handlePasteByClick(ctx, clipboardData, triggerType) {
80209
80241
  } else ;
80210
80242
  }
80211
80243
 
80212
- export { CFSplitRange, Canvas, FormulaCache, MAX_ZOOM_RATIO, MIN_ZOOM_RATIO, addSheet, index as api, applyLocation, attrToCssName, autoSelectionFormula, calcSelectionInfo, cancelActiveImgItem, cancelFunctionrangeSelected, cancelNormalSelected, cancelPaintModel, cellFocus, cfSplitRange, changeSheet, chatatABC, checkCF, checkCellIsLocked, checkProtectionAllSelected, checkProtectionFormatCells, checkProtectionSelectLockedOrUnLockedCells, checkboxChange, clearFilter, clearMeasureTextCache, colHasMerged, colLocation, colLocationByIndex, colors, columnCharToIndex, commentBoxProps, compute, computeRowlenArr, confirmMessage, convertCssToStyleList, convertSpanToShareString, copy, createDropCellRange, createFilter, createFilterOptions, createFormulaRangeSelect, createRangeHightlight, dataRangeSelection, datenum_local, defaultContext, defaultFont, defaultSettings, defaultStyle, delFunctionGroup, deleteCellInSave, deleteComment, deleteRowCol, deleteSelectedCellText, deleteSheet, diff, drawArrow, drawLineInfo, dropCellCache, editComment, editSheetName, ensureSheetIndex, error, escapeHTMLTag, escapeScriptTag, execFunctionGroup, execfunction, expandRowsAndColumns, extractFormulaCellOps, filterPatch, fixColumnStyleOverflowInFreeze, fixPositionOnFrozenCells, fixRowStyleOverflowInFreeze, functionCopy, functionHTMLGenerate, functionStrChange, genarate, generateRandomId, generateRandomSheetName, getAllFunctionGroup, getArrowCanvasSize, getBorderInfoCompute, getBorderInfoComputeRange, getCellHyperlink, getCellRowColumn, getCellTextInfo, getCellTopRightPostion, getCellValue, getColMerge, getColorGradation, getCommentBoxByRC, getCommentBoxPosition, getComputeMap, getCurrentRules, getDataArr, getDataBySelectionNoCopy, getDropdownList, getFailureText, getFilterColumnColors, getFilterColumnValues, getFlattenedRange, getFlowdata, getFontSet, getFontStyleByCell, getFreezeState, getFrozenHandleLeft, getFrozenHandleTop, getHintText, getHistoryRules, getInlineStringHTML, getInlineStringNoStyle, getMeasureText, getNowDateTime, getNullData, getOptionValue, getOrigincell, getQKBorder, getRange, getRangeArr, getRangeByTxt, getRangetxt, getRealCellValue, getRegExpStr, getRegStr, getRowMerge, getSearchIndexArr, getSelectRange, getSheetByIndex, getSheetIdByName, getSheetIndex, getStyleByCell, getTypeItemHide, getcellFormula, getcellrange, getdatabyselection, getrangeseleciton, goToLink, groupValuesRefresh, handleArrowKey, handleBold, handleBorder, handleCellAreaDoubleClick, handleCellAreaMouseDown, handleClearFormat, handleColFreezeHandleMouseDown, handleColSizeHandleMouseDown, handleColumnHeaderMouseDown, handleContextMenu, handleCopy, handleCurrencyFormat, handleFormatPainter, handleFormulaInput, handleFreeze, handleGlobalEnter, handleGlobalKeyDown, handleGlobalWheel, handleHorizontalAlign, handleItalic, handleKeydownForZoom, handleLink, handleMerge, handleNumberDecrease, handleNumberIncrease, handleOverlayMouseMove, handleOverlayMouseUp, handleOverlayTouchEnd, handleOverlayTouchMove, handleOverlayTouchStart, handlePaste, handlePasteByClick, handlePercentageFormat, handleRowFreezeHandleMouseDown, handleRowHeaderMouseDown, handleRowSizeHandleMouseDown, handleScreenShot, handleSort, handleStrikeThrough, handleSum, handleTextBackground, handleTextColor, handleTextSize, handleUnderline, handleVerticalAlign, handleWithCtrlOrMetaKey, hasChinaword, hasPartMC, hideCRCount, hideDropCellSelection, hideSelected, imageProps, indexToColumnChar, initFreeze, initSheetIndex, inlineStyleAffectAttribute, inlineStyleAffectCssName, insertDuneChart, insertIframe, insertImage, insertRowCol, insertUpdateFunctionGroup, inverseRowColOptions, isAllSelectedCellsInStatus, isAllowEdit, isInlineStringCT, isInlineStringCell, isLinkValid, isRealNull, isRealNum, isShowHidenCR, isSupportBoundingBox, is_date, iscelldata, isdatatype, isdatatypemulti, isdatetime, israngeseleciton, jfrefreshgrid, labelFilterOptionState, locale, luckysheetUpdateCell, mergeBorder, mergeCells, mergeMoveMain, mousePosition, moveHighlightCell, moveHighlightRange, moveToEnd, newComment, normalizeSelection, normalizedAttr, normalizedCellAttr, onCellsMove, onCellsMoveEnd, onCellsMoveStart, onCommentBoxMove, onCommentBoxMoveEnd, onCommentBoxMoveStart, onCommentBoxResize, onCommentBoxResizeEnd, onCommentBoxResizeStart, onDropCellSelect, onDropCellSelectEnd, onFormulaRangeDragEnd, onIframeMove, onIframeMoveEnd, onIframeMoveStart, onIframeResize, onIframeResizeEnd, onIframeResizeStart, onImageMove, onImageMoveEnd, onImageMoveStart, onImageResize, onImageResizeEnd, onImageResizeStart, onRangeSelectionModalMove, onRangeSelectionModalMoveEnd, onRangeSelectionModalMoveStart, onSearchDialogMove, onSearchDialogMoveEnd, onSearchDialogMoveStart, opToPatch, orderbydata, orderbydatafiler, overShowComment, pasteHandlerOfPaintModel, patchToOp, rangeDrag, rangeDragColumn, rangeDragRow, rangeHightlightselected, rangeSetValue, rangeValueToHtml, removeActiveImage, removeEditingComment, removeHyperlink, removeOverShowComment, replace, replaceAll, replaceHtml, rgbToHex, rowHasMerged, rowLocation, rowLocationByIndex, sanitizeDuneUrl, saveFilter, saveHyperlink, saveIframe, saveImage, scrollToFrozenRowCol, scrollToHighlightCell, searchAll, searchNext, selectAll, selectIsOverlap, selectTextContent, selectTextContentCross, selectTitlesMap, selectTitlesRange, selectionCache, selectionCopyShow, seletedHighlistByindex, setCaretPosition, setCellValue, setConditionRules, setDropdownValue, setEditingComment, showComments, showDropCellSelection, showHideAllComments, showHideComment, showImgChooser, showLinkCard, showSelected, sortDataRange, sortSelection, storeSheetParamALL, toggleFreeze, toolbarItemClickHandler, toolbarItemSelectedFunc, update, updateCell, updateContextWithCanvas, updateContextWithSheetData, updateDropCell, updateFormat, updateFormatCell, updateInlineStringFormat, updateInlineStringFormatOutside, updateItem, updateMoreCell, updateSheet, validateCellData, validateIdCard, valueIsError, valueShowEs };
80244
+ export { CFSplitRange, Canvas, FormulaCache, MAX_ZOOM_RATIO, MIN_ZOOM_RATIO, PROMOTED_CRYPTO_FUNCTIONS, addSheet, index as api, applyLocation, attrToCssName, autoSelectionFormula, calcSelectionInfo, cancelActiveImgItem, cancelFunctionrangeSelected, cancelNormalSelected, cancelPaintModel, cellFocus, cfSplitRange, changeSheet, chatatABC, checkCF, checkCellIsLocked, checkProtectionAllSelected, checkProtectionFormatCells, checkProtectionSelectLockedOrUnLockedCells, checkboxChange, clearFilter, clearMeasureTextCache, colHasMerged, colLocation, colLocationByIndex, colors, columnCharToIndex, commentBoxProps, compute, computeRowlenArr, confirmMessage, convertCssToStyleList, convertSpanToShareString, copy, createDropCellRange, createFilter, createFilterOptions, createFormulaRangeSelect, createRangeHightlight, dataRangeSelection, datenum_local, defaultContext, defaultFont, defaultSettings, defaultStyle, delFunctionGroup, deleteCellInSave, deleteComment, deleteRowCol, deleteSelectedCellText, deleteSheet, diff, drawArrow, drawLineInfo, dropCellCache, editComment, editSheetName, ensureSheetIndex, error, escapeHTMLTag, escapeScriptTag, execFunctionGroup, execfunction, expandRowsAndColumns, extractFormulaCellOps, filterPatch, fixColumnStyleOverflowInFreeze, fixPositionOnFrozenCells, fixRowStyleOverflowInFreeze, functionCopy, functionHTMLGenerate, functionStrChange, genarate, generateRandomId, generateRandomSheetName, getAllFunctionGroup, getArrowCanvasSize, getBorderInfoCompute, getBorderInfoComputeRange, getCellHyperlink, getCellRowColumn, getCellTextInfo, getCellTopRightPostion, getCellValue, getColMerge, getColorGradation, getCommentBoxByRC, getCommentBoxPosition, getComputeMap, getCurrentRules, getDataArr, getDataBySelectionNoCopy, getDropdownList, getFailureText, getFilterColumnColors, getFilterColumnValues, getFlattenedRange, getFlowdata, getFontSet, getFontStyleByCell, getFreezeState, getFrozenHandleLeft, getFrozenHandleTop, getHintText, getHistoryRules, getInlineStringHTML, getInlineStringNoStyle, getMeasureText, getNowDateTime, getNullData, getOptionValue, getOrigincell, getQKBorder, getRange, getRangeArr, getRangeByTxt, getRangetxt, getRealCellValue, getRegExpStr, getRegStr, getRowMerge, getSearchIndexArr, getSelectRange, getSheetByIndex, getSheetIdByName, getSheetIndex, getStyleByCell, getTypeItemHide, getcellFormula, getcellrange, getdatabyselection, getrangeseleciton, goToLink, groupValuesRefresh, handleArrowKey, handleBold, handleBorder, handleCellAreaDoubleClick, handleCellAreaMouseDown, handleClearFormat, handleColFreezeHandleMouseDown, handleColSizeHandleMouseDown, handleColumnHeaderMouseDown, handleContextMenu, handleCopy, handleCurrencyFormat, handleFormatPainter, handleFormulaInput, handleFreeze, handleGlobalEnter, handleGlobalKeyDown, handleGlobalWheel, handleHorizontalAlign, handleItalic, handleKeydownForZoom, handleLink, handleMerge, handleNumberDecrease, handleNumberIncrease, handleOverlayMouseMove, handleOverlayMouseUp, handleOverlayTouchEnd, handleOverlayTouchMove, handleOverlayTouchStart, handlePaste, handlePasteByClick, handlePercentageFormat, handleRowFreezeHandleMouseDown, handleRowHeaderMouseDown, handleRowSizeHandleMouseDown, handleScreenShot, handleSort, handleStrikeThrough, handleSum, handleTextBackground, handleTextColor, handleTextSize, handleUnderline, handleVerticalAlign, handleWithCtrlOrMetaKey, hasChinaword, hasPartMC, hideCRCount, hideDropCellSelection, hideSelected, imageProps, indexToColumnChar, initFreeze, initSheetIndex, inlineStyleAffectAttribute, inlineStyleAffectCssName, insertDuneChart, insertIframe, insertImage, insertRowCol, insertUpdateFunctionGroup, inverseRowColOptions, isAllSelectedCellsInStatus, isAllowEdit, isInlineStringCT, isInlineStringCell, isLinkValid, isRealNull, isRealNum, isShowHidenCR, isSupportBoundingBox, is_date, iscelldata, isdatatype, isdatatypemulti, isdatetime, israngeseleciton, jfrefreshgrid, labelFilterOptionState, locale, luckysheetUpdateCell, mergeBorder, mergeCells, mergeMoveMain, mousePosition, moveHighlightCell, moveHighlightRange, moveToEnd, newComment, normalizeSelection, normalizedAttr, normalizedCellAttr, onCellsMove, onCellsMoveEnd, onCellsMoveStart, onCommentBoxMove, onCommentBoxMoveEnd, onCommentBoxMoveStart, onCommentBoxResize, onCommentBoxResizeEnd, onCommentBoxResizeStart, onDropCellSelect, onDropCellSelectEnd, onFormulaRangeDragEnd, onIframeMove, onIframeMoveEnd, onIframeMoveStart, onIframeResize, onIframeResizeEnd, onIframeResizeStart, onImageMove, onImageMoveEnd, onImageMoveStart, onImageResize, onImageResizeEnd, onImageResizeStart, onRangeSelectionModalMove, onRangeSelectionModalMoveEnd, onRangeSelectionModalMoveStart, onSearchDialogMove, onSearchDialogMoveEnd, onSearchDialogMoveStart, opToPatch, orderbydata, orderbydatafiler, overShowComment, pasteHandlerOfPaintModel, patchToOp, rangeDrag, rangeDragColumn, rangeDragRow, rangeHightlightselected, rangeSetValue, rangeValueToHtml, removeActiveImage, removeEditingComment, removeHyperlink, removeOverShowComment, replace, replaceAll, replaceHtml, rgbToHex, rowHasMerged, rowLocation, rowLocationByIndex, sanitizeDuneUrl, saveFilter, saveHyperlink, saveIframe, saveImage, scrollToFrozenRowCol, scrollToHighlightCell, searchAll, searchNext, selectAll, selectIsOverlap, selectTextContent, selectTextContentCross, selectTitlesMap, selectTitlesRange, selectionCache, selectionCopyShow, seletedHighlistByindex, setCaretPosition, setCellValue, setConditionRules, setDropdownValue, setEditingComment, showComments, showDropCellSelection, showHideAllComments, showHideComment, showImgChooser, showLinkCard, showSelected, sortDataRange, sortSelection, storeSheetParamALL, toggleFreeze, toolbarItemClickHandler, toolbarItemSelectedFunc, update, updateCell, updateContextWithCanvas, updateContextWithSheetData, updateDropCell, updateFormat, updateFormatCell, updateInlineStringFormat, updateInlineStringFormatOutside, updateItem, updateMoreCell, updateSheet, validateCellData, validateIdCard, valueIsError, valueShowEs };
package/dist/index.js CHANGED
@@ -57002,16 +57002,47 @@ function helpFunctionExe($editer, currSelection, ctx) {
57002
57002
  }
57003
57003
  return funcName;
57004
57004
  }
57005
+ function filterAndPickOthers(allItems, nameArray) {
57006
+ var nameSet = new Set(nameArray);
57007
+ var matched = [];
57008
+ var unmatched = [];
57009
+ allItems.forEach(function (item) {
57010
+ if (nameSet.has(item.n)) {
57011
+ matched.push(item);
57012
+ } else if (item.t !== 20) {
57013
+ unmatched.push(item);
57014
+ }
57015
+ });
57016
+ var shuffled = unmatched.reduce(function (acc, curr, index) {
57017
+ var rand = Math.floor(Math.random() * (index + 1));
57018
+ acc[index] = acc[rand];
57019
+ acc[rand] = curr;
57020
+ return acc;
57021
+ }, []);
57022
+ var others = shuffled.slice(0, 5);
57023
+ var result = [].concat(matched, _toConsumableArray(others));
57024
+ return result;
57025
+ }
57026
+ var PROMOTED_CRYPTO_FUNCTIONS = ["ETHERSCAN", "BLOCKSCOUT", "COINGECKO", "GNOSIS", "SAFE"];
57005
57027
  function rangeHightlightselected(ctx, $editor) {
57006
57028
  var currSelection = getrangeseleciton();
57007
57029
  if (!currSelection) return;
57008
57030
  var currText = ___default['default'].trim(currSelection.textContent || "");
57031
+ if (currText === "=") {
57032
+ var _locale3 = locale(ctx),
57033
+ functionlist = _locale3.functionlist;
57034
+ ctx.defaultCandidates = filterAndPickOthers(functionlist, PROMOTED_CRYPTO_FUNCTIONS);
57035
+ var funcName = helpFunctionExe($editor, currSelection, ctx);
57036
+ ctx.functionHint = funcName === null || funcName === void 0 ? void 0 : funcName.toUpperCase();
57037
+ return;
57038
+ }
57009
57039
  if (currText === null || currText === void 0 ? void 0 : currText.match(/^[a-zA-Z_]+$/)) {
57040
+ ctx.defaultCandidates = [];
57010
57041
  searchFunction(ctx, currText.toUpperCase());
57011
57042
  ctx.functionHint = null;
57012
57043
  } else {
57013
- var funcName = helpFunctionExe($editor, currSelection, ctx);
57014
- ctx.functionHint = funcName === null || funcName === void 0 ? void 0 : funcName.toUpperCase();
57044
+ var _funcName = helpFunctionExe($editor, currSelection, ctx);
57045
+ ctx.functionHint = _funcName === null || _funcName === void 0 ? void 0 : _funcName.toUpperCase();
57015
57046
  ctx.functionCandidates = [];
57016
57047
  }
57017
57048
  }
@@ -63031,6 +63062,7 @@ function defaultContext(refs) {
63031
63062
  formulaRangeHighlight: [],
63032
63063
  formulaRangeSelect: undefined,
63033
63064
  functionCandidates: [],
63065
+ defaultCandidates: [],
63034
63066
  functionHint: null,
63035
63067
  luckysheet_copy_save: undefined,
63036
63068
  luckysheet_paste_iscut: false,
@@ -80224,6 +80256,7 @@ exports.Canvas = Canvas;
80224
80256
  exports.FormulaCache = FormulaCache;
80225
80257
  exports.MAX_ZOOM_RATIO = MAX_ZOOM_RATIO;
80226
80258
  exports.MIN_ZOOM_RATIO = MIN_ZOOM_RATIO;
80259
+ exports.PROMOTED_CRYPTO_FUNCTIONS = PROMOTED_CRYPTO_FUNCTIONS;
80227
80260
  exports.addSheet = addSheet;
80228
80261
  exports.api = index;
80229
80262
  exports.applyLocation = applyLocation;
@@ -41,6 +41,7 @@ export declare function createFormulaRangeSelect(ctx: Context, select: {
41
41
  export declare function createRangeHightlight(ctx: Context, inputInnerHtmlStr: string, ignoreRangeIndex?: number): void;
42
42
  export declare function setCaretPosition(ctx: Context, textDom: HTMLElement, children: number, pos: number): void;
43
43
  export declare function getrangeseleciton(): ParentNode | ChildNode | null | undefined;
44
+ export declare const PROMOTED_CRYPTO_FUNCTIONS: string[];
44
45
  export declare function rangeHightlightselected(ctx: Context, $editor: HTMLDivElement): void;
45
46
  export declare function functionHTMLGenerate(txt: string): string;
46
47
  export declare function handleFormulaInput(ctx: Context, $copyTo: HTMLDivElement | null | undefined, $editor: HTMLDivElement, kcode: number, preText?: string, refreshRangeSelect?: boolean): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fileverse-dev/fortune-core",
3
- "version": "1.0.2-mod-67-patch-4",
3
+ "version": "1.0.2-mod-72",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.esm.js",
6
6
  "typings": "dist/index.d.ts",
@@ -10,7 +10,7 @@
10
10
  "repository": "https://github.com/ruilisi/fortune-sheet",
11
11
  "license": "MIT",
12
12
  "dependencies": {
13
- "@fileverse-dev/formula-parser": "0.2.13-mod-15-patch-4",
13
+ "@fileverse-dev/formula-parser": "0.2.13-mod-16",
14
14
  "dayjs": "^1.11.0",
15
15
  "immer": "^9.0.12",
16
16
  "lodash": "^4.17.21",