@fileverse-dev/dsheet 0.0.13 → 0.0.15
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.es.js +19756 -19448
- package/dist/package/components/import-button-ui.d.ts +2 -1
- package/dist/package/components/onboarding.d.ts +4 -0
- package/dist/package/dsheet-editor.d.ts +2 -2
- package/dist/package/hooks/use-document-style.d.ts +1 -0
- package/dist/package/hooks/use-sheet-data.d.ts +9 -0
- package/dist/package/hooks/use-webrtc-connection.d.ts +7 -0
- package/dist/package/hooks/use-yjs-document.d.ts +6 -0
- package/dist/package/types.d.ts +16 -3
- package/dist/package/use-dsheet-editor.d.ts +5 -2
- package/dist/package/utils/custom-toolbar-item.d.ts +4 -8
- package/dist/package/utils/sheet-operations.d.ts +5 -0
- package/dist/style.css +1 -1
- package/package.json +2 -2
- package/dist/package/utils/update-sheet-ui.d.ts +0 -7
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ChangeEventHandler } from 'react';
|
|
2
2
|
|
|
3
|
-
export declare const CustomButton: ({ handleCSVUpload, handleXLSXUpload, handleExportToXLSX, handleExportToCSV, handleExportToJSON, }: {
|
|
3
|
+
export declare const CustomButton: ({ setExportDropdownOpen, handleCSVUpload, handleXLSXUpload, handleExportToXLSX, handleExportToCSV, handleExportToJSON, }: {
|
|
4
|
+
setExportDropdownOpen: React.Dispatch<React.SetStateAction<boolean>>;
|
|
4
5
|
handleCSVUpload: ChangeEventHandler<HTMLInputElement>;
|
|
5
6
|
handleXLSXUpload: ChangeEventHandler<HTMLInputElement>;
|
|
6
7
|
handleExportToXLSX: () => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DsheetProps } from './types';
|
|
2
2
|
|
|
3
|
-
declare const SpreadsheetEditor:
|
|
3
|
+
declare const SpreadsheetEditor: ({ isCollaborative, isReadOnly, renderNavbar, initialSheetData, enableIndexeddbSync, dsheetId, portalContent, onChange, username, selectedTemplate, toggleTemplateSidebar, isTemplateOpen, initialTitle, onTitleChange, enableWebrtc, sheetEditorRef: externalSheetEditorRef, }: DsheetProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
export default SpreadsheetEditor;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useFortuneDocumentStyle: (exportDropdownOpen: boolean, isTemplateOpen: boolean | undefined) => void;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Sheet } from '@fileverse-dev/fortune-core';
|
|
2
|
+
import { SheetUpdateData } from '../types';
|
|
3
|
+
import * as Y from 'yjs';
|
|
4
|
+
export declare const useSheetData: (ydoc: Y.Doc | null, dsheetId: string, onChange?: (updateData: SheetUpdateData, encodedUpdate?: string) => void) => {
|
|
5
|
+
sheetData: Sheet[] | null;
|
|
6
|
+
setSheetData: import('react').Dispatch<import('react').SetStateAction<Sheet[] | null>>;
|
|
7
|
+
currentDataRef: import('react').MutableRefObject<Sheet[] | null>;
|
|
8
|
+
remoteUpdateRef: import('react').MutableRefObject<boolean>;
|
|
9
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { WebsocketProvider } from 'y-websocket';
|
|
2
|
+
import { Awareness } from 'y-protocols/awareness';
|
|
3
|
+
import * as Y from 'yjs';
|
|
4
|
+
export declare const useWebRTCConnection: (ydoc: Y.Doc | null, dsheetId: string, username: string, enableWebrtc: boolean, portalContent: string) => {
|
|
5
|
+
webrtcProviderRef: import('react').MutableRefObject<WebsocketProvider | null>;
|
|
6
|
+
awarenessRef: import('react').MutableRefObject<Awareness | null>;
|
|
7
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { IndexeddbPersistence } from 'y-indexeddb';
|
|
2
|
+
import * as Y from 'yjs';
|
|
3
|
+
export declare const useYjsDocument: (dsheetId: string, enableIndexeddbSync: boolean) => {
|
|
4
|
+
ydocRef: import('react').MutableRefObject<Y.Doc | null>;
|
|
5
|
+
persistenceRef: import('react').MutableRefObject<IndexeddbPersistence | null>;
|
|
6
|
+
};
|
package/dist/package/types.d.ts
CHANGED
|
@@ -1,17 +1,30 @@
|
|
|
1
1
|
import { Sheet } from '@fileverse-dev/fortune-core';
|
|
2
|
+
import { RefObject } from 'react';
|
|
3
|
+
import { WorkbookInstance } from '@fileverse-dev/fortune-react';
|
|
2
4
|
|
|
3
|
-
export interface
|
|
4
|
-
|
|
5
|
+
export interface SheetUpdateData {
|
|
6
|
+
data: Sheet[];
|
|
7
|
+
title?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface DsheetProps {
|
|
10
|
+
renderNavbar?: (props?: {
|
|
11
|
+
title: string;
|
|
12
|
+
onTitleChange: (title: string) => void;
|
|
13
|
+
}) => JSX.Element;
|
|
5
14
|
initialSheetData?: Sheet[];
|
|
6
15
|
enableIndexeddbSync?: boolean;
|
|
7
16
|
dsheetId: string;
|
|
8
|
-
onChange?: (
|
|
17
|
+
onChange?: (updateData: SheetUpdateData, encodedUpdate?: string) => void;
|
|
9
18
|
username?: string;
|
|
10
19
|
enableWebrtc?: boolean;
|
|
11
20
|
portalContent?: string;
|
|
12
21
|
isReadOnly?: boolean;
|
|
22
|
+
isTemplateOpen?: boolean;
|
|
13
23
|
isCollaborative?: boolean;
|
|
14
24
|
selectedTemplate?: string;
|
|
15
25
|
setForceSheetRender?: React.Dispatch<React.SetStateAction<number>>;
|
|
16
26
|
toggleTemplateSidebar?: () => void;
|
|
27
|
+
initialTitle?: string;
|
|
28
|
+
onTitleChange?: (title: string) => void;
|
|
29
|
+
sheetEditorRef?: RefObject<WorkbookInstance>;
|
|
17
30
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Sheet } from '@fileverse-dev/fortune-core';
|
|
2
|
-
import {
|
|
2
|
+
import { DsheetProps } from './types';
|
|
3
|
+
|
|
3
4
|
import * as Y from 'yjs';
|
|
4
|
-
export declare const useDsheetEditor: ({
|
|
5
|
+
export declare const useDsheetEditor: ({ enableIndexeddbSync, dsheetId, onChange, username, enableWebrtc, portalContent, initialTitle, sheetEditorRef: externalSheetEditorRef, initialSheetData, setForceSheetRender, }: Partial<DsheetProps>) => {
|
|
5
6
|
sheetEditorRef: import('react').RefObject<{
|
|
6
7
|
applyOp: (ops: import('@fileverse-dev/fortune-core').Op[]) => void;
|
|
7
8
|
getCellValue: (row: number, column: number, options?: import('@fileverse-dev/fortune-core/dist/api').CommonOptions & {
|
|
@@ -123,4 +124,6 @@ export declare const useDsheetEditor: ({ initialSheetData, enableIndexeddbSync,
|
|
|
123
124
|
loading: boolean;
|
|
124
125
|
ydocRef: import('react').MutableRefObject<Y.Doc | null>;
|
|
125
126
|
setSheetData: import('react').Dispatch<import('react').SetStateAction<Sheet[] | null>>;
|
|
127
|
+
title: string;
|
|
128
|
+
handleTitleChange: (newTitle: string) => void;
|
|
126
129
|
};
|
|
@@ -2,7 +2,8 @@ import { default as React, ChangeEvent } from 'react';
|
|
|
2
2
|
import { WorkbookInstance } from '@fileverse-dev/fortune-react';
|
|
3
3
|
|
|
4
4
|
import * as Y from 'yjs';
|
|
5
|
-
export declare const getCustomToolbarItems: ({ handleCSVUpload, handleXLSXUpload, handleExportToXLSX, handleExportToCSV, handleExportToJSON, sheetEditorRef, ydocRef, dsheetId, currentDataRef, setForceSheetRender, toggleTemplateSidebar, }: {
|
|
5
|
+
export declare const getCustomToolbarItems: ({ setExportDropdownOpen, handleCSVUpload, handleXLSXUpload, handleExportToXLSX, handleExportToCSV, handleExportToJSON, sheetEditorRef, ydocRef, dsheetId, currentDataRef, setForceSheetRender, toggleTemplateSidebar, }: {
|
|
6
|
+
setExportDropdownOpen: React.Dispatch<React.SetStateAction<boolean>>;
|
|
6
7
|
handleCSVUpload: (event: ChangeEvent<HTMLInputElement>, ydocRef: Y.Doc | null, setForceSheetRender: React.Dispatch<React.SetStateAction<number>>, dsheetId: string, currentDataRef: React.MutableRefObject<object | null>) => void;
|
|
7
8
|
handleXLSXUpload: React.ChangeEventHandler<HTMLInputElement>;
|
|
8
9
|
handleExportToXLSX: (sheetEditorRef: React.RefObject<WorkbookInstance | null>, ydocRef: React.RefObject<Y.Doc | null>, dsheetId: string) => void;
|
|
@@ -14,14 +15,9 @@ export declare const getCustomToolbarItems: ({ handleCSVUpload, handleXLSXUpload
|
|
|
14
15
|
currentDataRef: React.MutableRefObject<object | null>;
|
|
15
16
|
setForceSheetRender: React.Dispatch<React.SetStateAction<number>>;
|
|
16
17
|
toggleTemplateSidebar: (() => void) | undefined;
|
|
17
|
-
}) =>
|
|
18
|
-
key: string;
|
|
19
|
-
tooltip: string;
|
|
20
|
-
icon: import("react/jsx-runtime").JSX.Element;
|
|
21
|
-
onClick?: undefined;
|
|
22
|
-
} | {
|
|
18
|
+
}) => {
|
|
23
19
|
key: string;
|
|
24
20
|
tooltip: string;
|
|
25
21
|
icon: import("react/jsx-runtime").JSX.Element;
|
|
26
22
|
onClick: (() => void) | undefined;
|
|
27
|
-
}
|
|
23
|
+
}[];
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Sheet } from '@fileverse-dev/fortune-core';
|
|
2
|
+
import { WorkbookInstance } from '@fileverse-dev/fortune-react';
|
|
3
|
+
import * as Y from 'yjs';
|
|
4
|
+
export declare const updateSheetData: (ydoc: Y.Doc | null, dsheetId: string, data: Sheet[], sheetEditor: WorkbookInstance | null) => void;
|
|
5
|
+
export declare const formatSheetData: (data: Sheet[], preSheetArray: Sheet[], sheetEditor: WorkbookInstance) => Sheet[];
|