@fileverse-dev/dsheet 0.0.14 → 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 +18165 -17975
- package/dist/package/components/onboarding.d.ts +4 -0
- package/dist/package/dsheet-editor.d.ts +2 -2
- 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 +15 -3
- package/dist/package/use-dsheet-editor.d.ts +5 -2
- 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,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,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,11 +1,20 @@
|
|
|
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;
|
|
@@ -15,4 +24,7 @@ export interface DsheetProp {
|
|
|
15
24
|
selectedTemplate?: string;
|
|
16
25
|
setForceSheetRender?: React.Dispatch<React.SetStateAction<number>>;
|
|
17
26
|
toggleTemplateSidebar?: () => void;
|
|
27
|
+
initialTitle?: string;
|
|
28
|
+
onTitleChange?: (title: string) => void;
|
|
29
|
+
sheetEditorRef?: RefObject<WorkbookInstance>;
|
|
18
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
|
};
|
|
@@ -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[];
|