@fileverse-dev/dsheet 4.0.6 → 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/editor/types/comments.d.ts +11 -0
- package/dist/editor/types.d.ts +1 -1
- package/dist/editor/utils/apply-comment-markers.d.ts +3 -11
- package/dist/editor/utils/comment-anchors-ydoc.d.ts +32 -0
- package/dist/editor/utils/remap-comment-anchors.d.ts +26 -0
- package/dist/editor/utils/remap-comment-anchors.test.d.ts +1 -0
- package/dist/{executeStringFunction-CxsiamWG.js → executeStringFunction-BJ00H04h.js} +1144 -1101
- package/dist/formula.js +1 -1
- package/dist/{index-CQUhZB3J.js → index-CsYiH7pp.js} +14068 -13770
- package/dist/index.d.ts +2 -1
- package/dist/index.es.js +42 -41
- package/dist/sheet-engine/core/index.d.ts +1 -1
- package/dist/sheet-engine/core/settings.d.ts +40 -0
- package/dist/sheet-engine/core/utils/comment-anchor-move.d.ts +17 -0
- package/dist/{use-xlsx-import-impl-DNTnmzDN.js → use-xlsx-import-impl-OXKPbMbG.js} +148 -148
- package/dist/{xlsx-defined-names-BHxDk83p.js → xlsx-defined-names-Klp22jvp.js} +2 -2
- package/dist/{xlsx-export-impl-r3bDoVjv.js → xlsx-export-impl-Y8hmWj_I.js} +4 -4
- package/dist/{xlsx-hyperlink-inline-B5IR_SOR.js → xlsx-hyperlink-inline-DNeesFv6.js} +2 -2
- package/package.json +5 -3
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
+
import { CommentAnchorMove } from '../../sheet-engine/core/settings';
|
|
2
3
|
|
|
4
|
+
export type { CommentAnchorMove };
|
|
3
5
|
export interface CommentThread {
|
|
4
6
|
id: string;
|
|
5
7
|
key: string;
|
|
@@ -12,6 +14,8 @@ export interface CommentThread {
|
|
|
12
14
|
replies: CommentReply[];
|
|
13
15
|
isResolved?: boolean;
|
|
14
16
|
isDeleted?: boolean;
|
|
17
|
+
/** IPFS/indexer hash — stable across local `comment-*` ids and on-chain uuids. */
|
|
18
|
+
contentHash?: string;
|
|
15
19
|
}
|
|
16
20
|
export interface CommentReply {
|
|
17
21
|
id: string;
|
|
@@ -41,6 +45,11 @@ export interface CommentsConfig {
|
|
|
41
45
|
commentsData: Record<string, CommentThread>;
|
|
42
46
|
onSendComment: (key: string, textareaId: string) => void;
|
|
43
47
|
onCommentAction: (action: CommentActionParams) => void;
|
|
48
|
+
/**
|
|
49
|
+
* Called after row/column drag-drop or a cell-range move so the host can
|
|
50
|
+
* remap comment keys. Use `remapCommentAnchors` from the package.
|
|
51
|
+
*/
|
|
52
|
+
onCellPositionsChanged?: (move: CommentAnchorMove) => void;
|
|
44
53
|
userName?: string;
|
|
45
54
|
ownerAddress?: string;
|
|
46
55
|
currentUserAddress?: string;
|
|
@@ -118,6 +127,8 @@ export interface CommentCellUIProps {
|
|
|
118
127
|
dragHandler: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
|
|
119
128
|
isHover?: boolean;
|
|
120
129
|
disabled?: boolean;
|
|
130
|
+
isAuthenticated?: boolean;
|
|
131
|
+
unauthenticatedFallback?: React.ReactNode;
|
|
121
132
|
}
|
|
122
133
|
export interface CommentsContentProps {
|
|
123
134
|
sheetEditorRef: React.RefObject<SheetEditorRef>;
|
package/dist/editor/types.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ import { DSheetContentSnapshot } from '../persistence';
|
|
|
10
10
|
|
|
11
11
|
import * as Y from 'yjs';
|
|
12
12
|
export type { ThemeKey } from '../sheet-engine/core/theme';
|
|
13
|
-
export type { CommentThread, CommentReply, CommentActionParams, CommentsConfig, } from './types/comments';
|
|
13
|
+
export type { CommentThread, CommentReply, CommentActionParams, CommentsConfig, CommentAnchorMove, } from './types/comments';
|
|
14
14
|
export { CommentAction } from './types/comments';
|
|
15
15
|
export interface SheetUpdateData {
|
|
16
16
|
data: Sheet[];
|
|
@@ -4,17 +4,9 @@ type CommentData = object | null | undefined;
|
|
|
4
4
|
* the consumer-provided `commentData`.
|
|
5
5
|
*
|
|
6
6
|
* `ps` is a per-client, permission-gated *view overlay* — it is NOT persisted in
|
|
7
|
-
* ydoc
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* gated on the local `allowComments` permission, it must never be written back
|
|
11
|
-
* to shared ydoc state — doing so would let one viewer wipe markers for all.
|
|
12
|
-
*
|
|
13
|
-
* Handles both shapes:
|
|
14
|
-
* - Dense `sheet.data` (the live active sheet in `luckysheetfile`).
|
|
15
|
-
* - Sparse `sheet.celldata` (plain snapshots from `ySheetArrayToPlain`, and
|
|
16
|
-
* inactive sheets). `initSheetData()` converts celldata → data on activation,
|
|
17
|
-
* so `ps` set on celldata carries through.
|
|
7
|
+
* ydoc (`shouldPersistCelldataCell` ignores marker-only cells). Empty cells are
|
|
8
|
+
* `null`, so a tiny `{ ps }` object is created in the live view only so the
|
|
9
|
+
* triangle can render. Row/column drag still owns real cell data.
|
|
18
10
|
*
|
|
19
11
|
* Mutates in place and returns the same array.
|
|
20
12
|
*/
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as Y from 'yjs';
|
|
2
|
+
/** Sibling share key on the same Y.Doc as the sheet array. */
|
|
3
|
+
export declare function getCommentAnchorsMapKey(dsheetId: string): string;
|
|
4
|
+
export declare function getCommentAnchorsYMap(ydoc: Y.Doc, dsheetId: string): Y.Map<string>;
|
|
5
|
+
export declare function readCommentAnchorsFromYdoc(ydoc: Y.Doc | null | undefined, dsheetId: string): Record<string, string>;
|
|
6
|
+
type CommentAnchorRecord = {
|
|
7
|
+
id?: string;
|
|
8
|
+
key?: string;
|
|
9
|
+
contentHash?: string;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Re-key comments by identity first (id, then contentHash), then the comment's
|
|
13
|
+
* own current cell-key. Stale cell-key aliases that now belong to another
|
|
14
|
+
* thread must not steal or duplicate it.
|
|
15
|
+
*/
|
|
16
|
+
export declare function applyCommentAnchorMap<T extends CommentAnchorRecord>(commentsData: Record<string, T> | null | undefined, anchors: Record<string, string>): Record<string, T>;
|
|
17
|
+
export declare function applyYdocCommentAnchors<T extends CommentAnchorRecord>(commentsData: Record<string, T> | object | null | undefined, ydoc: Y.Doc | null | undefined, dsheetId: string): Record<string, T>;
|
|
18
|
+
/**
|
|
19
|
+
* Persist current commentId/contentHash → cell-key into ydoc so viewers/publish
|
|
20
|
+
* see the remapped positions. No-ops when the map already matches.
|
|
21
|
+
*/
|
|
22
|
+
export declare function writeCommentAnchorsToYdoc({ ydoc, dsheetId, commentsData, handleContentPortal, skipUnmapped, keyMoves, }: {
|
|
23
|
+
ydoc: Y.Doc | null | undefined;
|
|
24
|
+
dsheetId: string;
|
|
25
|
+
commentsData: Record<string, CommentAnchorRecord> | null | undefined;
|
|
26
|
+
handleContentPortal?: () => void;
|
|
27
|
+
/** When the map already has entries, skip comments that are not in it yet. */
|
|
28
|
+
skipUnmapped?: boolean;
|
|
29
|
+
/** old cell-key → new cell-key so indexer keys still resolve after remap. */
|
|
30
|
+
keyMoves?: Record<string, string>;
|
|
31
|
+
}): void;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { CommentAnchorMove } from '../../sheet-engine/core/settings';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* old cell-key → new cell-key, matched by comment id. Used when writing
|
|
5
|
+
* ydoc aliases so indexer keys still resolve after a remap.
|
|
6
|
+
*/
|
|
7
|
+
export declare function commentKeyMovesById<T extends {
|
|
8
|
+
id?: string;
|
|
9
|
+
key?: string;
|
|
10
|
+
}>(before: Record<string, T>, after: Record<string, T>): Record<string, string>;
|
|
11
|
+
/**
|
|
12
|
+
* Remap in-memory comment keys after a row/column drag, cell-range move,
|
|
13
|
+
* or insert/delete of rows/columns.
|
|
14
|
+
*
|
|
15
|
+
* - Row/column drag: apply the full permutation `indexMap` (no collisions).
|
|
16
|
+
* - Cells: comments in the source rectangle follow the offset; comments that
|
|
17
|
+
* only lived in the destination are detached to `WITHOUT_CELL_<id>` so they
|
|
18
|
+
* remain in the sidebar instead of colliding with the incoming thread.
|
|
19
|
+
* - Insert: comments at/after the insertion point shift by `count`.
|
|
20
|
+
* - Delete: comments on removed rows/cols are detached; later ones shift up/left.
|
|
21
|
+
*/
|
|
22
|
+
export declare function remapCommentAnchors<T extends {
|
|
23
|
+
key?: string;
|
|
24
|
+
id?: string;
|
|
25
|
+
}>(commentsData: Record<string, T>, move: CommentAnchorMove): Record<string, T>;
|
|
26
|
+
export type { CommentAnchorMove };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|