@fileverse-dev/dsheet 1.2.0 → 1.2.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/index.d.ts +6 -0
- package/dist/index.es.js +117952 -107961
- package/dist/package/components/import-button-ui.d.ts +2 -2
- package/dist/package/contexts/editor-context.d.ts +6 -2
- package/dist/package/dsheet-editor.d.ts +1 -1
- package/dist/package/hooks/live-query/constants.d.ts +1 -0
- package/dist/package/hooks/live-query/helpers.d.ts +2 -0
- package/dist/package/hooks/live-query/use-live-query.d.ts +8 -0
- package/dist/package/hooks/use-editor-data.d.ts +3 -1
- package/dist/package/hooks/use-editor-sync.d.ts +1 -1
- package/dist/package/hooks/use-xlsx-import.d.ts +3 -2
- package/dist/package/types.d.ts +2 -0
- package/dist/package/utils/after-update-cell.d.ts +4 -1
- package/dist/package/utils/csv-import.d.ts +1 -1
- package/dist/package/utils/custom-toolbar-item.d.ts +3 -3
- package/dist/package/utils/formula-ui-sync.d.ts +116 -1
- package/dist/package/utils/generic.d.ts +2 -0
- package/dist/package/utils/update-index-after-drag.d.ts +20 -0
- package/dist/style.css +1 -1
- package/package.json +6 -6
|
@@ -2,8 +2,8 @@ import { ChangeEventHandler } from 'react';
|
|
|
2
2
|
|
|
3
3
|
export declare const CustomButton: ({ setExportDropdownOpen, handleCSVUpload, handleXLSXUpload, handleExportToXLSX, handleExportToCSV, handleExportToJSON, }: {
|
|
4
4
|
setExportDropdownOpen: React.Dispatch<React.SetStateAction<boolean>>;
|
|
5
|
-
handleCSVUpload: ChangeEventHandler<HTMLInputElement
|
|
6
|
-
handleXLSXUpload: ChangeEventHandler<HTMLInputElement
|
|
5
|
+
handleCSVUpload: (event: ChangeEventHandler<HTMLInputElement> | undefined, file: any, importType: string) => void;
|
|
6
|
+
handleXLSXUpload: (event: ChangeEventHandler<HTMLInputElement> | undefined, file: any, importType: string) => void;
|
|
7
7
|
handleExportToXLSX: () => void;
|
|
8
8
|
handleExportToCSV: () => void;
|
|
9
9
|
handleExportToJSON: () => void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import { Sheet, WorkbookInstance } from '@fileverse-dev/fortune-react';
|
|
2
|
+
import { LiveQueryData, Sheet, WorkbookInstance } from '@fileverse-dev/fortune-react';
|
|
3
3
|
import { IndexeddbPersistence } from 'y-indexeddb';
|
|
4
|
-
import { SheetUpdateData } from '../types';
|
|
4
|
+
import { DataBlockApiKeyHandlerType, SheetUpdateData } from '../types';
|
|
5
5
|
|
|
6
6
|
import * as Y from 'yjs';
|
|
7
7
|
export interface EditorContextType {
|
|
@@ -36,6 +36,7 @@ export interface EditorContextType {
|
|
|
36
36
|
collaborationStatus: 'disconnected' | 'connecting' | 'connected' | 'error';
|
|
37
37
|
syncStatus: 'initializing' | 'syncing' | 'synced' | 'error';
|
|
38
38
|
isCollaborative?: boolean;
|
|
39
|
+
handleLiveQuery: (subsheetIndex: number, data: LiveQueryData) => void;
|
|
39
40
|
}
|
|
40
41
|
interface EditorProviderProps {
|
|
41
42
|
setSelectedTemplate?: React.Dispatch<React.SetStateAction<string>>;
|
|
@@ -57,6 +58,9 @@ interface EditorProviderProps {
|
|
|
57
58
|
editorStateRef?: React.MutableRefObject<{
|
|
58
59
|
refreshIndexedDB: () => Promise<void>;
|
|
59
60
|
} | null>;
|
|
61
|
+
enableLiveQuery?: boolean;
|
|
62
|
+
liveQueryRefreshRate?: number;
|
|
63
|
+
dataBlockApiKeyHandler?: DataBlockApiKeyHandlerType;
|
|
60
64
|
}
|
|
61
65
|
export declare const EditorProvider: React.FC<EditorProviderProps>;
|
|
62
66
|
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: ({ isCollaborative, isReadOnly, allowComments, renderNavbar, enableIndexeddbSync, dsheetId, portalContent, onChange, username, selectedTemplate, toggleTemplateSidebar, isTemplateOpen, enableWebrtc, onboardingComplete, onboardingHandler, commentData, getCommentCellUI, dataBlockApiKeyHandler, setFetchingURLData, setShowFetchURLModal, setInputFetchURLDataBlock, sheetEditorRef: externalSheetEditorRef, storeApiKey, onDuneChartEmbed, onSheetCountChange, onDataBlockApiResponse, isAuthorized, getDocumentTitle, updateDocumentTitle, setShowSmartContractModal, editorStateRef, handleSmartContractQuery, setSelectedTemplate, isNewSheet, }: DsheetProps) => JSX.Element;
|
|
10
|
+
declare const SpreadsheetEditor: ({ isCollaborative, isReadOnly, allowComments, renderNavbar, enableIndexeddbSync, dsheetId, portalContent, onChange, username, selectedTemplate, toggleTemplateSidebar, isTemplateOpen, enableWebrtc, onboardingComplete, onboardingHandler, commentData, getCommentCellUI, dataBlockApiKeyHandler, setFetchingURLData, setShowFetchURLModal, setInputFetchURLDataBlock, sheetEditorRef: externalSheetEditorRef, storeApiKey, onDuneChartEmbed, onSheetCountChange, onDataBlockApiResponse, isAuthorized, getDocumentTitle, updateDocumentTitle, setShowSmartContractModal, editorStateRef, handleSmartContractQuery, setSelectedTemplate, isNewSheet, liveQueryRefreshRate, enableLiveQuery, }: DsheetProps) => JSX.Element;
|
|
11
11
|
export default SpreadsheetEditor;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SUPPORTED_LIVE_QUERY_FUNCTIONS: string[];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { LiveQueryData, Sheet, WorkbookInstance } from '@fileverse-dev/fortune-react';
|
|
2
|
+
import { DataBlockApiKeyHandlerType } from '../../types';
|
|
3
|
+
|
|
4
|
+
export declare const LIVE_QUERY_ERROR = "LIVE_QUERY_ERROR";
|
|
5
|
+
export declare const useLiveQuery: (sheetEditorRef: React.MutableRefObject<WorkbookInstance | null>, dataBlockApiKeyHandler?: DataBlockApiKeyHandlerType, enableLiveQuery?: boolean, refreshRate?: number) => {
|
|
6
|
+
handleLiveQuery: (subsheetIndex: number, queryData: LiveQueryData) => void;
|
|
7
|
+
initialiseLiveQueryData: (sheets: Sheet[]) => void;
|
|
8
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Sheet, WorkbookInstance } from '@fileverse-dev/fortune-react';
|
|
2
|
+
import { DataBlockApiKeyHandlerType } from '../types';
|
|
2
3
|
|
|
3
4
|
import * as Y from 'yjs';
|
|
4
5
|
/**
|
|
@@ -13,11 +14,12 @@ export declare const useEditorData: (ydocRef: React.MutableRefObject<Y.Doc | nul
|
|
|
13
14
|
[key: string]: {
|
|
14
15
|
[key: string]: any;
|
|
15
16
|
};
|
|
16
|
-
}
|
|
17
|
+
}>>, enableLiveQuery?: boolean, liveQueryRefreshRate?: number, dataBlockApiKeyHandler?: DataBlockApiKeyHandlerType) => {
|
|
17
18
|
sheetData: Sheet[];
|
|
18
19
|
setSheetData: import('react').Dispatch<import('react').SetStateAction<Sheet[]>>;
|
|
19
20
|
currentDataRef: import('react').MutableRefObject<Sheet[]>;
|
|
20
21
|
remoteUpdateRef: import('react').MutableRefObject<boolean>;
|
|
21
22
|
isDataLoaded: boolean;
|
|
22
23
|
handleChange: (data: Sheet[]) => void;
|
|
24
|
+
handleLiveQuery: (subsheetIndex: number, queryData: import('@fileverse-dev/fortune-core').LiveQueryData) => void;
|
|
23
25
|
};
|
|
@@ -7,7 +7,7 @@ import * as Y from 'yjs';
|
|
|
7
7
|
export declare const useEditorSync: (dsheetId: string, enableIndexeddbSync?: boolean, isReadOnly?: boolean) => {
|
|
8
8
|
ydocRef: import('react').MutableRefObject<Y.Doc | null>;
|
|
9
9
|
persistenceRef: import('react').MutableRefObject<IndexeddbPersistence | null>;
|
|
10
|
-
syncStatus: "
|
|
10
|
+
syncStatus: "error" | "initializing" | "syncing" | "synced";
|
|
11
11
|
isSyncedRef: import('react').MutableRefObject<boolean>;
|
|
12
12
|
refreshIndexedDB: () => Promise<void>;
|
|
13
13
|
};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { WorkbookInstance } from '@fileverse-dev/fortune-react';
|
|
2
2
|
import * as Y from 'yjs';
|
|
3
|
-
export declare const useXLSXImport: ({ sheetEditorRef, ydocRef, setForceSheetRender, dsheetId, currentDataRef, }: {
|
|
3
|
+
export declare const useXLSXImport: ({ sheetEditorRef, ydocRef, setForceSheetRender, dsheetId, currentDataRef, updateDocumentTitle, }: {
|
|
4
4
|
sheetEditorRef: React.RefObject<WorkbookInstance | null>;
|
|
5
5
|
ydocRef: React.RefObject<Y.Doc | null>;
|
|
6
6
|
setForceSheetRender: React.Dispatch<React.SetStateAction<number>>;
|
|
7
7
|
dsheetId: string;
|
|
8
8
|
currentDataRef: React.MutableRefObject<object | null>;
|
|
9
|
+
updateDocumentTitle?: (title: string) => void;
|
|
9
10
|
}) => {
|
|
10
|
-
handleXLSXUpload: (event: React.ChangeEvent<HTMLInputElement> | undefined, fileArg: File) => Promise<void>;
|
|
11
|
+
handleXLSXUpload: (event: React.ChangeEvent<HTMLInputElement> | undefined, fileArg: File, importType?: "new-dsheet" | "merge-current-dsheet" | "new-current-dsheet") => Promise<void>;
|
|
11
12
|
};
|
package/dist/package/types.d.ts
CHANGED
|
@@ -75,6 +75,8 @@ export interface DsheetProps {
|
|
|
75
75
|
refreshIndexedDB: () => Promise<void>;
|
|
76
76
|
} | null>;
|
|
77
77
|
handleSmartContractQuery?: SmartContractQueryHandler;
|
|
78
|
+
enableLiveQuery?: boolean;
|
|
79
|
+
liveQueryRefreshRate?: number;
|
|
78
80
|
}
|
|
79
81
|
export type BaseError = {
|
|
80
82
|
message: string;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Cell, WorkbookInstance } from '@fileverse-dev/fortune-react';
|
|
2
2
|
import { OnboardingHandlerType, DataBlockApiKeyHandlerType } from '../types';
|
|
3
|
+
import { LiveQueryData } from '@fileverse-dev/fortune-core';
|
|
3
4
|
|
|
4
5
|
export type SmartContractResponse = {
|
|
5
6
|
callSignature: unknown[];
|
|
@@ -25,7 +26,8 @@ interface AfterUpdateCellParams {
|
|
|
25
26
|
setFetchingURLData: (fetching: boolean) => void;
|
|
26
27
|
onboardingHandler: OnboardingHandlerType | undefined;
|
|
27
28
|
dataBlockApiKeyHandler: DataBlockApiKeyHandlerType | undefined;
|
|
28
|
-
handleSmartContractQuery
|
|
29
|
+
handleSmartContractQuery?: SmartContractQueryHandler | undefined;
|
|
30
|
+
handleLiveQueryData?: (subsheetIndex: number, queryData: LiveQueryData) => void;
|
|
29
31
|
setInputFetchURLDataBlock: React.Dispatch<React.SetStateAction<string>> | undefined;
|
|
30
32
|
storeApiKey?: (apiKeyName: string) => void;
|
|
31
33
|
onDataBlockApiResponse?: (dataBlockName: string) => void;
|
|
@@ -40,6 +42,7 @@ interface AfterUpdateCellParams {
|
|
|
40
42
|
};
|
|
41
43
|
};
|
|
42
44
|
}
|
|
45
|
+
export declare const isDatablockError: (value: any) => boolean;
|
|
43
46
|
/**
|
|
44
47
|
* Handles logic after a cell is updated, including processing formula results
|
|
45
48
|
*
|
|
@@ -2,4 +2,4 @@ import { default as React } from 'react';
|
|
|
2
2
|
import { WorkbookInstance } from '@fileverse-dev/fortune-react';
|
|
3
3
|
|
|
4
4
|
import * as Y from 'yjs';
|
|
5
|
-
export declare const handleCSVUpload: (event: React.
|
|
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) => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { default as React,
|
|
1
|
+
import { default as React, ChangeEventHandler } from 'react';
|
|
2
2
|
import { WorkbookInstance } from '@fileverse-dev/fortune-react';
|
|
3
3
|
|
|
4
4
|
import * as Y from 'yjs';
|
|
@@ -7,8 +7,8 @@ export declare const getCustomToolbarItems: ({ setShowSmartContractModal, setExp
|
|
|
7
7
|
getDocumentTitle?: () => string;
|
|
8
8
|
updateDocumentTitle?: (title: string) => void;
|
|
9
9
|
setExportDropdownOpen: React.Dispatch<React.SetStateAction<boolean>>;
|
|
10
|
-
handleCSVUpload: (event:
|
|
11
|
-
handleXLSXUpload:
|
|
10
|
+
handleCSVUpload: (event: ChangeEventHandler<HTMLInputElement> | undefined, ydocRef: 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, file?: File, importType?: string) => void;
|
|
11
|
+
handleXLSXUpload: (event: ChangeEventHandler<HTMLInputElement> | undefined, file?: File, importType?: string) => void;
|
|
12
12
|
handleExportToXLSX: (sheetEditorRef: React.RefObject<WorkbookInstance | null>, ydocRef: React.RefObject<Y.Doc | null>, dsheetId: string, getDocumentTitle?: () => string) => void;
|
|
13
13
|
handleExportToCSV: (sheetEditorRef: React.RefObject<WorkbookInstance | null>, ydocRef: React.RefObject<Y.Doc | null>, dsheetId: string) => void;
|
|
14
14
|
handleExportToJSON: (sheetEditorRef: React.RefObject<WorkbookInstance | null>, ydocRef: React.RefObject<Y.Doc | null>, dsheetId: string) => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WorkbookInstance } from '@fileverse-dev/fortune-react';
|
|
1
|
+
import { Cell, WorkbookInstance } from '@fileverse-dev/fortune-react';
|
|
2
2
|
|
|
3
3
|
export type FormulaSyncType = {
|
|
4
4
|
row: number;
|
|
@@ -8,3 +8,118 @@ export type FormulaSyncType = {
|
|
|
8
8
|
sheetEditorRef: React.RefObject<WorkbookInstance | null>;
|
|
9
9
|
};
|
|
10
10
|
export declare const formulaResponseUiSync: ({ row, column, newValue, apiData, sheetEditorRef, }: FormulaSyncType) => void;
|
|
11
|
+
export declare const getCellClone: (r: number, c: number, sheetEditorRef: React.RefObject<WorkbookInstance | null>) => {
|
|
12
|
+
v?: string | number | boolean;
|
|
13
|
+
m?: string | number;
|
|
14
|
+
mc?: {
|
|
15
|
+
r: number;
|
|
16
|
+
c: number;
|
|
17
|
+
rs?: number;
|
|
18
|
+
cs?: number;
|
|
19
|
+
};
|
|
20
|
+
f?: string;
|
|
21
|
+
ct?: {
|
|
22
|
+
fa?: string;
|
|
23
|
+
t?: string;
|
|
24
|
+
s?: any;
|
|
25
|
+
};
|
|
26
|
+
qp?: number;
|
|
27
|
+
spl?: any;
|
|
28
|
+
bg?: string;
|
|
29
|
+
lo?: number;
|
|
30
|
+
rt?: number;
|
|
31
|
+
baseValue?: number | string;
|
|
32
|
+
baseCurrency?: string;
|
|
33
|
+
baseCurrencyPrice?: string | number;
|
|
34
|
+
isDataBlockFormula?: boolean;
|
|
35
|
+
ps?: {
|
|
36
|
+
left: number | null;
|
|
37
|
+
top: number | null;
|
|
38
|
+
width: number | null;
|
|
39
|
+
height: number | null;
|
|
40
|
+
value: string;
|
|
41
|
+
isShow: boolean;
|
|
42
|
+
};
|
|
43
|
+
hl?: {
|
|
44
|
+
r: number;
|
|
45
|
+
c: number;
|
|
46
|
+
id: string;
|
|
47
|
+
};
|
|
48
|
+
error?: import('@fileverse-dev/fortune-core').CellError;
|
|
49
|
+
bl?: number;
|
|
50
|
+
it?: number;
|
|
51
|
+
ff?: number | string;
|
|
52
|
+
fs?: number;
|
|
53
|
+
fc?: string;
|
|
54
|
+
ht?: number;
|
|
55
|
+
vt?: number;
|
|
56
|
+
tb?: string;
|
|
57
|
+
cl?: number;
|
|
58
|
+
un?: number;
|
|
59
|
+
tr?: string;
|
|
60
|
+
};
|
|
61
|
+
export declare const isNumValue: (v: any) => boolean;
|
|
62
|
+
export declare const cloneInlineStyles: (styles: any) => any;
|
|
63
|
+
export declare const buildCellFormat: (value: any, existingCt: Cell["ct"]) => {
|
|
64
|
+
t: string;
|
|
65
|
+
fa: string;
|
|
66
|
+
} | {
|
|
67
|
+
t: string;
|
|
68
|
+
fa: string;
|
|
69
|
+
s: any;
|
|
70
|
+
};
|
|
71
|
+
export declare const preserveTextColorFromInlineStyle: (existing: any, nextIsNum: boolean) => {
|
|
72
|
+
fc?: undefined;
|
|
73
|
+
} | {
|
|
74
|
+
fc: any;
|
|
75
|
+
};
|
|
76
|
+
export declare const cloneCellStyles: (cell: Cell) => {
|
|
77
|
+
v?: string | number | boolean;
|
|
78
|
+
m?: string | number;
|
|
79
|
+
mc?: {
|
|
80
|
+
r: number;
|
|
81
|
+
c: number;
|
|
82
|
+
rs?: number;
|
|
83
|
+
cs?: number;
|
|
84
|
+
};
|
|
85
|
+
f?: string;
|
|
86
|
+
ct?: {
|
|
87
|
+
fa?: string;
|
|
88
|
+
t?: string;
|
|
89
|
+
s?: any;
|
|
90
|
+
};
|
|
91
|
+
qp?: number;
|
|
92
|
+
spl?: any;
|
|
93
|
+
bg?: string;
|
|
94
|
+
lo?: number;
|
|
95
|
+
rt?: number;
|
|
96
|
+
baseValue?: number | string;
|
|
97
|
+
baseCurrency?: string;
|
|
98
|
+
baseCurrencyPrice?: string | number;
|
|
99
|
+
isDataBlockFormula?: boolean;
|
|
100
|
+
ps?: {
|
|
101
|
+
left: number | null;
|
|
102
|
+
top: number | null;
|
|
103
|
+
width: number | null;
|
|
104
|
+
height: number | null;
|
|
105
|
+
value: string;
|
|
106
|
+
isShow: boolean;
|
|
107
|
+
};
|
|
108
|
+
hl?: {
|
|
109
|
+
r: number;
|
|
110
|
+
c: number;
|
|
111
|
+
id: string;
|
|
112
|
+
};
|
|
113
|
+
error?: import('@fileverse-dev/fortune-core').CellError;
|
|
114
|
+
bl?: number;
|
|
115
|
+
it?: number;
|
|
116
|
+
ff?: number | string;
|
|
117
|
+
fs?: number;
|
|
118
|
+
fc?: string;
|
|
119
|
+
ht?: number;
|
|
120
|
+
vt?: number;
|
|
121
|
+
tb?: string;
|
|
122
|
+
cl?: number;
|
|
123
|
+
un?: number;
|
|
124
|
+
tr?: string;
|
|
125
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
interface FormulaCell {
|
|
2
|
+
formulaName: string;
|
|
3
|
+
row: number;
|
|
4
|
+
column: number;
|
|
5
|
+
rowRefrenced: number[];
|
|
6
|
+
columnRefrenced: number[];
|
|
7
|
+
}
|
|
8
|
+
interface FormulaCells {
|
|
9
|
+
[key: string]: FormulaCell;
|
|
10
|
+
}
|
|
11
|
+
export declare function updateRowIndices(data: FormulaCells, sourceIndex: number, targetIndex: number): FormulaCells;
|
|
12
|
+
interface FormulaCell {
|
|
13
|
+
formulaName: string;
|
|
14
|
+
row: number;
|
|
15
|
+
column: number;
|
|
16
|
+
rowRefrenced: number[];
|
|
17
|
+
columnRefrenced: number[];
|
|
18
|
+
}
|
|
19
|
+
export declare function updateColumnIndices(data: FormulaCells, sourceIndex: number, targetIndex: number): FormulaCells;
|
|
20
|
+
export {};
|