@fileverse-dev/dsheet 2.0.7-importExport-fix-1 → 2.0.7-percent

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.
@@ -7,7 +7,7 @@ export { defaultSettings } from './settings';
7
7
  export type { Settings, Hooks } from './settings';
8
8
  export { handleCopy, handleGlobalKeyDown, handlePaste, handlePasteByClick, fixPositionOnFrozenCells, handleCellAreaMouseDown, handleCellAreaDoubleClick, handleContextMenu, mouseRender, handleOverlayMouseMove, handleOverlayMouseUp, handleRowHeaderMouseDown, handleColumnHeaderMouseDown, handleColSizeHandleMouseDown, handleColSizeHandleDoubleClick, handleRowSizeHandleMouseDown, handleColFreezeHandleMouseDown, handleRowFreezeHandleMouseDown, } from './events';
9
9
  export * from './locale';
10
- export { getBorderInfoComputeRange, getBorderInfoCompute, normalizedCellAttr, normalizedAttr, getCellValue, setCellValue, getRealCellValue, mergeBorder, cancelNormalSelected, updateCell, getRangetxt, getRangeByTxt, getInlineStringHTML, applyLinkToSelection, getHyperlinksFromInlineSegments, getUniformLinkFromWindowSelectionInEditor, getHyperlinkAtCaretInContentEditable, getStyleByCell, clearSelectedCellFormat, clearRowsCellsFormat, clearColumnsCellsFormat, clipboard, moveToEnd, getRangeRectsByCharacterOffset, update, is_date, valueShowEs, FormulaCache, groupValuesRefresh, execFunctionGroup, setCaretPosition, getrangeseleciton, getFormulaEditorOwner, rangeHightlightselected, handleFormulaInput, israngeseleciton, createRangeHightlight, maybeRecoverDirtyRangeSelection, getFormulaRangeIndexAtCaret, isCaretAtValidFormulaRangeInsertionPoint, isLegacyFormulaRangeMode, markRangeSelectionDirty, setFormulaEditorOwner, functionHTMLGenerate, suppressFormulaRangeSelectionForInitialEdit, rangeSetValue, getFormulaRangeIndexForKeyboardSync, createFormulaRangeSelect, isFormulaReferenceInputMode, seedFormulaFuncSelectedRangeFromLastSelection, initFreeze, isInlineStringCell, getInlineStringNoStyle, rowLocation, rowLocationByIndex, colLocation, colLocationByIndex, insertRowCol, deleteRowCol, hideSelected, showSelected, isShowHidenCR, scrollToHighlightCell, selectTitlesMap, selectTitlesRange, normalizeSelection, syncPrimaryCellActiveFromSelection, setPrimaryCellActive, advancePrimaryCellInLastMultiSelection, snapSheetSelectionFocusToCellPreserveMultiRange, moveHighlightCell, deleteSelectedCellText, selectAll, fixRowStyleOverflowInFreeze, fixColumnStyleOverflowInFreeze, calcSelectionInfo, addSheet, deleteSheet, editSheetName, changeSheet, updateFormat, autoSelectionFormula, handleBold, handleItalic, handleStrikeThrough, handleUnderline, handleHorizontalAlign, handleVerticalAlign, handleTextColor, handleTextBackground, handleBorder, handleMerge, handleSort, handleFreeze, handleTextSize, handleSum, handleLink, captureLinkEditorOpenSnapshot, toolbarItemClickHandler, toolbarItemSelectedFunc, handleScreenShot, insertImage, showImgChooser, drawArrow, setEditingComment, removeEditingComment, newComment, editComment, deleteComment, showComments, showHideComment, showHideAllComments, onCommentBoxMoveStart, removeActiveImage, cancelActiveImgItem, onImageMoveStart, onImageResizeStart, createDropCellRange, sortSelection, searchAll, searchNext, replace, replaceAll, getSearchIndexArr, getSearchIndexArrAsync, getFindRangeOnCurrentSheet, getQuickSearchIndexArr, getQuickSearchHiddenConfig, getCellHyperlinks, getHyperlinkDisplayTextInCell, getInlineLinkPlainRange, getUniformLinkCoveringPlainRange, getUniformLinkAtPlainOffset, removeHyperlinkForLink, updateHyperlinkForLink, syncLinkCardAfterHyperlinkChange, expandCellRectForMerge, shouldQuickSearchUseAsync, runQuickSearchIndexArrAsync, QUICK_SEARCH_ASYNC_ROW_THRESHOLD, parseRangeText, getCellRowColumn, getCellHyperlink, saveHyperlink, removeHyperlink, showLinkCard, goToLink, isLinkValid, createFilterOptions, clearFilter, createFilter, getFilterColumnValues, getFilterColumnColors, orderbydatafiler, saveFilter, onCellsMoveStart, cfSplitRange, updateMoreCell, getRegStr, getDataArr, applyLocation, getOptionValue, getSelectRange, getDropdownList, setDropdownValue, confirmMessage, setConditionRules, handleOverlayTouchStart, handleOverlayTouchEnd, MAX_ZOOM_RATIO, MIN_ZOOM_RATIO, handleKeydownForZoom, jfrefreshgrid, sanitizeDuneUrl, insertDuneChart, onIframeMoveStart, onIframeResizeStart, onIframeMove, onIframeMoveEnd, onIframeResize, onIframeResizeEnd, setCellError, clearCellError, isdatatypemulti, diff, isdatetime, isRealNull, isRealNum, isNumericCellType, iscelldata, getcellrange, cancelFunctionrangeSelected, seletedHighlistByindex, spillSortResult, execfunction, insertUpdateFunctionGroup, remapFormulaReferencesByMap, checkCF, getComputeMap, cancelPaintModel, hideCRCount, getdatabyselection, } from './modules';
10
+ export { getBorderInfoComputeRange, getBorderInfoCompute, normalizedCellAttr, normalizedAttr, getCellValue, setCellValue, getRealCellValue, mergeBorder, cancelNormalSelected, updateCell, getRangetxt, getRangeByTxt, getInlineStringHTML, applyLinkToSelection, getHyperlinksFromInlineSegments, getUniformLinkFromWindowSelectionInEditor, getHyperlinkAtCaretInContentEditable, getStyleByCell, clearSelectedCellFormat, clearRowsCellsFormat, clearColumnsCellsFormat, clipboard, moveToEnd, getRangeRectsByCharacterOffset, update, is_date, valueShowEs, isTypedCurrencyDisplayFormat, isCurrencyLikeNumberFormat, FormulaCache, groupValuesRefresh, execFunctionGroup, setCaretPosition, getrangeseleciton, getFormulaEditorOwner, rangeHightlightselected, handleFormulaInput, israngeseleciton, createRangeHightlight, maybeRecoverDirtyRangeSelection, getFormulaRangeIndexAtCaret, isCaretAtValidFormulaRangeInsertionPoint, isLegacyFormulaRangeMode, markRangeSelectionDirty, setFormulaEditorOwner, functionHTMLGenerate, suppressFormulaRangeSelectionForInitialEdit, rangeSetValue, getFormulaRangeIndexForKeyboardSync, createFormulaRangeSelect, isFormulaReferenceInputMode, seedFormulaFuncSelectedRangeFromLastSelection, initFreeze, isInlineStringCell, getInlineStringNoStyle, rowLocation, rowLocationByIndex, colLocation, colLocationByIndex, insertRowCol, deleteRowCol, hideSelected, showSelected, isShowHidenCR, scrollToHighlightCell, selectTitlesMap, selectTitlesRange, normalizeSelection, syncPrimaryCellActiveFromSelection, setPrimaryCellActive, advancePrimaryCellInLastMultiSelection, snapSheetSelectionFocusToCellPreserveMultiRange, moveHighlightCell, deleteSelectedCellText, selectAll, fixRowStyleOverflowInFreeze, fixColumnStyleOverflowInFreeze, calcSelectionInfo, addSheet, deleteSheet, editSheetName, changeSheet, updateFormat, autoSelectionFormula, handleBold, handleItalic, handleStrikeThrough, handleUnderline, handleHorizontalAlign, handleVerticalAlign, handleTextColor, handleTextBackground, handleBorder, handleMerge, handleSort, handleFreeze, handleTextSize, handleSum, handleLink, captureLinkEditorOpenSnapshot, toolbarItemClickHandler, toolbarItemSelectedFunc, handleScreenShot, insertImage, showImgChooser, drawArrow, setEditingComment, removeEditingComment, newComment, editComment, deleteComment, showComments, showHideComment, showHideAllComments, onCommentBoxMoveStart, removeActiveImage, cancelActiveImgItem, onImageMoveStart, onImageResizeStart, createDropCellRange, sortSelection, searchAll, searchNext, replace, replaceAll, getSearchIndexArr, getSearchIndexArrAsync, getFindRangeOnCurrentSheet, getQuickSearchIndexArr, getQuickSearchHiddenConfig, getCellHyperlinks, getHyperlinkDisplayTextInCell, getInlineLinkPlainRange, getUniformLinkCoveringPlainRange, getUniformLinkAtPlainOffset, removeHyperlinkForLink, updateHyperlinkForLink, syncLinkCardAfterHyperlinkChange, expandCellRectForMerge, shouldQuickSearchUseAsync, runQuickSearchIndexArrAsync, QUICK_SEARCH_ASYNC_ROW_THRESHOLD, parseRangeText, getCellRowColumn, getCellHyperlink, saveHyperlink, removeHyperlink, showLinkCard, goToLink, isLinkValid, createFilterOptions, clearFilter, createFilter, getFilterColumnValues, getFilterColumnColors, orderbydatafiler, saveFilter, onCellsMoveStart, cfSplitRange, updateMoreCell, getRegStr, getDataArr, applyLocation, getOptionValue, getSelectRange, getDropdownList, setDropdownValue, confirmMessage, setConditionRules, handleOverlayTouchStart, handleOverlayTouchEnd, MAX_ZOOM_RATIO, MIN_ZOOM_RATIO, handleKeydownForZoom, jfrefreshgrid, sanitizeDuneUrl, insertDuneChart, onIframeMoveStart, onIframeResizeStart, onIframeMove, onIframeMoveEnd, onIframeResize, onIframeResizeEnd, setCellError, clearCellError, isdatatypemulti, diff, isdatetime, isRealNull, isRealNum, isNumericCellType, iscelldata, getcellrange, cancelFunctionrangeSelected, seletedHighlistByindex, spillSortResult, execfunction, insertUpdateFunctionGroup, remapFormulaReferencesByMap, checkCF, getComputeMap, cancelPaintModel, hideCRCount, getdatabyselection, } from './modules';
11
11
  export type { FilterDate, FilterValue, FilterColor } from './modules';
