@fileverse-dev/dsheet 2.1.1 → 2.1.2-dropIn-2
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/components/comments/comment-actions-dropdown.d.ts +19 -0
- package/dist/editor/components/comments/comment-cell-popup.d.ts +4 -0
- package/dist/editor/components/comments/comment-input.d.ts +4 -0
- package/dist/editor/components/comments/comment-item.d.ts +4 -0
- package/dist/editor/components/comments/comment-sidebar-empty.d.ts +4 -0
- package/dist/editor/components/comments/comment-sidebar.d.ts +4 -0
- package/dist/editor/components/comments/ens/ens-cache.d.ts +10 -0
- package/dist/editor/components/comments/ens/use-ens-status.d.ts +10 -0
- package/dist/editor/components/comments/use-comment-cell-popup.d.ts +12 -0
- package/dist/editor/components/comments/use-comment-permissions.d.ts +15 -0
- package/dist/editor/components/editor-workbook.d.ts +4 -9
- package/dist/editor/components/sidebar/editor-right-sidebar.d.ts +20 -0
- package/dist/editor/components/sidebar/right-sidebar.d.ts +14 -0
- package/dist/editor/components/sidebar/sidebar-context.d.ts +17 -0
- package/dist/editor/components/sidebar/use-right-panels.d.ts +12 -0
- package/dist/editor/components/sidebars/conditional-format.d.ts +2 -0
- package/dist/editor/components/sidebars/data-verification.d.ts +2 -0
- package/dist/editor/components/sidebars/function/function-categories-logic.d.ts +11 -0
- package/dist/editor/components/sidebars/function/function-categories.d.ts +6 -0
- package/dist/editor/components/sidebars/function/function-metadata.d.ts +7 -0
- package/dist/editor/components/sidebars/function/functionList.d.ts +8 -0
- package/dist/editor/components/sidebars/function/types.d.ts +24 -0
- package/dist/editor/components/sidebars/function/use-functions.d.ts +20 -0
- package/dist/editor/components/sidebars/function-content.d.ts +8 -0
- package/dist/editor/components/sidebars/template-ui.d.ts +22 -0
- package/dist/editor/components/sidebars/templates.d.ts +9 -0
- package/dist/editor/contexts/editor-context.d.ts +2 -2
- package/dist/editor/dsheet-editor.d.ts +1 -1
- package/dist/editor/types/comments.d.ts +131 -0
- package/dist/editor/types.d.ts +19 -5
- package/dist/editor/utils/api-keys-local-storage.d.ts +17 -0
- package/dist/editor/utils/cell-comment-marker.d.ts +29 -0
- package/dist/editor/utils/comment-key-utils.d.ts +7 -0
- package/dist/editor/utils/sheet-editor-safe.d.ts +26 -0
- package/dist/{executeStringFunction-tdvZ0KTi.js → executeStringFunction-CGbxAbbw.js} +436 -423
- package/dist/formula.js +1 -1
- package/dist/{index-D_IxoHMJ.js → index-CDtU1CMG.js} +21867 -19311
- package/dist/index.d.ts +8 -1
- package/dist/index.es.js +55 -48
- package/dist/sheet-engine/core/events/keyboard-shortcut-utils.d.ts +2 -0
- package/dist/sheet-engine/core/index.d.ts +2 -1
- package/dist/sheet-engine/core/locale/en.d.ts +13 -0
- package/dist/sheet-engine/core/modules/index.d.ts +2 -0
- package/dist/sheet-engine/core/modules/removeDuplicates.d.ts +29 -0
- package/dist/sheet-engine/react/components/RemoveDuplicates/index.d.ts +12 -0
- package/dist/style.css +1 -1
- package/dist/{use-xlsx-import-impl-AI2QDZt1.js → use-xlsx-import-impl-BLkzBn-k.js} +2 -2
- package/dist/{xlsx-export-impl-Buly1jC6.js → xlsx-export-impl-DxWsBfuJ.js} +2 -2
- package/package.json +3 -2
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { CommentThread, CommentReply, CommentActionParams } from '../../types/comments';
|
|
3
|
+
|
|
4
|
+
interface CommentActionsDropdownProps {
|
|
5
|
+
comment: CommentThread | CommentReply;
|
|
6
|
+
onAction: (action: CommentActionParams) => void;
|
|
7
|
+
isReply?: boolean;
|
|
8
|
+
parentCommentId?: string;
|
|
9
|
+
ownerAddress?: string;
|
|
10
|
+
currentUserName?: string;
|
|
11
|
+
currentUserAddress?: string;
|
|
12
|
+
isOwner?: boolean;
|
|
13
|
+
dsheetId?: string;
|
|
14
|
+
commentKey?: string;
|
|
15
|
+
row: number;
|
|
16
|
+
col: number;
|
|
17
|
+
}
|
|
18
|
+
export declare const CommentActionsDropdown: React.FC<CommentActionsDropdownProps>;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface EnsStatus {
|
|
2
|
+
name: string;
|
|
3
|
+
isEns: boolean;
|
|
4
|
+
}
|
|
5
|
+
/** Push the host-provided RPC URL into the singleton (called from EditorContent). */
|
|
6
|
+
export declare const setEnsResolutionUrl: (url: string | undefined) => void;
|
|
7
|
+
export declare const subscribeEns: (cb: () => void) => () => boolean;
|
|
8
|
+
export declare const getCachedEns: (username: string) => EnsStatus | undefined;
|
|
9
|
+
/** Resolve `username` to an EnsStatus, deduped + cached. No-op if already cached/in-flight. */
|
|
10
|
+
export declare const resolveEns: (username: string) => Promise<void>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { EnsStatus } from './ens-cache';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Resolve a comment username to a display name + ENS flag.
|
|
5
|
+
* - Empty → "Anonymous".
|
|
6
|
+
* - Cache hit → returned immediately.
|
|
7
|
+
* - Miss → triggers a deduped resolve; re-renders when it lands.
|
|
8
|
+
* - Plain names short-circuit inside getAddressName (no network).
|
|
9
|
+
*/
|
|
10
|
+
export declare const useEnsStatus: (username?: string) => EnsStatus;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const useCommentCell: ({ onSendComment, cellKey, }: {
|
|
2
|
+
onSendComment: (commentKey: string, textareaId: string) => void;
|
|
3
|
+
cellKey: string;
|
|
4
|
+
}) => {
|
|
5
|
+
cellKey: string;
|
|
6
|
+
textareaId: string;
|
|
7
|
+
handleSend: (textareaId: string) => void;
|
|
8
|
+
handleKeyDown: (e: React.KeyboardEvent) => void;
|
|
9
|
+
handleDoubleClick: (e: React.MouseEvent) => void;
|
|
10
|
+
handleScroll: (e: React.UIEvent) => void;
|
|
11
|
+
handler: (e: WheelEvent) => void;
|
|
12
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const useCommentPermissions: (ownerAddress?: string, currentUserName?: string, currentUserAddress?: string, isOwner?: boolean) => {
|
|
2
|
+
canDeleteComment: (item: {
|
|
3
|
+
username: string;
|
|
4
|
+
}) => boolean;
|
|
5
|
+
canResolveComment: (item: {
|
|
6
|
+
username: string;
|
|
7
|
+
}) => boolean;
|
|
8
|
+
canDeleteReply: (item: {
|
|
9
|
+
username: string;
|
|
10
|
+
}) => boolean;
|
|
11
|
+
canResolveReply: (item: {
|
|
12
|
+
username: string;
|
|
13
|
+
}) => boolean;
|
|
14
|
+
isOwner: boolean;
|
|
15
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { default as React
|
|
2
|
-
import { Workbook } from '../../sheet-engine/react';
|
|
1
|
+
import { default as React } from 'react';
|
|
3
2
|
import { SmartContractQueryHandler } from '../utils/after-update-cell';
|
|
4
3
|
import { OnboardingHandlerType, DataBlockApiKeyHandlerType } from '../types';
|
|
4
|
+
import { CommentsConfig } from '../types/comments';
|
|
5
5
|
|
|
6
6
|
type OnboardingHandler = OnboardingHandlerType;
|
|
7
7
|
type DataBlockApiKeyHandler = DataBlockApiKeyHandlerType;
|
|
@@ -12,15 +12,13 @@ interface EditorWorkbookProps {
|
|
|
12
12
|
setInputFetchURLDataBlock?: React.Dispatch<React.SetStateAction<string>>;
|
|
13
13
|
isReadOnly?: boolean;
|
|
14
14
|
allowSheetDownload?: boolean;
|
|
15
|
-
allowComments?: boolean;
|
|
16
15
|
toggleTemplateSidebar?: () => void;
|
|
17
16
|
onboardingComplete?: boolean;
|
|
18
17
|
onboardingCompleteLocalStorageKey?: string;
|
|
19
18
|
onboardingHandler?: OnboardingHandler;
|
|
20
19
|
dataBlockApiKeyHandler?: DataBlockApiKeyHandler;
|
|
21
20
|
exportDropdownOpen?: boolean;
|
|
22
|
-
|
|
23
|
-
getCommentCellUI?: ComponentProps<typeof Workbook>['getCommentCellUI'];
|
|
21
|
+
commentsConfig?: CommentsConfig;
|
|
24
22
|
setExportDropdownOpen?: React.Dispatch<React.SetStateAction<boolean>>;
|
|
25
23
|
dsheetId: string;
|
|
26
24
|
storeApiKey?: (apiKeyName: string) => void;
|
|
@@ -29,8 +27,5 @@ interface EditorWorkbookProps {
|
|
|
29
27
|
onSheetCountChange?: (sheetCount: number) => void;
|
|
30
28
|
handleSmartContractQuery?: SmartContractQueryHandler;
|
|
31
29
|
}
|
|
32
|
-
|
|
33
|
-
* EditorWorkbook component handles rendering the Fortune Workbook with proper configuration
|
|
34
|
-
*/
|
|
35
|
-
export declare const EditorWorkbook: React.FC<EditorWorkbookProps>;
|
|
30
|
+
export declare const EditorWorkbook: React.NamedExoticComponent<EditorWorkbookProps>;
|
|
36
31
|
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
export interface ActivePanelConfig {
|
|
4
|
+
id: string;
|
|
5
|
+
width: string;
|
|
6
|
+
header: {
|
|
7
|
+
title: string;
|
|
8
|
+
subtitle?: string;
|
|
9
|
+
};
|
|
10
|
+
content: ReactNode;
|
|
11
|
+
}
|
|
12
|
+
interface EditorRightSidebarProps {
|
|
13
|
+
isOpen: boolean;
|
|
14
|
+
activePanelConfig: ActivePanelConfig | null;
|
|
15
|
+
onClose: () => void;
|
|
16
|
+
/** Read/preview mode hides the toolbar, so the sidebar starts higher. */
|
|
17
|
+
isReadOnly?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export declare const EditorRightSidebar: ({ isOpen, activePanelConfig, onClose, isReadOnly, }: EditorRightSidebarProps) => import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
export declare function RightSidebar({ width, className, children, isOpen, top, height, }: Readonly<{
|
|
4
|
+
width?: string;
|
|
5
|
+
className?: string;
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
isOpen?: boolean;
|
|
8
|
+
top?: string;
|
|
9
|
+
height?: string;
|
|
10
|
+
}>): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare function RightSidebarHeader({ className, children, }: Readonly<{
|
|
12
|
+
className?: string;
|
|
13
|
+
children: ReactNode;
|
|
14
|
+
}>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { PanelId } from './use-right-panels';
|
|
3
|
+
|
|
4
|
+
interface SidebarContextType {
|
|
5
|
+
activePanel: PanelId | null;
|
|
6
|
+
isOpen: boolean;
|
|
7
|
+
openPanel: (panel: PanelId) => void;
|
|
8
|
+
closePanel: () => void;
|
|
9
|
+
togglePanel: (panel: PanelId) => void;
|
|
10
|
+
isActive: (panel: PanelId) => boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare function SidebarProvider({ children, isReadMode, }: Readonly<{
|
|
13
|
+
children: ReactNode;
|
|
14
|
+
isReadMode?: boolean;
|
|
15
|
+
}>): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export declare function useSidebar(): SidebarContextType;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type BuiltInPanelType = 'templates' | 'comments' | 'functions' | 'data-verification' | 'conditional-format';
|
|
2
|
+
export type PanelId = BuiltInPanelType | string;
|
|
3
|
+
interface UseRightPanelsReturn {
|
|
4
|
+
activePanel: PanelId | null;
|
|
5
|
+
isOpen: boolean;
|
|
6
|
+
openPanel: (panel: PanelId) => void;
|
|
7
|
+
closePanel: () => void;
|
|
8
|
+
togglePanel: (panel: PanelId) => void;
|
|
9
|
+
isActive: (panel: PanelId) => boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare const useRightPanels: (isReadMode?: boolean) => UseRightPanelsReturn;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { SpreadsheetFunction } from './types';
|
|
2
|
+
|
|
3
|
+
export declare const PARSER_FUNCTIONS: Set<string>;
|
|
4
|
+
export declare const TYPE_TO_CATEGORY_KEY: Record<number, string>;
|
|
5
|
+
export declare const CATEGORY_ORDER: readonly ["All", "Datablock", "Array", "Database", "Date", "Engineering", "Financial", "Info", "Logical", "Lookup", "Math", "Operator", "Parser", "Statistical", "Text", "Other"];
|
|
6
|
+
export type CategoryKey = (typeof CATEGORY_ORDER)[number];
|
|
7
|
+
export declare function getFunctionCategoryKey(fnName: string, typeId: number): CategoryKey;
|
|
8
|
+
export declare function groupFunctionsByCategory(functionlist: SpreadsheetFunction[]): {
|
|
9
|
+
categories: ("Text" | "Date" | "Other" | "Logical" | "All" | "Array" | "Database" | "Engineering" | "Datablock" | "Financial" | "Lookup" | "Math" | "Operator" | "Parser" | "Statistical" | "Info")[];
|
|
10
|
+
byCategory: Map<"Text" | "Date" | "Other" | "Logical" | "All" | "Array" | "Database" | "Engineering" | "Datablock" | "Financial" | "Lookup" | "Math" | "Operator" | "Parser" | "Statistical" | "Info", SpreadsheetFunction[]>;
|
|
11
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
declare const FunctionCategories: ({ onCategorySelection, categories, categoryName, }: {
|
|
2
|
+
onCategorySelection: (value: string) => void;
|
|
3
|
+
categoryName: string;
|
|
4
|
+
categories: string[];
|
|
5
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export default FunctionCategories;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SpreadsheetFunction } from './types';
|
|
2
|
+
|
|
3
|
+
declare const FunctionList: ({ list, onFunctionSelection, selectedFunction, }: {
|
|
4
|
+
list: SpreadsheetFunction[];
|
|
5
|
+
onFunctionSelection: (data: SpreadsheetFunction, functionIndex: number) => void;
|
|
6
|
+
selectedFunction: SpreadsheetFunction | null;
|
|
7
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export default FunctionList;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export type FunctionParam = {
|
|
2
|
+
name: string;
|
|
3
|
+
detail: string;
|
|
4
|
+
example: string;
|
|
5
|
+
require: string;
|
|
6
|
+
repeat: string;
|
|
7
|
+
type: string;
|
|
8
|
+
};
|
|
9
|
+
export type SpreadsheetFunction = {
|
|
10
|
+
API_KEY: string;
|
|
11
|
+
LOGO: string;
|
|
12
|
+
BRAND_COLOR: string;
|
|
13
|
+
n: string;
|
|
14
|
+
t: any;
|
|
15
|
+
d: string;
|
|
16
|
+
a: string;
|
|
17
|
+
m?: number[];
|
|
18
|
+
p: FunctionParam[];
|
|
19
|
+
examples: {
|
|
20
|
+
title: string;
|
|
21
|
+
argumentString: string;
|
|
22
|
+
description: string;
|
|
23
|
+
}[];
|
|
24
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { WorkbookInstance } from '../../../../sheet-engine/react';
|
|
2
|
+
import { default as React } from 'react';
|
|
3
|
+
import { SpreadsheetFunction } from './types';
|
|
4
|
+
|
|
5
|
+
declare const useFunctions: (sheetEditorRef: React.RefObject<WorkbookInstance>, shouldHandleSuggestionFromCell: number) => {
|
|
6
|
+
filteredFunctionList: SpreadsheetFunction[];
|
|
7
|
+
functionIndex: number;
|
|
8
|
+
setFunctionIndex: React.Dispatch<React.SetStateAction<number>>;
|
|
9
|
+
setSearchText: React.Dispatch<React.SetStateAction<string>>;
|
|
10
|
+
selectedFunction: SpreadsheetFunction | null;
|
|
11
|
+
groupedFunctions: {
|
|
12
|
+
categories: ("Text" | "Date" | "Other" | "Logical" | "All" | "Array" | "Database" | "Engineering" | "Datablock" | "Financial" | "Lookup" | "Math" | "Operator" | "Parser" | "Statistical" | "Info")[];
|
|
13
|
+
byCategory: Map<"Text" | "Date" | "Other" | "Logical" | "All" | "Array" | "Database" | "Engineering" | "Datablock" | "Financial" | "Lookup" | "Math" | "Operator" | "Parser" | "Statistical" | "Info", SpreadsheetFunction[]>;
|
|
14
|
+
};
|
|
15
|
+
setSelectedCategory: React.Dispatch<React.SetStateAction<"Text" | "Date" | "Other" | "Logical" | "All" | "Array" | "Database" | "Engineering" | "Datablock" | "Financial" | "Lookup" | "Math" | "Operator" | "Parser" | "Statistical" | "Info">>;
|
|
16
|
+
setSelectedFunction: React.Dispatch<React.SetStateAction<SpreadsheetFunction | null>>;
|
|
17
|
+
searchText: string;
|
|
18
|
+
selectedCategoryName: "Text" | "Date" | "Other" | "Logical" | "All" | "Array" | "Database" | "Engineering" | "Datablock" | "Financial" | "Lookup" | "Math" | "Operator" | "Parser" | "Statistical" | "Info";
|
|
19
|
+
};
|
|
20
|
+
export default useFunctions;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { WorkbookInstance } from '../../../sheet-engine/react';
|
|
3
|
+
|
|
4
|
+
declare const FunctionContent: ({ sheetEditorRef, shouldHandleSuggestionFromCell, }: {
|
|
5
|
+
sheetEditorRef: React.RefObject<WorkbookInstance>;
|
|
6
|
+
shouldHandleSuggestionFromCell: number;
|
|
7
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export default FunctionContent;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface Template {
|
|
2
|
+
slug: string;
|
|
3
|
+
title: string;
|
|
4
|
+
description: string;
|
|
5
|
+
thumbnail: string;
|
|
6
|
+
fullImage: string;
|
|
7
|
+
category?: string;
|
|
8
|
+
isProTemplate: boolean;
|
|
9
|
+
techStack: {
|
|
10
|
+
name: string;
|
|
11
|
+
image: string;
|
|
12
|
+
}[];
|
|
13
|
+
}
|
|
14
|
+
export declare const TemplateCard: ({ template, onMouseEnter, onMouseLeave, onSelect, }: {
|
|
15
|
+
template: Template;
|
|
16
|
+
onMouseEnter?: () => void;
|
|
17
|
+
onMouseLeave?: () => void;
|
|
18
|
+
onSelect: () => void;
|
|
19
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export declare const TemplatePreview: ({ template }: {
|
|
21
|
+
template: Template;
|
|
22
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { Template } from './template-ui';
|
|
3
|
+
|
|
4
|
+
interface TemplatesProps {
|
|
5
|
+
setSelectedTemplate: (template: string) => void;
|
|
6
|
+
setHoveredTemplate: React.Dispatch<React.SetStateAction<Template | null>>;
|
|
7
|
+
}
|
|
8
|
+
export declare const Templates: ({ setSelectedTemplate, setHoveredTemplate, }: TemplatesProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -2,6 +2,7 @@ import { default as React } from 'react';
|
|
|
2
2
|
import { LiveQueryData, Sheet, WorkbookInstance } from '../../sheet-engine/react';
|
|
3
3
|
import { IndexeddbPersistence } from 'y-indexeddb';
|
|
4
4
|
import { DataBlockApiKeyHandlerType, SheetUpdateData } from '../types';
|
|
5
|
+
import { CommentsConfig } from '../types/comments';
|
|
5
6
|
import { CollaborationProps, CollabState, CollabUser } from '../../sync-local/types';
|
|
6
7
|
import { Awareness } from 'y-protocols/awareness';
|
|
7
8
|
|
|
@@ -50,7 +51,6 @@ export interface EditorContextType {
|
|
|
50
51
|
handleLiveQuery: (subsheetIndex: number, data: LiveQueryData) => void;
|
|
51
52
|
}
|
|
52
53
|
interface EditorProviderProps {
|
|
53
|
-
allowComments?: boolean;
|
|
54
54
|
setSelectedTemplate?: React.Dispatch<React.SetStateAction<string>>;
|
|
55
55
|
setShowSmartContractModal?: React.Dispatch<React.SetStateAction<boolean>>;
|
|
56
56
|
getDocumentTitle?: (dsheetId: string) => Promise<string>;
|
|
@@ -65,7 +65,7 @@ interface EditorProviderProps {
|
|
|
65
65
|
onChange?: (data: SheetUpdateData, encodedUpdate?: string) => void;
|
|
66
66
|
collaboration?: CollaborationProps;
|
|
67
67
|
externalEditorRef?: React.MutableRefObject<WorkbookInstance | null>;
|
|
68
|
-
|
|
68
|
+
commentsConfig?: CommentsConfig;
|
|
69
69
|
editorStateRef?: React.MutableRefObject<{
|
|
70
70
|
refreshIndexedDB: () => Promise<void>;
|
|
71
71
|
terminateSession?: () => void;
|
|
@@ -7,5 +7,5 @@ import { DsheetProps } from './types';
|
|
|
7
7
|
* @param props - Component properties
|
|
8
8
|
* @returns The SpreadsheetEditor component
|
|
9
9
|
*/
|
|
10
|
-
declare const SpreadsheetEditor: ({ isReadOnly, allowSheetDownload,
|
|
10
|
+
declare const SpreadsheetEditor: ({ isReadOnly, allowSheetDownload, renderNavbar, enableIndexeddbSync, dsheetId, portalContent, onChange, username, selectedTemplate, toggleTemplateSidebar, isTemplateOpen, onboardingComplete, onboardingCompleteLocalStorageKey, onboardingHandler, commentsConfig, dataBlockApiKeyHandler, setFetchingURLData, setShowFetchURLModal, setInputFetchURLDataBlock, sheetEditorRef: externalSheetEditorRef, storeApiKey, onDuneChartEmbed, onSheetCountChange, onDataBlockApiResponse, isAuthorized, getDocumentTitle, updateDocumentTitle, setShowSmartContractModal, editorStateRef, handleSmartContractQuery, setSelectedTemplate, isNewSheet, liveQueryRefreshRate, enableLiveQuery, collaboration, customPanels, }: DsheetProps) => JSX.Element;
|
|
11
11
|
export default SpreadsheetEditor;
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
|
|
3
|
+
export interface CommentThread {
|
|
4
|
+
id: string;
|
|
5
|
+
key: string;
|
|
6
|
+
dsheetId: string;
|
|
7
|
+
username: string;
|
|
8
|
+
content: string;
|
|
9
|
+
createdAt: string;
|
|
10
|
+
commentIndex: number;
|
|
11
|
+
cellContent?: string;
|
|
12
|
+
replies: CommentReply[];
|
|
13
|
+
isResolved?: boolean;
|
|
14
|
+
isDeleted?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export interface CommentReply {
|
|
17
|
+
id: string;
|
|
18
|
+
username: string;
|
|
19
|
+
content: string;
|
|
20
|
+
createdAt: string;
|
|
21
|
+
commentIndex: number;
|
|
22
|
+
isResolved?: boolean;
|
|
23
|
+
isDeleted?: boolean;
|
|
24
|
+
}
|
|
25
|
+
export declare enum CommentAction {
|
|
26
|
+
RESOLVE = "resolve",
|
|
27
|
+
UNRESOLVE = "unresolve",
|
|
28
|
+
DELETE = "delete"
|
|
29
|
+
}
|
|
30
|
+
export interface CommentActionParams {
|
|
31
|
+
action: CommentAction;
|
|
32
|
+
commentId: string;
|
|
33
|
+
dsheetId: string;
|
|
34
|
+
commentKey: string;
|
|
35
|
+
isReply?: boolean;
|
|
36
|
+
parentCommentId?: string;
|
|
37
|
+
row: number;
|
|
38
|
+
col: number;
|
|
39
|
+
}
|
|
40
|
+
export interface CommentsConfig {
|
|
41
|
+
commentsData: Record<string, CommentThread>;
|
|
42
|
+
onSendComment: (key: string, textareaId: string) => void;
|
|
43
|
+
onCommentAction: (action: CommentActionParams) => void;
|
|
44
|
+
userName?: string;
|
|
45
|
+
ownerAddress?: string;
|
|
46
|
+
currentUserAddress?: string;
|
|
47
|
+
isOwner?: boolean;
|
|
48
|
+
isAuthenticated?: boolean;
|
|
49
|
+
unauthenticatedFallback?: React.ReactNode;
|
|
50
|
+
ensResolutionUrl?: string;
|
|
51
|
+
disabled?: boolean;
|
|
52
|
+
}
|
|
53
|
+
export interface CellPosition {
|
|
54
|
+
row: number;
|
|
55
|
+
col: number;
|
|
56
|
+
sheetId?: string;
|
|
57
|
+
}
|
|
58
|
+
export interface SheetEditorRef {
|
|
59
|
+
scroll: (o: {
|
|
60
|
+
scrollLeft?: number;
|
|
61
|
+
scrollTop?: number;
|
|
62
|
+
targetRow?: number;
|
|
63
|
+
targetColumn?: number;
|
|
64
|
+
}) => void;
|
|
65
|
+
setSelection: (s: Array<{
|
|
66
|
+
row: number[];
|
|
67
|
+
column: number[];
|
|
68
|
+
}>) => void;
|
|
69
|
+
}
|
|
70
|
+
export interface CommentInputProps {
|
|
71
|
+
id: string;
|
|
72
|
+
onSend: (textareaId: string) => void;
|
|
73
|
+
placeholder?: string;
|
|
74
|
+
autoFocus?: boolean;
|
|
75
|
+
className?: string;
|
|
76
|
+
backgroundColor?: string;
|
|
77
|
+
inCellComment?: boolean;
|
|
78
|
+
cancelComment?: () => void;
|
|
79
|
+
onBlur?: () => void;
|
|
80
|
+
isStaticButton?: boolean;
|
|
81
|
+
removeCancelButton?: boolean;
|
|
82
|
+
focusTrap?: boolean;
|
|
83
|
+
disabled?: boolean;
|
|
84
|
+
}
|
|
85
|
+
export interface CommentItemProps {
|
|
86
|
+
comment: CommentThread;
|
|
87
|
+
showAvatar?: boolean;
|
|
88
|
+
avatarSize?: 'sm' | 'md' | 'lg';
|
|
89
|
+
className?: string;
|
|
90
|
+
isHovered?: boolean;
|
|
91
|
+
sheetName?: string;
|
|
92
|
+
cellReference?: string;
|
|
93
|
+
onAction?: (a: CommentActionParams) => void;
|
|
94
|
+
ownerAddress?: string;
|
|
95
|
+
currentUserAddress?: string;
|
|
96
|
+
isOwner?: boolean;
|
|
97
|
+
currentUserName?: string;
|
|
98
|
+
contentClassName?: string;
|
|
99
|
+
isCellPopup?: boolean;
|
|
100
|
+
shouldShowActions?: boolean;
|
|
101
|
+
row?: number;
|
|
102
|
+
col?: number;
|
|
103
|
+
}
|
|
104
|
+
export interface CommentCellUIProps {
|
|
105
|
+
row: number;
|
|
106
|
+
col: number;
|
|
107
|
+
sheetId: string;
|
|
108
|
+
comment?: CommentThread;
|
|
109
|
+
onSendComment: (commentKey: string, textareaId: string) => void;
|
|
110
|
+
onAction?: (a: CommentActionParams) => void;
|
|
111
|
+
ownerAddress?: string;
|
|
112
|
+
currentUserAddress?: string;
|
|
113
|
+
isOwner?: boolean;
|
|
114
|
+
sheetEditorRef?: React.RefObject<SheetEditorRef>;
|
|
115
|
+
currentUserName?: string;
|
|
116
|
+
removeCommentFromCell: (row: number, col: number) => void;
|
|
117
|
+
dragHandler: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
|
|
118
|
+
isHover?: boolean;
|
|
119
|
+
disabled?: boolean;
|
|
120
|
+
}
|
|
121
|
+
export interface CommentsContentProps {
|
|
122
|
+
sheetEditorRef: React.RefObject<SheetEditorRef>;
|
|
123
|
+
userName: string | undefined;
|
|
124
|
+
commentsData: Record<string, CommentThread>;
|
|
125
|
+
onSendComment: (commentKey: string, textareaId: string) => void;
|
|
126
|
+
onCommentAction?: (a: CommentActionParams) => void;
|
|
127
|
+
ownerAddress?: string;
|
|
128
|
+
currentUserAddress?: string;
|
|
129
|
+
isOwner?: boolean;
|
|
130
|
+
disabled?: boolean;
|
|
131
|
+
}
|
package/dist/editor/types.d.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import { Sheet,
|
|
2
|
-
import {
|
|
1
|
+
import { Sheet, WorkbookInstance, Cell } from '../sheet-engine/react';
|
|
2
|
+
import { RefObject } from 'react';
|
|
3
3
|
import { ERROR_MESSAGES_FLAG } from './constants/shared-constants';
|
|
4
4
|
import { SmartContractQueryHandler } from './utils/after-update-cell';
|
|
5
5
|
import { CollaborationProps } from '../sync-local/types';
|
|
6
|
+
import { CommentsConfig } from './types/comments';
|
|
6
7
|
|
|
7
8
|
import * as Y from 'yjs';
|
|
9
|
+
export type { CommentThread, CommentReply, CommentActionParams, CommentsConfig, } from './types/comments';
|
|
10
|
+
export { CommentAction } from './types/comments';
|
|
8
11
|
export interface SheetUpdateData {
|
|
9
12
|
data: Sheet[];
|
|
10
13
|
}
|
|
@@ -12,7 +15,19 @@ export interface EditorValues {
|
|
|
12
15
|
sheetEditorRef: RefObject<WorkbookInstance>;
|
|
13
16
|
currentDataRef: React.MutableRefObject<Sheet[] | null>;
|
|
14
17
|
ydocRef: React.RefObject<Y.Doc | null>;
|
|
18
|
+
openPanel: (panelId: string) => void;
|
|
19
|
+
closePanel: () => void;
|
|
15
20
|
}
|
|
21
|
+
export interface PanelConfig {
|
|
22
|
+
id: string;
|
|
23
|
+
header: {
|
|
24
|
+
title: string;
|
|
25
|
+
subtitle?: string;
|
|
26
|
+
};
|
|
27
|
+
width?: string;
|
|
28
|
+
content: React.ReactNode;
|
|
29
|
+
}
|
|
30
|
+
export type { PanelId, BuiltInPanelType, } from './components/sidebar/use-right-panels';
|
|
16
31
|
export type OnboardingHandlerType = (params: {
|
|
17
32
|
row: number;
|
|
18
33
|
column: number;
|
|
@@ -69,14 +84,12 @@ export interface DsheetProps {
|
|
|
69
84
|
onboardingHandler?: OnboardingHandlerType;
|
|
70
85
|
dataBlockApiKeyHandler?: DataBlockApiKeyHandlerType;
|
|
71
86
|
setForceSheetRender?: React.Dispatch<React.SetStateAction<number>>;
|
|
72
|
-
|
|
73
|
-
commentData?: Object;
|
|
87
|
+
commentsConfig?: CommentsConfig;
|
|
74
88
|
toggleTemplateSidebar?: () => void;
|
|
75
89
|
sheetEditorRef?: RefObject<WorkbookInstance & {
|
|
76
90
|
refreshIndexedDB: () => Promise<void>;
|
|
77
91
|
}>;
|
|
78
92
|
storeApiKey?: (apiKeyName: string) => void;
|
|
79
|
-
allowComments?: boolean;
|
|
80
93
|
onDataBlockApiResponse?: (dataBlockName: string) => void;
|
|
81
94
|
onDuneChartEmbed?: () => void;
|
|
82
95
|
onSheetCountChange?: (sheetCount: number) => void;
|
|
@@ -86,6 +99,7 @@ export interface DsheetProps {
|
|
|
86
99
|
handleSmartContractQuery?: SmartContractQueryHandler;
|
|
87
100
|
enableLiveQuery?: boolean;
|
|
88
101
|
liveQueryRefreshRate?: number;
|
|
102
|
+
customPanels?: PanelConfig[];
|
|
89
103
|
}
|
|
90
104
|
export type BaseError = {
|
|
91
105
|
message: string;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare const INVALID_KEY_MARKER = "_invalid";
|
|
2
|
+
export declare const RATE_LIMITED_KEYS = "RATE_LIMITED_KEYS";
|
|
3
|
+
export declare const DATABLOCK_API_KEYS: string[];
|
|
4
|
+
export declare class ApiKeyStorageHelper {
|
|
5
|
+
static getApiKey(keyName: string): string;
|
|
6
|
+
static clearApiKeys(): void;
|
|
7
|
+
static saveApiKey(keyName: string, key: string): void;
|
|
8
|
+
static getAllSupportedApiKeys(): Record<string, string>;
|
|
9
|
+
static getListOfRateLimitedKeys(): any;
|
|
10
|
+
static markKeyAsRateLimited(key: string): void;
|
|
11
|
+
}
|
|
12
|
+
export declare const getApiKey: (keyName: string) => string;
|
|
13
|
+
export declare const clearApiKeys: () => void;
|
|
14
|
+
export declare const saveApiKey: (keyName: string, key: string) => void;
|
|
15
|
+
export declare const getListOfRateLimitedKeys: () => any;
|
|
16
|
+
export declare const getAllSupportedApiKeysInLs: () => Record<string, string>;
|
|
17
|
+
export declare const markKeyAsRateLimited: (key: string) => void;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
type SheetEditorRefLike = {
|
|
2
|
+
current: {
|
|
3
|
+
getWorkbookSetContext?: () => unknown;
|
|
4
|
+
} | null;
|
|
5
|
+
} | null | undefined;
|
|
6
|
+
/**
|
|
7
|
+
* Clears the comment indicator from a cell.
|
|
8
|
+
*
|
|
9
|
+
* - Hides the package-rendered marker DOM node immediately so the user sees
|
|
10
|
+
* the change without waiting for a re-render.
|
|
11
|
+
* - Sets `cell.ps = undefined` in the workbook model so the dsheet package
|
|
12
|
+
* stops drawing the marker on subsequent renders / persists.
|
|
13
|
+
*
|
|
14
|
+
* Used on top-level comment delete and on top-level comment resolve.
|
|
15
|
+
*/
|
|
16
|
+
export declare const hideCellCommentMarker: (sheetEditorRef: SheetEditorRefLike, row: number, col: number) => void;
|
|
17
|
+
/**
|
|
18
|
+
* Restores the comment indicator on a cell.
|
|
19
|
+
*
|
|
20
|
+
* - Removes the inline `display: none` we set on hide so the package's marker
|
|
21
|
+
* DOM node becomes visible again if it still exists.
|
|
22
|
+
* - Re-creates a minimal `cell.ps` stub in the workbook model so the package
|
|
23
|
+
* redraws the marker on next render. Geometry fields are `null` so the
|
|
24
|
+
* package recomputes them; the existing `ps` is preserved if already set.
|
|
25
|
+
*
|
|
26
|
+
* Used on top-level comment unresolve.
|
|
27
|
+
*/
|
|
28
|
+
export declare const showCellCommentMarker: (sheetEditorRef: SheetEditorRefLike, row: number, col: number, value?: string) => void;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CellPosition } from '../types/comments';
|
|
2
|
+
|
|
3
|
+
export declare const parseCellKey: (key: string) => CellPosition | null;
|
|
4
|
+
export declare const generateWithoutCellKey: (dataLength: number) => string;
|
|
5
|
+
export declare const isCellComment: (key: string) => boolean;
|
|
6
|
+
export declare const getCellReference: (row: number, col: number) => string;
|
|
7
|
+
export declare const formatCommentDateTime: (dateString: string) => string;
|