@fileverse-dev/dsheet 2.1.2-dropIn-mri-5 → 2.1.3-package-cleanup-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/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/editor-workbook.d.ts +3 -5
- package/dist/editor/contexts/editor-context.d.ts +14 -2
- 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/types.d.ts +18 -25
- 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 +2 -0
- 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/{executeStringFunction-BU-Q3JXP.js → executeStringFunction-C26SXUpc.js} +1831 -1771
- package/dist/formula.js +1 -1
- package/dist/{index-DfYO5xfL.js → index-DSogq3Tz.js} +19714 -19360
- package/dist/index.d.ts +1 -1
- package/dist/index.es.js +21 -21
- 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/Workbook/index.d.ts +2 -0
- package/dist/sheet-engine/react/utils/datepickerStyles.d.ts +1 -1
- package/dist/style.css +1 -1
- package/dist/{use-xlsx-import-impl-CHQzU9l2.js → use-xlsx-import-impl-C-PHnu49.js} +2 -2
- package/dist/{xlsx-export-impl-CC1y_nZm.js → xlsx-export-impl-BAJCFNh6.js} +2 -2
- package/package.json +3 -3
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface ApiKeyModalProps {
|
|
2
|
+
open: boolean;
|
|
3
|
+
apiKeyName: string;
|
|
4
|
+
onSave: (key: string) => void;
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const ApiKeyModal: ({ open, apiKeyName, onSave, onClose, }: ApiKeyModalProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { SidebarPortalRegistryHandle, SidebarPortalRenderer } from '../../sheet-engine/react';
|
|
3
|
+
import { ThemeKey } from '../../sheet-engine/core/theme';
|
|
3
4
|
import { SmartContractQueryHandler } from '../utils/after-update-cell';
|
|
4
|
-
import { OnboardingHandlerType
|
|
5
|
+
import { OnboardingHandlerType } from '../types';
|
|
5
6
|
import { CommentsConfig } from '../types/comments';
|
|
6
7
|
|
|
7
8
|
type OnboardingHandler = OnboardingHandlerType;
|
|
8
|
-
type DataBlockApiKeyHandler = DataBlockApiKeyHandlerType;
|
|
9
9
|
interface EditorWorkbookProps {
|
|
10
10
|
setShowSmartContractModal?: React.Dispatch<React.SetStateAction<boolean>>;
|
|
11
11
|
setShowFetchURLModal?: React.Dispatch<React.SetStateAction<boolean>>;
|
|
@@ -17,19 +17,17 @@ interface EditorWorkbookProps {
|
|
|
17
17
|
onboardingComplete?: boolean;
|
|
18
18
|
onboardingCompleteLocalStorageKey?: string;
|
|
19
19
|
onboardingHandler?: OnboardingHandler;
|
|
20
|
-
dataBlockApiKeyHandler?: DataBlockApiKeyHandler;
|
|
21
20
|
exportDropdownOpen?: boolean;
|
|
22
21
|
commentsConfig?: CommentsConfig;
|
|
23
22
|
setExportDropdownOpen?: React.Dispatch<React.SetStateAction<boolean>>;
|
|
24
23
|
dsheetId: string;
|
|
25
|
-
storeApiKey?: (apiKeyName: string) => void;
|
|
26
|
-
onDataBlockApiResponse?: (dataBlockName: string) => void;
|
|
27
24
|
onDuneChartEmbed?: () => void;
|
|
28
25
|
onSheetCountChange?: (sheetCount: number) => void;
|
|
29
26
|
handleSmartContractQuery?: SmartContractQueryHandler;
|
|
30
27
|
sidebarActivePanel?: string | null;
|
|
31
28
|
sidebarPortalRegistry?: SidebarPortalRegistryHandle | null;
|
|
32
29
|
sidebarPortalRenderers?: Record<string, SidebarPortalRenderer>;
|
|
30
|
+
theme?: ThemeKey;
|
|
33
31
|
}
|
|
34
32
|
export declare const EditorWorkbook: React.NamedExoticComponent<EditorWorkbookProps>;
|
|
35
33
|
export {};
|
|
@@ -1,8 +1,10 @@
|
|
|
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
5
|
import { CommentsConfig } from '../types/comments';
|
|
6
|
+
import { ApiKeyStorage } from '../utils/api-key-storage';
|
|
7
|
+
import { OpenApiKeyModalFn } from '../utils/data-block-error-handler';
|
|
6
8
|
import { CollaborationProps, CollabState, CollabUser } from '../../sync-local/types';
|
|
7
9
|
import { Awareness } from 'y-protocols/awareness';
|
|
8
10
|
|
|
@@ -49,6 +51,15 @@ export interface EditorContextType {
|
|
|
49
51
|
terminateSession?: () => void;
|
|
50
52
|
onCollaboratorsChange?: (collaborators: CollabUser[]) => void;
|
|
51
53
|
handleLiveQuery: (subsheetIndex: number, data: LiveQueryData) => void;
|
|
54
|
+
apiKeyStorage: ApiKeyStorage;
|
|
55
|
+
onDataBlockEvent?: (event: DataBlockEvent) => void;
|
|
56
|
+
openApiKeyModal: OpenApiKeyModalFn;
|
|
57
|
+
apiKeyModalState: {
|
|
58
|
+
open: boolean;
|
|
59
|
+
apiKeyName: string;
|
|
60
|
+
onSave: (key: string) => void;
|
|
61
|
+
onClose: () => void;
|
|
62
|
+
} | null;
|
|
52
63
|
}
|
|
53
64
|
interface EditorProviderProps {
|
|
54
65
|
setSelectedTemplate?: React.Dispatch<React.SetStateAction<string>>;
|
|
@@ -74,7 +85,8 @@ interface EditorProviderProps {
|
|
|
74
85
|
} | null>;
|
|
75
86
|
enableLiveQuery?: boolean;
|
|
76
87
|
liveQueryRefreshRate?: number;
|
|
77
|
-
|
|
88
|
+
apiKeyStorage?: ApiKeyStorage;
|
|
89
|
+
onDataBlockEvent?: (event: DataBlockEvent) => void;
|
|
78
90
|
}
|
|
79
91
|
export declare const EditorProvider: React.FC<EditorProviderProps>;
|
|
80
92
|
export declare const useEditor: () => EditorContextType;
|
|
@@ -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, renderNavbar, enableIndexeddbSync, dsheetId, portalContent, onChange, username, selectedTemplate, toggleTemplateSidebar, isTemplateOpen, onboardingComplete, onboardingCompleteLocalStorageKey, onboardingHandler, commentsConfig,
|
|
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, setShowSmartContractModal, editorStateRef, handleSmartContractQuery, setSelectedTemplate, isNewSheet, liveQueryRefreshRate, enableLiveQuery, collaboration, customPanels, apiKeyStorage, onDataBlockEvent, theme, }: 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[]>;
|
package/dist/editor/types.d.ts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import { Sheet, WorkbookInstance
|
|
1
|
+
import { Sheet, WorkbookInstance } from '../sheet-engine/react';
|
|
2
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
6
|
import { CommentsConfig } from './types/comments';
|
|
7
|
+
import { ApiKeyStorage } from './utils/api-key-storage';
|
|
8
|
+
import { ThemeKey } from '../sheet-engine/core/theme';
|
|
7
9
|
|
|
8
10
|
import * as Y from 'yjs';
|
|
11
|
+
export type { ThemeKey } from '../sheet-engine/core/theme';
|
|
9
12
|
export type { CommentThread, CommentReply, CommentActionParams, CommentsConfig, } from './types/comments';
|
|
10
13
|
export { CommentAction } from './types/comments';
|
|
11
14
|
export interface SheetUpdateData {
|
|
@@ -36,27 +39,14 @@ export type OnboardingHandlerType = (params: {
|
|
|
36
39
|
row: number;
|
|
37
40
|
column: number;
|
|
38
41
|
};
|
|
39
|
-
export type
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
handleSmartContractQuery: SmartContractQueryHandler;
|
|
48
|
-
}) => Promise<unknown>;
|
|
49
|
-
row: number;
|
|
50
|
-
column: number;
|
|
51
|
-
newValue: Cell;
|
|
52
|
-
formulaResponseUiSync: (params: {
|
|
53
|
-
row: number;
|
|
54
|
-
column: number;
|
|
55
|
-
newValue: Record<string, string>;
|
|
56
|
-
apiData: Array<Record<string, object>>;
|
|
57
|
-
sheetEditorRef: React.RefObject<WorkbookInstance | null>;
|
|
58
|
-
}) => void;
|
|
59
|
-
}) => 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';
|
|
60
50
|
export interface DsheetProps {
|
|
61
51
|
isNewSheet: boolean;
|
|
62
52
|
setSelectedTemplate?: React.Dispatch<React.SetStateAction<string>>;
|
|
@@ -82,15 +72,16 @@ export interface DsheetProps {
|
|
|
82
72
|
/** When `onboardingComplete` is omitted, read `localStorage.getItem(key)==='true'` (default key `onboardingComplete`). */
|
|
83
73
|
onboardingCompleteLocalStorageKey?: string;
|
|
84
74
|
onboardingHandler?: OnboardingHandlerType;
|
|
85
|
-
dataBlockApiKeyHandler?: DataBlockApiKeyHandlerType;
|
|
86
75
|
setForceSheetRender?: React.Dispatch<React.SetStateAction<number>>;
|
|
87
76
|
commentsConfig?: CommentsConfig;
|
|
88
77
|
toggleTemplateSidebar?: () => void;
|
|
89
78
|
sheetEditorRef?: RefObject<WorkbookInstance & {
|
|
90
79
|
refreshIndexedDB: () => Promise<void>;
|
|
91
80
|
}>;
|
|
92
|
-
|
|
93
|
-
|
|
81
|
+
/** Override where datablock API keys are stored (default: localStorage). */
|
|
82
|
+
apiKeyStorage?: ApiKeyStorage;
|
|
83
|
+
/** Optional lifecycle events for analytics / side-effects. */
|
|
84
|
+
onDataBlockEvent?: (event: DataBlockEvent) => void;
|
|
94
85
|
onDuneChartEmbed?: () => void;
|
|
95
86
|
onSheetCountChange?: (sheetCount: number) => void;
|
|
96
87
|
editorStateRef?: React.MutableRefObject<{
|
|
@@ -100,6 +91,8 @@ export interface DsheetProps {
|
|
|
100
91
|
enableLiveQuery?: boolean;
|
|
101
92
|
liveQueryRefreshRate?: number;
|
|
102
93
|
customPanels?: PanelConfig[];
|
|
94
|
+
/** Active theme; drives the canvas/grid palette (chrome themes via the <html> class). */
|
|
95
|
+
theme?: ThemeKey;
|
|
103
96
|
}
|
|
104
97
|
export type BaseError = {
|
|
105
98
|
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 {};
|
|
@@ -5,6 +5,7 @@ export declare class ApiKeyStorageHelper {
|
|
|
5
5
|
static getApiKey(keyName: string): string;
|
|
6
6
|
static clearApiKeys(): void;
|
|
7
7
|
static saveApiKey(keyName: string, key: string): void;
|
|
8
|
+
static removeApiKey(keyName: string): void;
|
|
8
9
|
static getAllSupportedApiKeys(): Record<string, string>;
|
|
9
10
|
static getListOfRateLimitedKeys(): any;
|
|
10
11
|
static markKeyAsRateLimited(key: string): void;
|
|
@@ -12,6 +13,7 @@ export declare class ApiKeyStorageHelper {
|
|
|
12
13
|
export declare const getApiKey: (keyName: string) => string;
|
|
13
14
|
export declare const clearApiKeys: () => void;
|
|
14
15
|
export declare const saveApiKey: (keyName: string, key: string) => void;
|
|
16
|
+
export declare const removeApiKey: (keyName: string) => void;
|
|
15
17
|
export declare const getListOfRateLimitedKeys: () => any;
|
|
16
18
|
export declare const getAllSupportedApiKeysInLs: () => Record<string, string>;
|
|
17
19
|
export declare const markKeyAsRateLimited: (key: string) => 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;
|