12
12
  export { getFreezeState, toggleFreeze, indexToColumnChar, escapeScriptTag, escapeHTMLTag, getSheetIndex, replaceHtml, isAllowEdit, isAllowEditReadOnly, filterPatch, patchToOp, opToPatch, inverseRowColOptions, } from './utils';
13
13
  export type { PatchOptions, ChangedSheet } from './utils';
@@ -1,7 +1,66 @@
1
- import { CellMatrix } from '../types';
1
+ import { Cell, CellMatrix } from '../types';
2
2
 
3
+ /** Below this absolute value, never use automatic scientific (Sheets-like). */
4
+ export declare const GS_PLAIN_MAX_ABS = 999999999999997;
5
+ /** Smallest 16-digit positive integer — use plain / text, not E-notation. */
6
+ export declare const GS_SIXTEEN_DIGIT_MIN_ABS = 1000000000000000;
7
+ /** Scientific only in (GS_PLAIN_MAX_ABS, 1e15) — 999…997 itself stays plain. */
8
+ export declare function gsAllowsScientificMagnitude(av: number): boolean;
9
+ /** Integer string (optional `-`, optional `,`) with ≥16 digits — store literally under General/Auto. */
10
+ export declare function isSixteenPlusDigitIntegerString(value: unknown): boolean;
11
+ /**
12
+ * Display string for a JS number when `toString()` may use `e` notation.
13
+ * Applies Sheets-like rules: no E below GS_PLAIN_MAX_ABS or at/above 16-digit scale.
14
+ */
15
+ export declare function formatMForNumericCellAvoidingGsRules(v: number): string;
16
+ /**
17
+ * Numeric safety gate for formula-computed numbers:
18
+ * - integer beyond MAX_SAFE_INTEGER => scientific
19
+ * - significant digits > 15 => scientific
20
+ */
21
+ export declare function shouldUseScientificForComputedNumber(v: number): boolean;
22
+ export declare function formatScientificForComputedNumber(v: number): string;
23
+ export declare function formatCompactScientific(v: number, fractionDigits?: number): string;
24
+ /**
25
+ * Sheets-like Auto decimal display:
26
+ * keep about 10 visible digits total (integer digits + decimal digits), with rounding.
27
+ * Examples:
28
+ * - 999999999.478 -> 999999999.5
29
+ * - 123456.123456 -> 123456.1235
30
+ */
31
+ export declare function formatGeneralAutoDecimalWithTenDigitRule(v: number): string | null;
3
32
  export declare function datenum_local(v: Date, date1904?: number): number;
