@fileverse-dev/dsheet 4.0.5 → 4.1.0-cmt-1

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.d.ts CHANGED
@@ -6,8 +6,9 @@ export { FLVURL } from '@fileverse-dev/formulajs';
6
6
  export { loadLocale } from './sheet-engine/core';
7
7
  export type { ErrorMessageHandlerReturnType, DataBlockEvent, DataBlockEventType, ApiKeyStorage } from './editor/types';
8
8
  export type { PanelConfig, PanelId, BuiltInPanelType } from './editor/types';
9
- export type { CommentThread, CommentReply, CommentActionParams, CommentsConfig, } from './editor/types/comments';
9
+ export type { CommentThread, CommentReply, CommentActionParams, CommentsConfig, CommentAnchorMove, } from './editor/types/comments';
10
10
  export { CommentAction } from './editor/types/comments';
11
+ export { remapCommentAnchors } from './editor/utils/remap-comment-anchors';
11
12
  export { CommentsContent } from './editor/components/comments/comment-sidebar';
12
13
  export { CommentCellUI } from './editor/components/comments/comment-cell-popup';
13
14
  export { useEnsStatus } from './editor/components/comments/ens/use-ens-status';
package/dist/index.es.js CHANGED
@@ -1,59 +1,60 @@
1
- import { C as s, d as t, f as o, S as r, g as l, h as d, j as n, T as i, k as S, l as c, n as h, o as m, p, q as C, t as u, u as E, v as F, w as g, x, z as R, A as I, B as f, D as w, E as A, F as L, G as T, H as v, I as D, J as M } from "./index-BqGOKo9u.js";
2
- import { cw as k, cx as V, cy as y, cE as z, bq as G, e as P, f as U, l as X, a as _, dg as j, dh as B, b9 as H, di as O, dj as q, dn as J, dp as K, dr as N, I as Y, dG as Z, ed as Q, b2 as W } from "./executeStringFunction-B6fhDKyN.js";
3
- import { FLVURL as ee } from "@fileverse-dev/formulajs";
4
- import { E as se, S as te } from "./constants-CRFfbkoQ.js";
1
+ import { C as s, d as t, f as o, S as r, g as l, h as n, j as d, T as i, k as c, l as S, n as m, o as h, p, q as C, t as u, u as E, v as F, w as g, x, z as A, A as I, B as R, D as f, E as L, F as w, G as T, H as v, I as b, J as k, K as D } from "./index-CsYiH7pp.js";
2
+ import { cy as z, cz as V, cA as y, cG as G, bs as P, e as U, f as X, l as _, a as j, di as B, dj as H, bb as O, dk as q, dl as J, dq as K, dr as N, dt as Y, I as Z, dI as Q, ef as W, b4 as $ } from "./executeStringFunction-BJ00H04h.js";
3
+ import { FLVURL as ae } from "@fileverse-dev/formulajs";
4
+ import { E as te, S as oe } from "./constants-CRFfbkoQ.js";
5
5
  export {
6
6
  s as CommentAction,
7
7
  t as CommentCellUI,
8
8
  o as CommentsContent,
9
9
  r as DSheetEditor,
10
10
  l as DSheetSkeleton,
11
- se as ERROR_MESSAGES_FLAG,
12
- ee as FLVURL,
13
- d as FortuneCore,
14
- te as SERVICES_API_KEY,
15
- n as SupportedChain,
11
+ te as ERROR_MESSAGES_FLAG,
12
+ ae as FLVURL,
13
+ n as FortuneCore,
14
+ oe as SERVICES_API_KEY,
15
+ d as SupportedChain,
16
16
  i as TEMPLATES,
17
- S as api,
18
- k as clearColumnsCellsFormat,
19
- c as clearFilter,
17
+ c as api,
18
+ z as clearColumnsCellsFormat,
19
+ S as clearFilter,
20
20
  V as clearRowsCellsFormat,
21
21
  y as clearSelectedCellFormat,
22
- h as createFilter,
23
- z as deleteRowCol,
24
- G as deleteSelectedCellText,
25
- m as describeMatchedShortcut,
26
- P as executeStringFunction,
27
- U as formulaResponseUiSync,
28
- X as getFlowdata,
22
+ m as createFilter,
23
+ G as deleteRowCol,
24
+ P as deleteSelectedCellText,
25
+ h as describeMatchedShortcut,
26
+ U as executeStringFunction,
27
+ X as formulaResponseUiSync,
28
+ _ as getFlowdata,
29
29
  p as getRemoveDuplicatesErrorMessage,
30
30
  C as getRemoveDuplicatesPreview,
31
- _ as getSheetIndex,
31
+ j as getSheetIndex,
32
32
  u as handleCSVUpload,
33
33
  E as handleCopy,
34
34
  F as handleExportToCSV,
35
35
  g as handleExportToJSON,
36
36
  x as handleExportToXLSX,
37
- j as handleFreeze,
38
- B as handleHorizontalAlign,
39
- H as handleLink,
40
- O as handleMerge,
41
- R as handlePasteByClick,
42
- q as handleSort,
43
- J as handleTextSize,
44
- K as handleVerticalAlign,
37
+ B as handleFreeze,
38
+ H as handleHorizontalAlign,
39
+ O as handleLink,
40
+ q as handleMerge,
41
+ A as handlePasteByClick,
42
+ J as handleSort,
43
+ K as handleTextSize,
44
+ N as handleVerticalAlign,
45
45
  I as importSpreadsheetFile,
46
- N as insertRowCol,
47
- f as isBrowserZoomShortcut,
48
- w as isFormulaListShortcut,
49
- A as isOpenShortcutsModalShortcut,
50
- Y as jfrefreshgrid,
51
- Z as loadLocale,
52
- L as removeActiveImage,
53
- T as removeDuplicates,
54
- v as showImgChooser,
55
- Q as toolbarItemClickHandler,
56
- W as updateFormat,
57
- D as useEnsStatus,
58
- M as useXLSXImport
46
+ Y as insertRowCol,
47
+ R as isBrowserZoomShortcut,
48
+ f as isFormulaListShortcut,
49
+ L as isOpenShortcutsModalShortcut,
50
+ Z as jfrefreshgrid,
51
+ Q as loadLocale,
52
+ w as remapCommentAnchors,
53
+ T as removeActiveImage,
54
+ v as removeDuplicates,
55
+ b as showImgChooser,
56
+ W as toolbarItemClickHandler,
57
+ $ as updateFormat,
58
+ k as useEnsStatus,
59
+ D as useXLSXImport
59
60
  };
