@fileverse-dev/dsheet 2.1.5-production-patch-1 → 3.0.0
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/constants.js +1 -1
- package/dist/editor/components/api-key-modal/api-key-input.d.ts +5 -0
- package/dist/editor/components/api-key-modal/api-key-modal.d.ts +7 -0
- package/dist/editor/components/api-key-modal/rate-limit-info.d.ts +4 -0
- 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 +11 -17
- 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/sidebar-portal-registry.d.ts +20 -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/components/smart-contract/error-toast.d.ts +11 -0
- package/dist/editor/components/smart-contract/modal/abi-input-section.d.ts +11 -0
- package/dist/editor/components/smart-contract/modal/contract-name-section.d.ts +13 -0
- package/dist/editor/components/smart-contract/modal/file-upload-section.d.ts +12 -0
- package/dist/editor/components/smart-contract/modal/import-section.d.ts +8 -0
- package/dist/editor/components/smart-contract/modal/modal-header.d.ts +17 -0
- package/dist/editor/components/smart-contract/smart-contract-list-item.d.ts +8 -0
- package/dist/editor/components/smart-contract/smart-contract-modal-ui.d.ts +33 -0
- package/dist/editor/components/smart-contract/smart-contract-modal.d.ts +12 -0
- package/dist/editor/components/smart-contract/smart-contract-reading-intro.d.ts +4 -0
- package/dist/editor/components/smart-contract/smart-contract-view-list.d.ts +6 -0
- package/dist/editor/components/smart-contract/use-address-validation.d.ts +5 -0
- package/dist/editor/components/smart-contract/use-modal-outside-click.d.ts +18 -0
- package/dist/editor/components/smart-contract/use-smart-contract-modal.d.ts +38 -0
- package/dist/editor/contexts/editor-context.d.ts +20 -5
- package/dist/editor/dsheet-editor.d.ts +1 -1
- package/dist/editor/hooks/live-query/use-live-query.d.ts +4 -2
- package/dist/editor/hooks/use-editor-data.d.ts +4 -2
- package/dist/editor/hooks/use-smart-contract.d.ts +26 -0
- package/dist/editor/hooks/use-xlsx-import-impl.d.ts +7 -1
- package/dist/editor/types/comments.d.ts +134 -0
- package/dist/editor/types/smart-contract.d.ts +88 -0
- package/dist/editor/types.d.ts +39 -32
- package/dist/editor/utils/after-update-cell.d.ts +13 -8
- package/dist/editor/utils/api-key-storage.d.ts +6 -0
- package/dist/editor/utils/api-keys-local-storage.d.ts +19 -0
- package/dist/editor/utils/cell-comment-marker.d.ts +30 -0
- package/dist/editor/utils/comment-key-utils.d.ts +7 -0
- package/dist/editor/utils/csv-import.d.ts +3 -1
- package/dist/editor/utils/data-block-error-handler.d.ts +21 -0
- package/dist/editor/utils/datablock-error-utils.d.ts +1 -0
- package/dist/editor/utils/sheet-editor-safe.d.ts +26 -0
- package/dist/editor/utils/smart-contract/constants.d.ts +488 -0
- package/dist/editor/utils/smart-contract/error-helper.d.ts +20 -0
- package/dist/editor/utils/smart-contract/helpers.d.ts +4 -0
- package/dist/editor/utils/smart-contract/reading-utils.d.ts +34 -0
- package/dist/editor/utils/smart-contract/signature-utils.d.ts +9 -0
- package/dist/editor/utils/spreadsheet-import.d.ts +12 -0
- package/dist/{executeStringFunction-BkmJj04p.js → executeStringFunction-C5hEkx9z.js} +5021 -4622
- package/dist/formula.js +1 -1
- package/dist/index-CBzFxleP.js +57653 -0
- package/dist/index.d.ts +11 -1
- package/dist/index.es.js +56 -50
- package/dist/sheet-engine/core/context.d.ts +5 -0
- package/dist/sheet-engine/core/index.d.ts +1 -1
- package/dist/sheet-engine/core/modules/formula-async-eval.d.ts +53 -0
- package/dist/sheet-engine/core/modules/formula-eval.worker.d.ts +1 -0
- package/dist/sheet-engine/core/modules/formula-range-cache.d.ts +20 -0
- package/dist/sheet-engine/core/modules/formula-snapshot-eval.d.ts +40 -0
- package/dist/sheet-engine/core/modules/formula-transitive-deps.d.ts +7 -0
- package/dist/sheet-engine/core/modules/formula-worker-bridge.d.ts +16 -0
- package/dist/sheet-engine/core/modules/formula-worker-types.d.ts +24 -0
- package/dist/sheet-engine/core/modules/formula.d.ts +26 -1
- package/dist/sheet-engine/core/modules/index.d.ts +3 -1
- package/dist/sheet-engine/core/theme.d.ts +67 -0
- package/dist/sheet-engine/react/components/SheetOverlay/Icon.d.ts +5 -4
- package/dist/sheet-engine/react/components/SheetOverlay/LucideIcon.d.ts +4 -4
- package/dist/sheet-engine/react/components/SidebarPanelPortals/index.d.ts +17 -0
- package/dist/sheet-engine/react/components/Workbook/index.d.ts +6 -0
- package/dist/sheet-engine/react/components/index.d.ts +1 -0
- package/dist/sheet-engine/react/utils/datepickerStyles.d.ts +1 -1
- package/dist/style.css +1 -1
- package/dist/use-xlsx-import-impl-C_npga_I.js +1537 -0
- package/dist/{xlsx-export-impl-CqKH4-Qt.js → xlsx-export-impl-C2cU3lhm.js} +2 -2
- package/package.json +6 -4
- package/dist/editor/utils/yjs-format-debug-log.d.ts +0 -23
- package/dist/index-DRuNhPbQ.js +0 -52659
- package/dist/sheet-engine/react/components/Toolbar/conditionalFormatPortal.d.ts +0 -7
- package/dist/sheet-engine/react/components/Toolbar/dataVerificationPortal.d.ts +0 -6
- package/dist/use-xlsx-import-impl-DWyZ7XN7.js +0 -1527
- package/dist/{constants-Q8nzbvQO.js → constants-yStXQJiK.js} +2 -2
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { LiveQueryData, Sheet, WorkbookInstance } from '../../sheet-engine/react';
|
|
3
3
|
import { IndexeddbPersistence } from 'y-indexeddb';
|
|
4
|
-
import {
|
|
4
|
+
import { SheetUpdateData, DataBlockEvent } from '../types';
|
|
5
|
+
import { CommentsConfig } from '../types/comments';
|
|
6
|
+
import { ApiKeyStorage } from '../utils/api-key-storage';
|
|
7
|
+
import { OpenApiKeyModalFn } from '../utils/data-block-error-handler';
|
|
8
|
+
import { SmartContractConfig } from '../types/smart-contract';
|
|
9
|
+
import { UseSmartContractReturn } from '../hooks/use-smart-contract';
|
|
5
10
|
import { CollaborationProps, CollabState, CollabUser } from '../../sync-local/types';
|
|
6
11
|
import { Awareness } from 'y-protocols/awareness';
|
|
7
12
|
|
|
@@ -48,11 +53,19 @@ export interface EditorContextType {
|
|
|
48
53
|
terminateSession?: () => void;
|
|
49
54
|
onCollaboratorsChange?: (collaborators: CollabUser[]) => void;
|
|
50
55
|
handleLiveQuery: (subsheetIndex: number, data: LiveQueryData) => void;
|
|
56
|
+
apiKeyStorage: ApiKeyStorage;
|
|
57
|
+
onDataBlockEvent?: (event: DataBlockEvent) => void;
|
|
58
|
+
openApiKeyModal: OpenApiKeyModalFn;
|
|
59
|
+
apiKeyModalState: {
|
|
60
|
+
open: boolean;
|
|
61
|
+
apiKeyName: string;
|
|
62
|
+
onSave: (key: string) => void;
|
|
63
|
+
onClose: () => void;
|
|
64
|
+
} | null;
|
|
65
|
+
smartContract: UseSmartContractReturn;
|
|
51
66
|
}
|
|
52
67
|
interface EditorProviderProps {
|
|
53
|
-
allowComments?: boolean;
|
|
54
68
|
setSelectedTemplate?: React.Dispatch<React.SetStateAction<string>>;
|
|
55
|
-
setShowSmartContractModal?: React.Dispatch<React.SetStateAction<boolean>>;
|
|
56
69
|
getDocumentTitle?: (dsheetId: string) => Promise<string>;
|
|
57
70
|
updateDocumentTitle?: (title: string) => void;
|
|
58
71
|
isAuthorized: boolean;
|
|
@@ -65,7 +78,7 @@ interface EditorProviderProps {
|
|
|
65
78
|
onChange?: (data: SheetUpdateData, encodedUpdate?: string) => void;
|
|
66
79
|
collaboration?: CollaborationProps;
|
|
67
80
|
externalEditorRef?: React.MutableRefObject<WorkbookInstance | null>;
|
|
68
|
-
|
|
81
|
+
commentsConfig?: CommentsConfig;
|
|
69
82
|
editorStateRef?: React.MutableRefObject<{
|
|
70
83
|
refreshIndexedDB: () => Promise<void>;
|
|
71
84
|
terminateSession?: () => void;
|
|
@@ -74,7 +87,9 @@ interface EditorProviderProps {
|
|
|
74
87
|
} | null>;
|
|
75
88
|
enableLiveQuery?: boolean;
|
|
76
89
|
liveQueryRefreshRate?: number;
|
|
77
|
-
|
|
90
|
+
apiKeyStorage?: ApiKeyStorage;
|
|
91
|
+
onDataBlockEvent?: (event: DataBlockEvent) => void;
|
|
92
|
+
smartContracts?: SmartContractConfig;
|
|
78
93
|
onContentSyncStatusChange?: (status: 'initializing' | 'syncing' | 'synced' | 'error') => void;
|
|
79
94
|
}
|
|
80
95
|
export declare const EditorProvider: React.FC<EditorProviderProps>;
|
|
@@ -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, setFetchingURLData, setShowFetchURLModal, setInputFetchURLDataBlock, sheetEditorRef: externalSheetEditorRef, onDuneChartEmbed, onSheetCountChange, isAuthorized, getDocumentTitle, updateDocumentTitle, editorStateRef, setSelectedTemplate, isNewSheet, liveQueryRefreshRate, enableLiveQuery, collaboration, customPanels, apiKeyStorage, onDataBlockEvent, smartContracts, theme, onContentSyncStatusChange, }: DsheetProps) => JSX.Element;
|
|
11
11
|
export default SpreadsheetEditor;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { LiveQueryData, Sheet, WorkbookInstance } from '../../../sheet-engine/react';
|
|
2
|
-
import {
|
|
2
|
+
import { ApiKeyStorage } from '../../utils/api-key-storage';
|
|
3
|
+
import { OpenApiKeyModalFn } from '../../utils/data-block-error-handler';
|
|
4
|
+
import { DataBlockEvent } from '../../types';
|
|
3
5
|
|
|
4
6
|
export declare const LIVE_QUERY_ERROR = "LIVE_QUERY_ERROR";
|
|
5
|
-
export declare const useLiveQuery: (sheetEditorRef: React.MutableRefObject<WorkbookInstance | null>,
|
|
7
|
+
export declare const useLiveQuery: (sheetEditorRef: React.MutableRefObject<WorkbookInstance | null>, apiKeyStorage?: ApiKeyStorage, openApiKeyModal?: OpenApiKeyModalFn, onDataBlockEvent?: (event: DataBlockEvent) => void, enableLiveQuery?: boolean, refreshRate?: number) => {
|
|
6
8
|
handleLiveQuery: (subsheetIndex: number, queryData: LiveQueryData) => void;
|
|
7
9
|
initialiseLiveQueryData: (sheets: Sheet[]) => void;
|
|
8
10
|
};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { Sheet, WorkbookInstance } from '../../sheet-engine/react';
|
|
2
|
-
import {
|
|
2
|
+
import { ApiKeyStorage } from '../utils/api-key-storage';
|
|
3
|
+
import { OpenApiKeyModalFn } from '../utils/data-block-error-handler';
|
|
4
|
+
import { DataBlockEvent } from '../types';
|
|
3
5
|
|
|
4
6
|
import * as Y from 'yjs';
|
|
5
7
|
/**
|
|
@@ -14,7 +16,7 @@ export declare const useEditorData: (ydocRef: React.MutableRefObject<Y.Doc | nul
|
|
|
14
16
|
[key: string]: {
|
|
15
17
|
[key: string]: any;
|
|
16
18
|
};
|
|
17
|
-
}>>, enableLiveQuery?: boolean, liveQueryRefreshRate?: number,
|
|
19
|
+
}>>, enableLiveQuery?: boolean, liveQueryRefreshRate?: number, apiKeyStorage?: ApiKeyStorage, openApiKeyModal?: OpenApiKeyModalFn, onDataBlockEvent?: (event: DataBlockEvent) => void, allowComments?: boolean, hasCollabContentInitialised?: boolean, collabEnabled?: boolean) => {
|
|
18
20
|
sheetData: Sheet[];
|
|
19
21
|
setSheetData: import('react').Dispatch<import('react').SetStateAction<Sheet[]>>;
|
|
20
22
|
currentDataRef: import('react').MutableRefObject<Sheet[]>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Abi, Hex } from 'viem';
|
|
2
|
+
import { ContractConfig, ContractRegistry, SmartContractConfig, SupportedChain } from '../types/smart-contract';
|
|
3
|
+
import { SmartContractQueryHandler } from '../utils/after-update-cell';
|
|
4
|
+
|
|
5
|
+
export declare const useSmartContract: (config?: SmartContractConfig) => {
|
|
6
|
+
enabled: boolean;
|
|
7
|
+
showSmartContractModal: boolean;
|
|
8
|
+
setShowSmartContractModal: import('react').Dispatch<import('react').SetStateAction<boolean>>;
|
|
9
|
+
userSmartContracts: ContractConfig[];
|
|
10
|
+
allUserContracts: ContractConfig[];
|
|
11
|
+
registryMapRef: import('react').MutableRefObject<ContractRegistry>;
|
|
12
|
+
handleSmartContractQuery: SmartContractQueryHandler | undefined;
|
|
13
|
+
onImportContract: (address: Hex, network: SupportedChain, abiJson: string, smartContractName: string) => Promise<void>;
|
|
14
|
+
onDelete: (name: string) => Promise<void>;
|
|
15
|
+
handleSearch: (searchText: string) => void;
|
|
16
|
+
smartContractReadingError: {
|
|
17
|
+
hasError: boolean;
|
|
18
|
+
errorMessage: string;
|
|
19
|
+
};
|
|
20
|
+
setSmartContractReadingError: import('react').Dispatch<import('react').SetStateAction<{
|
|
21
|
+
hasError: boolean;
|
|
22
|
+
errorMessage: string;
|
|
23
|
+
}>>;
|
|
24
|
+
fetchContractAbi: (contract: ContractConfig) => Promise<Abi>;
|
|
25
|
+
};
|
|
26
|
+
export type UseSmartContractReturn = ReturnType<typeof useSmartContract>;
|
|
@@ -12,5 +12,11 @@ export type XlsxImportRuntimeDeps = {
|
|
|
12
12
|
filterToastShown: boolean;
|
|
13
13
|
setFilterToastShown: React.Dispatch<React.SetStateAction<boolean>>;
|
|
14
14
|
};
|
|
15
|
+
export type XlsxImportOptions = {
|
|
16
|
+
headless?: boolean;
|
|
17
|
+
suppressUiWarnings?: boolean;
|
|
18
|
+
onWarning?: (warning: string) => void;
|
|
19
|
+
generateSheetId?: () => string;
|
|
20
|
+
};
|
|
15
21
|
/** Full XLSX import pipeline; loaded only when user imports a file. */
|
|
16
|
-
export declare function runXlsxFileUpload({ sheetEditorRef, ydocRef, setForceSheetRender, dsheetId, currentDataRef, updateDocumentTitle, filterToastShown, setFilterToastShown, }: XlsxImportRuntimeDeps, event: React.ChangeEvent<HTMLInputElement> | undefined, fileArg: File, importType?: 'new-dsheet' | 'merge-current-dsheet' | 'new-current-dsheet'): Promise<void>;
|
|
22
|
+
export declare function runXlsxFileUpload({ sheetEditorRef, ydocRef, setForceSheetRender, dsheetId, currentDataRef, updateDocumentTitle, filterToastShown, setFilterToastShown, }: XlsxImportRuntimeDeps, event: React.ChangeEvent<HTMLInputElement> | undefined, fileArg: File, importType?: 'new-dsheet' | 'merge-current-dsheet' | 'new-current-dsheet', options?: XlsxImportOptions): Promise<void>;
|
|
@@ -0,0 +1,134 @@
|
|
|
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
|
+
closePopup?: () => void;
|
|
118
|
+
dragHandler: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
|
|
119
|
+
isHover?: boolean;
|
|
120
|
+
disabled?: boolean;
|
|
121
|
+
}
|
|
122
|
+
export interface CommentsContentProps {
|
|
123
|
+
sheetEditorRef: React.RefObject<SheetEditorRef>;
|
|
124
|
+
userName: string | undefined;
|
|
125
|
+
commentsData: Record<string, CommentThread>;
|
|
126
|
+
onSendComment: (commentKey: string, textareaId: string) => void;
|
|
127
|
+
onCommentAction?: (a: CommentActionParams) => void;
|
|
128
|
+
ownerAddress?: string;
|
|
129
|
+
currentUserAddress?: string;
|
|
130
|
+
isOwner?: boolean;
|
|
131
|
+
disabled?: boolean;
|
|
132
|
+
isAuthenticated?: boolean;
|
|
133
|
+
unauthenticatedFallback?: React.ReactNode;
|
|
134
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { Abi, Hex } from 'viem';
|
|
2
|
+
import { default as React } from 'react';
|
|
3
|
+
|
|
4
|
+
export declare enum SupportedChain {
|
|
5
|
+
Ethereum = "Ethereum",
|
|
6
|
+
Sepolia = "Sepolia",
|
|
7
|
+
Gnosis = "Gnosis",
|
|
8
|
+
Base = "Base"
|
|
9
|
+
}
|
|
10
|
+
export interface ContractConfig {
|
|
11
|
+
address: Hex;
|
|
12
|
+
abiHash: string;
|
|
13
|
+
network: SupportedChain;
|
|
14
|
+
name: string;
|
|
15
|
+
}
|
|
16
|
+
export type ContractRegistry = Record<string, ContractConfig>;
|
|
17
|
+
export interface NewContractInput {
|
|
18
|
+
name: string;
|
|
19
|
+
address: Hex;
|
|
20
|
+
network: SupportedChain;
|
|
21
|
+
abi: Abi;
|
|
22
|
+
}
|
|
23
|
+
export type SmartContractEventType = 'query-success' | 'query-error' | 'contract-added' | 'contract-deleted';
|
|
24
|
+
export interface SmartContractEvent {
|
|
25
|
+
type: SmartContractEventType;
|
|
26
|
+
contractName?: string;
|
|
27
|
+
functionName?: string;
|
|
28
|
+
chainName?: string;
|
|
29
|
+
errorMessage?: string;
|
|
30
|
+
}
|
|
31
|
+
export interface SmartContractConfig {
|
|
32
|
+
/** User's persisted private contracts from consumer keystore. Defaults to []. */
|
|
33
|
+
contracts?: ContractConfig[];
|
|
34
|
+
/** RPC URL per chain. Falls back to bundled defaults when omitted. */
|
|
35
|
+
rpcConfig?: Partial<Record<SupportedChain, string>>;
|
|
36
|
+
/** Resolve ABI from stored reference (e.g. IPFS hash). Required for user-saved contracts with abiHash. */
|
|
37
|
+
resolveAbi?: (abiHash: string) => Promise<Abi>;
|
|
38
|
+
/** Persist a new contract. When omitted, package keeps it in session memory only. */
|
|
39
|
+
onAddContract?: (input: NewContractInput) => Promise<void>;
|
|
40
|
+
/** Remove a persisted contract. When omitted, package removes from session memory only. */
|
|
41
|
+
onDeleteContract?: (contractName: string) => Promise<void>;
|
|
42
|
+
validateAddress?: (address: string, chain: SupportedChain) => boolean | Promise<boolean>;
|
|
43
|
+
onSmartContractEvent?: (event: SmartContractEvent) => void;
|
|
44
|
+
}
|
|
45
|
+
export interface CallerParams {
|
|
46
|
+
abi: Abi;
|
|
47
|
+
contractAddress: Hex;
|
|
48
|
+
chain: import('viem').Chain;
|
|
49
|
+
functionName?: string;
|
|
50
|
+
args?: unknown[];
|
|
51
|
+
}
|
|
52
|
+
export interface FetchAbiParams {
|
|
53
|
+
contractAddress: Hex;
|
|
54
|
+
chain: import('viem').Chain;
|
|
55
|
+
ipfsHash?: string;
|
|
56
|
+
}
|
|
57
|
+
export type ParsedFunction = {
|
|
58
|
+
functionName: string;
|
|
59
|
+
output: string;
|
|
60
|
+
};
|
|
61
|
+
export interface SmartContractListViewProps {
|
|
62
|
+
userSmartContracts: ContractConfig[];
|
|
63
|
+
onDelete: (name: string) => void;
|
|
64
|
+
handleSearch: (searchText: string) => void;
|
|
65
|
+
onOpenImportModal: () => void;
|
|
66
|
+
fetchContractAbi: (contract: ContractConfig) => Promise<Abi>;
|
|
67
|
+
isAuthorized: boolean;
|
|
68
|
+
}
|
|
69
|
+
export interface MyContractsProps {
|
|
70
|
+
contracts: ContractConfig[];
|
|
71
|
+
onDelete: (name: string) => void;
|
|
72
|
+
fetchContractAbi: (contract: ContractConfig) => Promise<Abi>;
|
|
73
|
+
setActiveTab?: React.Dispatch<React.SetStateAction<string>>;
|
|
74
|
+
}
|
|
75
|
+
export interface PopularContractsProps {
|
|
76
|
+
contracts: ContractConfig[];
|
|
77
|
+
onInsert: (name: string) => void;
|
|
78
|
+
fetchContractAbi: (contract: ContractConfig) => Promise<Abi>;
|
|
79
|
+
}
|
|
80
|
+
export interface CodeBlockProps {
|
|
81
|
+
code: React.ReactNode;
|
|
82
|
+
copyText: string;
|
|
83
|
+
}
|
|
84
|
+
export interface ParameterDescriptionProps {
|
|
85
|
+
paramName: string;
|
|
86
|
+
description: string;
|
|
87
|
+
optional?: boolean;
|
|
88
|
+
}
|
package/dist/editor/types.d.ts
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
import { Sheet,
|
|
2
|
-
import {
|
|
1
|
+
import { Sheet, WorkbookInstance } from '../sheet-engine/react';
|
|
2
|
+
import { RefObject } from 'react';
|
|
3
3
|
import { ERROR_MESSAGES_FLAG } from './constants/shared-constants';
|
|
4
|
-
import { SmartContractQueryHandler } from './utils/after-update-cell';
|
|
5
4
|
import { CollaborationProps } from '../sync-local/types';
|
|
5
|
+
import { CommentsConfig } from './types/comments';
|
|
6
|
+
import { SmartContractConfig } from './types/smart-contract';
|
|
7
|
+
import { ApiKeyStorage } from './utils/api-key-storage';
|
|
8
|
+
import { ThemeKey } from '../sheet-engine/core/theme';
|
|
6
9
|
|
|
7
10
|
import * as Y from 'yjs';
|
|
11
|
+
export type { ThemeKey } from '../sheet-engine/core/theme';
|
|
12
|
+
export type { CommentThread, CommentReply, CommentActionParams, CommentsConfig, } from './types/comments';
|
|
13
|
+
export { CommentAction } from './types/comments';
|
|
8
14
|
export interface SheetUpdateData {
|
|
9
15
|
data: Sheet[];
|
|
10
16
|
}
|
|
@@ -12,7 +18,19 @@ export interface EditorValues {
|
|
|
12
18
|
sheetEditorRef: RefObject<WorkbookInstance>;
|
|
13
19
|
currentDataRef: React.MutableRefObject<Sheet[] | null>;
|
|
14
20
|
ydocRef: React.RefObject<Y.Doc | null>;
|
|
21
|
+
openPanel: (panelId: string) => void;
|
|
22
|
+
closePanel: () => void;
|
|
15
23
|
}
|
|
24
|
+
export interface PanelConfig {
|
|
25
|
+
id: string;
|
|
26
|
+
header: {
|
|
27
|
+
title: string;
|
|
28
|
+
subtitle?: string;
|
|
29
|
+
};
|
|
30
|
+
width?: string;
|
|
31
|
+
content: React.ReactNode;
|
|
32
|
+
}
|
|
33
|
+
export type { PanelId, BuiltInPanelType, } from './components/sidebar/use-right-panels';
|
|
16
34
|
export type OnboardingHandlerType = (params: {
|
|
17
35
|
row: number;
|
|
18
36
|
column: number;
|
|
@@ -21,31 +39,17 @@ export type OnboardingHandlerType = (params: {
|
|
|
21
39
|
row: number;
|
|
22
40
|
column: number;
|
|
23
41
|
};
|
|
24
|
-
export type
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
handleSmartContractQuery: SmartContractQueryHandler;
|
|
33
|
-
}) => Promise<unknown>;
|
|
34
|
-
row: number;
|
|
35
|
-
column: number;
|
|
36
|
-
newValue: Cell;
|
|
37
|
-
formulaResponseUiSync: (params: {
|
|
38
|
-
row: number;
|
|
39
|
-
column: number;
|
|
40
|
-
newValue: Record<string, string>;
|
|
41
|
-
apiData: Array<Record<string, object>>;
|
|
42
|
-
sheetEditorRef: React.RefObject<WorkbookInstance | null>;
|
|
43
|
-
}) => void;
|
|
44
|
-
}) => void;
|
|
42
|
+
export type DataBlockEventType = 'success' | 'error' | 'api-key-required' | 'api-key-saved' | 'retry';
|
|
43
|
+
export interface DataBlockEvent {
|
|
44
|
+
type: DataBlockEventType;
|
|
45
|
+
functionName?: string;
|
|
46
|
+
errorType?: string;
|
|
47
|
+
apiKeyName?: string;
|
|
48
|
+
}
|
|
49
|
+
export type { ApiKeyStorage } from './utils/api-key-storage';
|
|
45
50
|
export interface DsheetProps {
|
|
46
51
|
isNewSheet: boolean;
|
|
47
52
|
setSelectedTemplate?: React.Dispatch<React.SetStateAction<string>>;
|
|
48
|
-
setShowSmartContractModal?: React.Dispatch<React.SetStateAction<boolean>>;
|
|
49
53
|
getDocumentTitle?: (dsheetId: string) => Promise<string>;
|
|
50
54
|
updateDocumentTitle?: (title: string) => void;
|
|
51
55
|
isAuthorized: boolean;
|
|
@@ -67,17 +71,16 @@ export interface DsheetProps {
|
|
|
67
71
|
/** When `onboardingComplete` is omitted, read `localStorage.getItem(key)==='true'` (default key `onboardingComplete`). */
|
|
68
72
|
onboardingCompleteLocalStorageKey?: string;
|
|
69
73
|
onboardingHandler?: OnboardingHandlerType;
|
|
70
|
-
dataBlockApiKeyHandler?: DataBlockApiKeyHandlerType;
|
|
71
74
|
setForceSheetRender?: React.Dispatch<React.SetStateAction<number>>;
|
|
72
|
-
|
|
73
|
-
commentData?: Object;
|
|
75
|
+
commentsConfig?: CommentsConfig;
|
|
74
76
|
toggleTemplateSidebar?: () => void;
|
|
75
77
|
sheetEditorRef?: RefObject<WorkbookInstance & {
|
|
76
78
|
refreshIndexedDB: () => Promise<void>;
|
|
77
79
|
}>;
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
80
|
+
/** Override where datablock API keys are stored (default: localStorage). */
|
|
81
|
+
apiKeyStorage?: ApiKeyStorage;
|
|
82
|
+
/** Optional lifecycle events for analytics / side-effects. */
|
|
83
|
+
onDataBlockEvent?: (event: DataBlockEvent) => void;
|
|
81
84
|
onDuneChartEmbed?: () => void;
|
|
82
85
|
onSheetCountChange?: (sheetCount: number) => void;
|
|
83
86
|
/** Fires whenever local content-sync status changes. Host apps should gate
|
|
@@ -87,9 +90,13 @@ export interface DsheetProps {
|
|
|
87
90
|
editorStateRef?: React.MutableRefObject<{
|
|
88
91
|
refreshIndexedDB: () => Promise<void>;
|
|
89
92
|
} | null>;
|
|
90
|
-
|
|
93
|
+
/** Smart contract config: execution + UI in package; consumer owns persistence via callbacks. */
|
|
94
|
+
smartContracts?: SmartContractConfig;
|
|
91
95
|
enableLiveQuery?: boolean;
|
|
92
96
|
liveQueryRefreshRate?: number;
|
|
97
|
+
customPanels?: PanelConfig[];
|
|
98
|
+
/** Active theme; drives the canvas/grid palette (chrome themes via the <html> class). */
|
|
99
|
+
theme?: ThemeKey;
|
|
93
100
|
}
|
|
94
101
|
export type BaseError = {
|
|
95
102
|
message: string;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { Cell, WorkbookInstance } from '../../sheet-engine/react';
|
|
2
|
-
import { OnboardingHandlerType,
|
|
2
|
+
import { OnboardingHandlerType, DataBlockEvent } from '../types';
|
|
3
3
|
import { LiveQueryData } from '../../sheet-engine/core';
|
|
4
|
+
import { OpenApiKeyModalFn } from './data-block-error-handler';
|
|
5
|
+
import { ApiKeyStorage } from './api-key-storage';
|
|
4
6
|
|
|
7
|
+
import * as Y from 'yjs';
|
|
5
8
|
export type SmartContractResponse = {
|
|
6
9
|
callSignature: unknown[];
|
|
7
10
|
};
|
|
@@ -22,15 +25,18 @@ interface AfterUpdateCellParams {
|
|
|
22
25
|
oldValue?: Cell;
|
|
23
26
|
newValue: Cell;
|
|
24
27
|
sheetEditorRef: React.RefObject<WorkbookInstance | null>;
|
|
28
|
+
handleContentPortal?: () => void;
|
|
29
|
+
dsheetId?: string;
|
|
30
|
+
ydocRef?: React.MutableRefObject<Y.Doc | null>;
|
|
25
31
|
onboardingComplete: boolean | undefined;
|
|
26
|
-
setFetchingURLData
|
|
32
|
+
setFetchingURLData?: (fetching: boolean) => void;
|
|
27
33
|
onboardingHandler: OnboardingHandlerType | undefined;
|
|
28
|
-
|
|
34
|
+
apiKeyStorage: ApiKeyStorage;
|
|
35
|
+
openApiKeyModal: OpenApiKeyModalFn;
|
|
36
|
+
onDataBlockEvent?: (event: DataBlockEvent) => void;
|
|
29
37
|
handleSmartContractQuery?: SmartContractQueryHandler | undefined;
|
|
30
38
|
handleLiveQueryData?: (subsheetIndex: number, queryData: LiveQueryData) => void;
|
|
31
|
-
setInputFetchURLDataBlock
|
|
32
|
-
storeApiKey?: (apiKeyName: string) => void;
|
|
33
|
-
onDataBlockApiResponse?: (dataBlockName: string) => void;
|
|
39
|
+
setInputFetchURLDataBlock?: React.Dispatch<React.SetStateAction<string>> | undefined;
|
|
34
40
|
setDataBlockCalcFunction?: React.Dispatch<React.SetStateAction<{
|
|
35
41
|
[key: string]: {
|
|
36
42
|
[key: string]: any;
|
|
@@ -54,7 +60,7 @@ export declare const shouldExecuteDataBlocks: (params: {
|
|
|
54
60
|
localUserEditRef?: React.MutableRefObject<boolean>;
|
|
55
61
|
sheetEditorRef: React.RefObject<WorkbookInstance | null>;
|
|
56
62
|
}) => boolean;
|
|
57
|
-
export
|
|
63
|
+
export { isDatablockError } from './datablock-error-utils';
|
|
58
64
|
/**
|
|
59
65
|
* Handles logic after a cell is updated, including processing formula results
|
|
60
66
|
*
|
|
@@ -62,4 +68,3 @@ export declare const isDatablockError: (value: any) => boolean;
|
|
|
62
68
|
* @returns Promise that resolves when processing is complete
|
|
63
69
|
*/
|
|
64
70
|
export declare const afterUpdateCell: (params: AfterUpdateCellParams) => Promise<void>;
|
|
65
|
-
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
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 removeApiKey(keyName: string): void;
|
|
9
|
+
static getAllSupportedApiKeys(): Record<string, string>;
|
|
10
|
+
static getListOfRateLimitedKeys(): any;
|
|
11
|
+
static markKeyAsRateLimited(key: string): void;
|
|
12
|
+
}
|
|
13
|
+
export declare const getApiKey: (keyName: string) => string;
|
|
14
|
+
export declare const clearApiKeys: () => void;
|
|
15
|
+
export declare const saveApiKey: (keyName: string, key: string) => void;
|
|
16
|
+
export declare const removeApiKey: (keyName: string) => void;
|
|
17
|
+
export declare const getListOfRateLimitedKeys: () => any;
|
|
18
|
+
export declare const getAllSupportedApiKeysInLs: () => Record<string, string>;
|
|
19
|
+
export declare const markKeyAsRateLimited: (key: string) => void;
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
export declare const closeCellCommentPopup: (sheetEditorRef: SheetEditorRefLike) => void;
|
|
18
|
+
/**
|
|
19
|
+
* Restores the comment indicator on a cell.
|
|
20
|
+
*
|
|
21
|
+
* - Removes the inline `display: none` we set on hide so the package's marker
|
|
22
|
+
* DOM node becomes visible again if it still exists.
|
|
23
|
+
* - Re-creates a minimal `cell.ps` stub in the workbook model so the package
|
|
24
|
+
* redraws the marker on next render. Geometry fields are `null` so the
|
|
25
|
+
* package recomputes them; the existing `ps` is preserved if already set.
|
|
26
|
+
*
|
|
27
|
+
* Used on top-level comment unresolve.
|
|
28
|
+
*/
|
|
29
|
+
export declare const showCellCommentMarker: (sheetEditorRef: SheetEditorRefLike, row: number, col: number, value?: string) => void;
|
|
30
|
+
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;
|
|
@@ -2,4 +2,6 @@ import { default as React } from 'react';
|
|
|
2
2
|
import { WorkbookInstance } from '../../sheet-engine/react';
|
|
3
3
|
|
|
4
4
|
import * as Y from 'yjs';
|
|
5
|
-
export declare const handleCSVUpload: (event: React.ChangeEventHandler<HTMLInputElement> | undefined, ydoc: Y.Doc | null, setForceSheetRender: React.Dispatch<React.SetStateAction<number>>, dsheetId: string, currentDataRef: React.MutableRefObject<object | null>, sheetEditorRef: React.RefObject<WorkbookInstance | null>, updateDocumentTitle?: (title: string) => void, fileArg?: File, importType?: string, handleContentPortal?: any, separatorType?: string
|
|
5
|
+
export declare const handleCSVUpload: (event: React.ChangeEventHandler<HTMLInputElement> | undefined, ydoc: Y.Doc | null, setForceSheetRender: React.Dispatch<React.SetStateAction<number>>, dsheetId: string, currentDataRef: React.MutableRefObject<object | null>, sheetEditorRef: React.RefObject<WorkbookInstance | null>, updateDocumentTitle?: (title: string) => void, fileArg?: File, importType?: string, handleContentPortal?: any, separatorType?: string, options?: {
|
|
6
|
+
suppressUiWarnings?: boolean;
|
|
7
|
+
}) => Promise<void>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Cell, WorkbookInstance } from '../../sheet-engine/react';
|
|
2
|
+
import { DataBlockEvent, ErrorMessageHandlerReturnType } from '../types';
|
|
3
|
+
import { ApiKeyStorage } from './api-key-storage';
|
|
4
|
+
import { SmartContractQueryHandler } from './after-update-cell';
|
|
5
|
+
|
|
6
|
+
export type OpenApiKeyModalFn = (apiKeyName: string, callbacks: {
|
|
7
|
+
onSave: (key: string) => void;
|
|
8
|
+
onClose: () => void;
|
|
9
|
+
}) => void;
|
|
10
|
+
export interface DataBlockErrorHandlerParams {
|
|
11
|
+
data: ErrorMessageHandlerReturnType;
|
|
12
|
+
sheetEditorRef: React.RefObject<WorkbookInstance | null>;
|
|
13
|
+
row: number;
|
|
14
|
+
column: number;
|
|
15
|
+
newValue: Cell;
|
|
16
|
+
apiKeyStorage: ApiKeyStorage;
|
|
17
|
+
openApiKeyModal: OpenApiKeyModalFn;
|
|
18
|
+
onDataBlockEvent?: (event: DataBlockEvent) => void;
|
|
19
|
+
handleSmartContractQuery?: SmartContractQueryHandler;
|
|
20
|
+
}
|
|
21
|
+
export declare const handleDataBlockError: ({ data, sheetEditorRef, row, column, newValue, apiKeyStorage, openApiKeyModal, onDataBlockEvent, handleSmartContractQuery, }: DataBlockErrorHandlerParams) => Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isDatablockError: (value: unknown) => boolean;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
import { SheetEditorRef } from '../types/comments';
|
|
3
|
+
|
|
4
|
+
type SheetEditorRefLike = RefObject<SheetEditorRef | null> | null | undefined;
|
|
5
|
+
type WorkbookSheetLike = {
|
|
6
|
+
id?: string;
|
|
7
|
+
order?: number;
|
|
8
|
+
name?: string;
|
|
9
|
+
};
|
|
10
|
+
export declare function isWorkbookReady(ref: SheetEditorRefLike): boolean;
|
|
11
|
+
export declare function getCurrentSheetSafe(ref: SheetEditorRefLike): WorkbookSheetLike | null;
|
|
12
|
+
export declare function getCurrentSheetOrderSafe(ref: SheetEditorRefLike): number;
|
|
13
|
+
export declare function getCurrentSheetIdSafe(ref: SheetEditorRefLike): string;
|
|
14
|
+
export declare function getAllSheetsSafe(ref: SheetEditorRefLike): WorkbookSheetLike[];
|
|
15
|
+
export declare function buildSheetOrderNameMap(ref: SheetEditorRefLike): Map<number, string>;
|
|
16
|
+
/**
|
|
17
|
+
* Returns a map keyed by BOTH the sheet's immutable id AND its numeric
|
|
18
|
+
* order-as-string so that both new (UUID) and legacy (order) comment keys
|
|
19
|
+
* resolve to the correct display name in a single lookup.
|
|
20
|
+
*/
|
|
21
|
+
export declare function buildSheetIdNameMap(ref: SheetEditorRefLike): Map<string, string>;
|
|
22
|
+
export declare function findSheetById(ref: SheetEditorRefLike, id: string): WorkbookSheetLike | null;
|
|
23
|
+
export declare function activateSheetById(ref: SheetEditorRefLike, id: string): boolean;
|
|
24
|
+
export declare function findSheetByOrder(ref: SheetEditorRefLike, order: number): WorkbookSheetLike | null;
|
|
25
|
+
export declare function activateSheetByOrder(ref: SheetEditorRefLike, order: number): boolean;
|
|
26
|
+
export {};
|