4
33
  export declare function genarate(value: string | number | boolean): any[] | null;
34
+ /** Crypto tickers for typed prefix (e.g. BTC123) — keep aligned with toolbar CRYPTO_OPTIONS. */
35
+ export declare const TYPED_CRYPTO_CURRENCY_PREFIXES: readonly ["BTC", "ETH", "SOL"];
36
+ /**
37
+ * True when `fa` matches formats produced by typed currency/crypto prefix (or the same shape).
38
+ * Used so the format dropdown shows "Currency" instead of mislabeling `#,##0` masks as "Number".
39
+ */
40
+ export declare function isTypedCurrencyDisplayFormat(fa: string | undefined, currencyDetail: unknown): boolean;
41
+ /**
42
+ * True for currency / accounting / crypto number formats where we should keep `fa` when the user
43
+ * types plain text, so a later numeric entry still formats like Google Sheets.
44
+ */
45
+ export declare function isCurrencyLikeNumberFormat(fa: string | undefined, currencyDetail: unknown): boolean;
46
+ /**
47
+ * If the user types a known currency/crypto prefix immediately followed by a parseable number
48
+ * (e.g. `$1,234.5`, `€100`, `BTC1.5`), return numeric cell value + matching currency format.
49
+ * Uses locale `currencyDetail` (fiat symbols); object-shaped locales yield no fiat prefixes.
50
+ */
51
+ export declare function parseCurrencyPrefixedInput(raw: string, currencyDetail: unknown): [string, {
52
+ fa: string;
53
+ t: string;
54
+ }, number] | null;
55
+ export declare function genarateOrCurrencyPrefixed(vupdateStr: string, vupdate: any, currencyDetail: unknown): ReturnType<typeof genarate>;
5
56
  export declare function update(fmt: string, v: any): string;