@@ -4,7 +4,7 @@ export { Canvas, defaultStyle } from './canvas';
4
4
  export { defaultContext, getFlowdata, ensureSheetIndex, initSheetIndex, updateContextWithSheetData, updateContextWithCanvas, } from './context';
5
5
  export type { Context } from './context';
6
6
  export { defaultSettings } from './settings';
7
- export type { Settings, Hooks, DateBaseLocale } from './settings';
7
+ export type { Settings, Hooks, DateBaseLocale, CommentAnchorMove, } from './settings';
8
8
  export { handleCopy, handleGlobalKeyDown, handlePaste, handlePasteByClick, fixPositionOnFrozenCells, handleCellAreaMouseDown, handleCellAreaDoubleClick, handleContextMenu, mouseRender, handleOverlayMouseMove, handleOverlayMouseUp, handleRowHeaderMouseDown, handleColumnHeaderMouseDown, handleColSizeHandleMouseDown, handleColSizeHandleDoubleClick, handleRowSizeHandleMouseDown, handleColFreezeHandleMouseDown, handleRowFreezeHandleMouseDown, describeMatchedShortcut, isBrowserZoomShortcut, isOpenShortcutsModalShortcut, isFormulaListShortcut, } from './events';
9
9
  export * from './locale';
10
10
  export { getBorderInfoComputeRange, getBorderInfoCompute, normalizedCellAttr, normalizedAttr, getCellValue, setCellValue, getRealCellValue, mergeBorder, cancelNormalSelected, updateCell, getRangetxt, getRangeByTxt, isValidRangeText, getInlineStringHTML, applyLinkToSelection, getHyperlinksFromInlineSegments, getUniformLinkFromWindowSelectionInEditor, getHyperlinkAtCaretInContentEditable, getStyleByCell, clearSelectedCellFormat, clearRowsCellsFormat, clearColumnsCellsFormat, clipboard, moveToEnd, getRangeRectsByCharacterOffset, getDateBaseLocale, getCanonicalDateEditFormat, getDateEditFormatForCell, isUsDateBaseLocale, normalizeDateBaseLocale, shouldPreserveDateFormatForEdit, setDateBaseLocale, update, is_date, valueShowEs, isTypedCurrencyDisplayFormat, isCurrencyLikeNumberFormat, buildFiatCurrencyFormat, quoteSsfLiteral, FormulaCache, groupValuesRefresh, execFunctionGroup, runFormulaEvalChunk, applyWorkerFormulaChunkResults, isFormulaEvalPending, FORMULA_ASYNC_CHUNK_SIZE, FORMULA_ASYNC_EVAL_THRESHOLD, FORMULA_WORKER_CHUNK_SIZE, FORMULA_WORKER_THRESHOLD, setCaretPosition, getrangeseleciton, getFormulaEditorOwner, rangeHightlightselected, handleFormulaInput, israngeseleciton, createRangeHightlight, maybeRecoverDirtyRangeSelection, getFormulaRangeIndexAtCaret, isCaretAtValidFormulaRangeInsertionPoint, isLegacyFormulaRangeMode, markRangeSelectionDirty, setFormulaEditorOwner, functionHTMLGenerate, suppressFormulaRangeSelectionForInitialEdit, ensureFormulaRangeToSheet, shouldPreserveFormulaEditOnSheetSwitch, activateSheetForNavigation, returnToFormulaOriginSheet, rangeSetValue, getFormulaRangeIndexForKeyboardSync, createFormulaRangeSelect, isFormulaReferenceInputMode, seedFormulaFuncSelectedRangeFromLastSelection, initFreeze, isInlineStringCell, getInlineStringNoStyle, rowLocation, rowLocationByIndex, colLocation, colLocationByIndex, insertRowCol, deleteRowCol, hideSelected, showSelected, isShowHidenCR, getFilterHiddenRowsUnionFromFilterMap, getFilterHiddenRowsUnion, ensureManualHiddenInitialized, rebuildRowHiddenUnion, scrollToHighlightCell, selectTitlesMap, selectTitlesRange, defaultLuckysheetSelectRanges, normalizeSelection, syncPrimaryCellActiveFromSelection, selectionIsExactlyOneMergeBlock, 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, mergeSelectionHasValues, handleSort, getRemoveDuplicatesPreview, removeDuplicates, getRemoveDuplicatesErrorMessage, handleFreeze, handleTextSize, handleSum, handleLink, captureLinkEditorOpenSnapshot, isHyperlinkCreationBlocked, toolbarItemClickHandler, toolbarItemSelectedFunc, handleScreenShot, insertImage, showImgChooser, drawArrow, setEditingComment, removeEditingComment, removeOverShowComment, newComment, editComment, deleteComment, showComments, showHideComment, showHideAllComments, onCommentBoxMoveStart, removeActiveImage, copyActiveImage, cutActiveImage, pasteImageItem, loadImageFromFile, getImageClipboard, getImageCutSourceId, cancelActiveImgItem, onImageMoveStart, onImageResizeStart, createDropCellRange, sortSelection, sortSheetBySelectedColumn, searchAll, searchNext, replace, replaceAll, replaceAllScoped, 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, clearFilterForColumn, toggleViewerFilter, createFilter, applySheetFilterState, getFilterColumnValues, getFilterColumnColors, orderbydatafiler, saveFilter, onCellsMoveStart, cfSplitRange, updateMoreCell, getRegStr, getDataArr, applyLocation, getOptionValue, getSelectRange, getDropdownList, setDropdownValue, confirmMessage, setConditionRules, CF_DATE_DEFAULT_FORMAT, parseCfDateConditionForUi, formatCfDatePresetSnapshot, parseDdMmYyyyToSerial, handleOverlayTouchStart, handleOverlayTouchEnd, MAX_ZOOM_RATIO, MIN_ZOOM_RATIO, jfrefreshgrid, sanitizeDuneUrl, insertDuneChart, onIframeMoveStart, onIframeResizeStart, onIframeMove, onIframeMoveEnd, onIframeResize, onIframeResizeEnd, setCellError, clearCellError, detectDateFormat, isdatatypemulti, diff, isdatetime, isRealNull, isRealNum, isNumericCellType, iscelldata, getcellrange, cancelFunctionrangeSelected, seletedHighlistByindex, spillSortResult, execfunction, insertUpdateFunctionGroup, remapFormulaReferencesByMap, refreshFormulasUsingDefinedNames, checkCF, getComputeMap, isValidDefinedNameIdentifier, getDefinedNameDisplayRange, findDefinedNameForSelection, findDefinedNameByName, resolveDefinedNameForFormula, addDefinedName, updateDefinedName, deleteDefinedName, selectDefinedName, openNamedRangesSidebar, scheduleDefinedNamesSync, shiftDefinedNamesOnInsert, shiftDefinedNamesOnDelete, removeDefinedNamesForSheet, cancelPaintModel, hideCRCount, getdatabyselection, } from './modules';
@@ -62,9 +62,13 @@ export declare function buildFiatCurrencyFormat(symbol: string, decimals?: numbe
62
62
  export declare function update(fmt: string, v: any): string;
63
63
  /** Max decimal places for toolbar +/- on General (Auto) without switching to a numeric `fa`. */
64
64
  export declare const MAX_GENERAL_AUTO_DP = 15;
65
+ /** Count decimal places currently shown for a General/Auto numeric cell. */
66
+ export declare function countGeneralDisplayDecimalPlaces(cell: Cell): number;
67
+ /** Effective decimal places for toolbar +/- (explicit `ct.dp` or inferred from display). */
68
+ export declare function getEffectiveGeneralDp(cell: Cell): number;
65
69
  /**
66
70
  * Recompute `m` for numeric cells with `fa === "General"`.
67
- * When `ct.dp` is set (1..MAX), uses fixed decimals like Sheets Auto + decimal buttons.
71
+ * When `ct.dp` is set (0..MAX), uses fixed decimals like Sheets Auto + decimal buttons.
68
72
  * Otherwise uses the usual `genarate` General display.
69
73
  */
70
74
  export declare function refreshGeneralNumericDisplay(cell: Cell): void;
@@ -94,6 +94,46 @@ export type Hooks = {
94
94
  afterShowGridLinesChange?: () => void;
95
95
  afterNameChanges?: () => void;
96
96
  afterStatusChanges?: () => void;
97
+ /**
98
+ * Fired after row/column drag-drop, cell-range move, or insert/delete
99
+ * so host apps can remap comment keys (`${sheetId}_${row}_${col}`).
100
+ */
101
+ afterCommentAnchorMove?: (move: CommentAnchorMove) => void;
102
+ };
103
+ export type CommentAnchorMove = {
104
+ type: 'row' | 'column';
105
+ sheetId: string;
106
+ /** Prefixes that identify this sheet in comment keys (id, order, index). */
107
+ sheetKeys?: string[];
108
+ /** old index → new index for every row/col on the sheet */
109
+ indexMap: Record<number, number>;
110
+ } | {
111
+ type: 'cells';
112
+ sheetId: string;
113
+ sheetKeys?: string[];
114
+ source: {
115
+ row: [number, number];
116
+ column: [number, number];
117
+ };
118
+ target: {
119
+ row: [number, number];
120
+ column: [number, number];
121
+ };
122
+ } | {
123
+ type: 'insert';
124
+ axis: 'row' | 'column';
125
+ sheetId: string;
126
+ sheetKeys?: string[];
127
+ index: number;
128
+ count: number;
129
+ direction: 'lefttop' | 'rightbottom';
130
+ } | {
131
+ type: 'delete';
132
+ axis: 'row' | 'column';
133
+ sheetId: string;
134
+ sheetKeys?: string[];
135
+ start: number;
136
+ end: number;
97
137
  };
98
138
  type CommentUIDragFn = (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
99
139
  export type Settings = {
@@ -0,0 +1,17 @@
1
+ import { CommentAnchorMove } from '../settings';
2
+
3
+ /**
4
+ * Build oldIndex → newIndex for a contiguous block move (row or column drag).
5
+ * `targetIndex` is the insertion index *after* the block has been removed,
6
+ * matching the splice used on the sheet data.
7
+ */
8
+ export declare function buildBlockMoveIndexMap(length: number, sourceStart: number, moveCount: number, targetIndex: number): Record<number, number>;
9
+ export declare function getSheetCommentKeyPrefixes(sheet: {
10
+ id?: string;
11
+ order?: number;
12
+ } | null | undefined, sheetIndex: number): string[];
13
+ export declare function notifyCommentAnchorMove(ctx: {
14
+ hooks?: {
15
+ afterCommentAnchorMove?: (move: CommentAnchorMove) => void;
16
+ };
17
+ }, move: CommentAnchorMove): void;