57
+ /** Max decimal places for toolbar +/- on General (Auto) without switching to a numeric `fa`. */
58
+ export declare const MAX_GENERAL_AUTO_DP = 15;
59
+ /**
60
+ * Recompute `m` for numeric cells with `fa === "General"`.
61
+ * When `ct.dp` is set (1..MAX), uses fixed decimals like Sheets Auto + decimal buttons.
62
+ * Otherwise uses the usual `genarate` General display.
63
+ */
64
+ export declare function refreshGeneralNumericDisplay(cell: Cell): void;
6
65
  export declare function is_date(fmt: string, v?: any): boolean;
7
66
  export declare function valueShowEs(r: number, c: number, d: CellMatrix): any;
@@ -2,7 +2,7 @@ export { getBorderInfoComputeRange, getBorderInfoCompute } from './border';
2
2
  export { normalizedCellAttr, normalizedAttr, getCellValue, setCellValue, getRealCellValue, mergeBorder, cancelNormalSelected, updateCell, getRangetxt, getRangeByTxt, getInlineStringHTML, getStyleByCell, clearSelectedCellFormat, clearRowsCellsFormat, clearColumnsCellsFormat, cancelFunctionrangeSelected, } from './cell';
3
3
  export { default as clipboard } from './clipboard';
4
4
  export { moveToEnd, getRangeRectsByCharacterOffset } from './cursor';
5
- export { update, is_date, valueShowEs } from './format';
5
+ export { update, is_date, valueShowEs, isTypedCurrencyDisplayFormat, isCurrencyLikeNumberFormat, } from './format';
6
6
  export { FormulaCache, groupValuesRefresh, setCaretPosition, getrangeseleciton, getFormulaEditorOwner, rangeHightlightselected, handleFormulaInput, israngeseleciton, createRangeHightlight, createFormulaRangeSelect, maybeRecoverDirtyRangeSelection, delFunctionGroup, functionHTMLGenerate, onFormulaRangeDragEnd, rangeDrag, rangeSetValue, remapFormulaReferencesByMap, getFormulaRangeIndexAtCaret, isCaretAtValidFormulaRangeInsertionPoint, isLegacyFormulaRangeMode, markRangeSelectionDirty, getFormulaRangeIndexForKeyboardSync, isFormulaReferenceInputMode, seedFormulaFuncSelectedRangeFromLastSelection, functionStrChange, setFormulaEditorOwner, getAllFunctionGroup, suppressFormulaRangeSelectionForInitialEdit, } from './formula';
7
7
  export { initFreeze } from './freeze';
8
8
  export { isInlineStringCell, getInlineStringNoStyle, applyLinkToSelection, getHyperlinksFromInlineSegments, getUniformLinkFromWindowSelectionInEditor, getHyperlinkAtCaretInContentEditable, } from './inline-string';
@@ -43,11 +43,13 @@ export type Cell = {
43
43
  cs?: number;
44
44
  };
45
45
  f?: string;
46
+ /** `dp`: fixed decimal places for display when `fa` is General (Auto); does not change `fa`/`t`. */
46
47
  ct?: {
47
48
  fa?: string;
48
49
  t?: string;
49
50
  tb?: string;
50
51
  s?: any;
52
+ dp?: number;
51
53
  };
52
54
  qp?: number;
53
55
  spl?: any;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@fileverse-dev/dsheet",
3
3
  "private": false,
4
4
  "description": "DSheet",
5
- "version": "2.0.7-importExport-fix-1",
5
+ "version": "2.0.7-percent",
6
6
  "main": "dist/index.es.js",
7
7
  "module": "dist/index.es.js",
8
8
  "exports": {
@@ -91,4 +91,4 @@
91
91
  "typescript": "^5.2.2",
92
92
  "vite": "^5.0.0"
93
93
  }
94
- }
94
+ }