@fileverse-dev/dsheet 1.2.92 → 1.2.93-ydoc

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.
@@ -3,6 +3,7 @@ import { ERROR_MESSAGES_FLAG as ErrorMessagesFlagType, SERVICES_API_KEY as Servi
3
3
  export declare const ERROR_MESSAGES_FLAG: ErrorMessagesFlagType;
4
4
  export declare const SERVICES_API_KEY: ServicesApiKeyType;
5
5
  export declare const DEFAULT_SHEET_DATA: {
6
+ id: string;
6
7
  name: string;
7
8
  celldata: never[];
8
9
  config: {};
@@ -5,6 +5,7 @@ import { DataBlockApiKeyHandlerType, SheetUpdateData } from '../types';
5
5
 
6
6
  import * as Y from 'yjs';
7
7
  export interface EditorContextType {
8
+ handleOnChangePortalUpdate: (data: any[]) => void;
8
9
  setSelectedTemplate?: React.Dispatch<React.SetStateAction<string>>;
9
10
  setShowSmartContractModal?: React.Dispatch<React.SetStateAction<boolean>>;
10
11
  getDocumentTitle?: () => string;
@@ -0,0 +1,17 @@
1
+ import { WorkbookInstance } from '@fileverse-dev/fortune-react';
2
+
3
+ import * as Y from 'yjs';
4
+ /**
5
+ * Verifies the integrity of sheet data in a YDoc against a given sheet editor instance.
6
+ * This function is used to verify that the sheet data in a YDoc matches the data in a sheet editor instance.
7
+ * @param {Object} options
8
+ * @param {React.RefObject<WorkbookInstance | null>} options.sheetEditorRef - Reference to the sheet editor instance
9
+ * @param {React.RefObject<Y.Doc | null>} options.ydocRef - Reference to the YDoc instance
10
+ * @returns {void}
11
+ */
12
+ export declare const calcChainYdocUpdate: ({ sheetEditorRef, ydocRef, dsheetId, handleContentPortal }: {
13
+ sheetEditorRef: React.RefObject<WorkbookInstance | null>;
14
+ ydocRef: React.RefObject<Y.Doc | null>;
15
+ dsheetId: string;
16
+ handleContentPortal?: any;
17
+ }) => void;
@@ -0,0 +1,17 @@
1
+ import { WorkbookInstance } from '@fileverse-dev/fortune-react';
2
+
3
+ import * as Y from 'yjs';
4
+ /**
5
+ * Verifies the integrity of sheet data in a YDoc against a given sheet editor instance.
6
+ * This function is used to verify that the sheet data in a YDoc matches the data in a sheet editor instance.
7
+ * @param {Object} options
8
+ * @param {React.RefObject<WorkbookInstance | null>} options.sheetEditorRef - Reference to the sheet editor instance
9
+ * @param {React.RefObject<Y.Doc | null>} options.ydocRef - Reference to the YDoc instance
10
+ * @returns {void}
11
+ */
12
+ export declare const conditionFormatYdocUpdate: ({ sheetEditorRef, ydocRef, dsheetId, handleContentPortal }: {
13
+ sheetEditorRef: React.RefObject<WorkbookInstance | null>;
14
+ ydocRef: React.RefObject<Y.Doc | null>;
15
+ dsheetId: string;
16
+ handleContentPortal?: any;
17
+ }) => void;
@@ -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.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;
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) => void;
@@ -2,12 +2,13 @@ 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';
5
- export declare const getCustomToolbarItems: ({ setShowSmartContractModal, setExportDropdownOpen, handleCSVUpload, handleXLSXUpload, handleExportToXLSX, handleExportToCSV, handleExportToJSON, sheetEditorRef, ydocRef, dsheetId, currentDataRef, setForceSheetRender, toggleTemplateSidebar, getDocumentTitle, updateDocumentTitle, }: {
5
+ export declare const getCustomToolbarItems: ({ handleContentPortal, setShowSmartContractModal, setExportDropdownOpen, handleCSVUpload, handleXLSXUpload, handleExportToXLSX, handleExportToCSV, handleExportToJSON, sheetEditorRef, ydocRef, dsheetId, currentDataRef, setForceSheetRender, toggleTemplateSidebar, getDocumentTitle, updateDocumentTitle, }: {
6
+ handleContentPortal?: any;
6
7
  setShowSmartContractModal?: React.Dispatch<React.SetStateAction<boolean>>;
7
8
  getDocumentTitle?: () => string;
8
9
  updateDocumentTitle?: (title: string) => void;
9
10
  setExportDropdownOpen: React.Dispatch<React.SetStateAction<boolean>>;
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
+ 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, handleContentPortal?: any) => void;
11
12
  handleXLSXUpload: (event: ChangeEventHandler<HTMLInputElement> | undefined, file?: File, importType?: string) => void;
12
13
  handleExportToXLSX: (sheetEditorRef: React.RefObject<WorkbookInstance | null>, ydocRef: React.RefObject<Y.Doc | null>, dsheetId: string, getDocumentTitle?: () => string) => void;
13
14
  handleExportToCSV: (sheetEditorRef: React.RefObject<WorkbookInstance | null>, ydocRef: React.RefObject<Y.Doc | null>, dsheetId: string) => void;
@@ -0,0 +1,18 @@
1
+ import { WorkbookInstance } from '@fileverse-dev/fortune-react';
2
+
3
+ import * as Y from 'yjs';
4
+ /**
5
+ * Verifies the integrity of sheet data in a YDoc against a given sheet editor instance.
6
+ * This function is used to verify that the sheet data in a YDoc matches the data in a sheet editor instance.
7
+ * @param {Object} options
8
+ * @param {React.RefObject<WorkbookInstance | null>} options.sheetEditorRef - Reference to the sheet editor instance
9
+ * @param {React.RefObject<Y.Doc | null>} options.ydocRef - Reference to the YDoc instance
10
+ * @returns {void}
11
+ */
12
+ export declare const dataBlockListYdocUpdate: ({ sheetEditorRef, ydocRef, dsheetId, handleContentPortal, dataBlockCalcFunction }: {
13
+ sheetEditorRef: React.RefObject<WorkbookInstance | null>;
14
+ ydocRef: React.RefObject<Y.Doc | null>;
15
+ dsheetId: string;
16
+ handleContentPortal?: any;
17
+ dataBlockCalcFunction?: any;
18
+ }) => void;
@@ -0,0 +1,17 @@
1
+ import { WorkbookInstance } from '@fileverse-dev/fortune-react';
2
+
3
+ import * as Y from 'yjs';
4
+ /**
5
+ * Verifies the integrity of sheet data in a YDoc against a given sheet editor instance.
6
+ * This function is used to verify that the sheet data in a YDoc matches the data in a sheet editor instance.
7
+ * @param {Object} options
8
+ * @param {React.RefObject<WorkbookInstance | null>} options.sheetEditorRef - Reference to the sheet editor instance
9
+ * @param {React.RefObject<Y.Doc | null>} options.ydocRef - Reference to the YDoc instance
10
+ * @returns {void}
11
+ */
12
+ export declare const dataVerificationYdocUpdate: ({ sheetEditorRef, ydocRef, dsheetId, handleContentPortal }: {
13
+ sheetEditorRef: React.RefObject<WorkbookInstance | null>;
14
+ ydocRef: React.RefObject<Y.Doc | null>;
15
+ dsheetId: string;
16
+ handleContentPortal?: any;
17
+ }) => void;
@@ -1,9 +1,35 @@
1
- import { Sheet } from '@fileverse-dev/fortune-react';
2
-
3
1
  /**
4
2
  * Compare two spreadsheets' cell data and images, checking if anything changed
5
3
  * @param {Array} oldSheets - Original sheets data
6
4
  * @param {Array} newSheets - New sheets data
7
5
  * @returns {boolean} - true if any cell data or images changed, false if identical
8
6
  */
9
- export declare function isSpreadsheetChanged(oldSheets: Sheet[], newSheets: Sheet[]): boolean;
7
+ type DiffChange<T> = {
8
+ from: T;
9
+ to: T;
10
+ };
11
+ type UpdatedItem<T> = {
12
+ key: string;
13
+ before: T;
14
+ after: T;
15
+ changes: Partial<Record<keyof T, DiffChange<any>>>;
16
+ };
17
+ type DiffResult<T> = {
18
+ added: T[];
19
+ removed: T[];
20
+ updated: UpdatedItem<T>[];
21
+ };
22
+ export declare function diffObjectArrays<T extends Record<string, any>>(oldArr: readonly T[], newArr: readonly T[], getKey?: (item: T) => string): DiffResult<T>;
23
+ type UpdatedEntry<T> = {
24
+ key: string;
25
+ before: T;
26
+ after: T;
27
+ changes: Partial<Record<keyof T, DiffChange<any>>>;
28
+ };
29
+ type ObjectDiffResult<T> = {
30
+ added: Record<string, T>;
31
+ removed: Record<string, T>;
32
+ updated: UpdatedEntry<T>[];
33
+ };
34
+ export declare function diffObjectMap<T extends Record<string, any>>(oldObj: Record<string, T>, newObj: Record<string, T>): ObjectDiffResult<T>;
35
+ export {};
@@ -0,0 +1,17 @@
1
+ import { WorkbookInstance } from '@fileverse-dev/fortune-react';
2
+
3
+ import * as Y from 'yjs';
4
+ /**
5
+ * Verifies the integrity of sheet data in a YDoc against a given sheet editor instance.
6
+ * This function is used to verify that the sheet data in a YDoc matches the data in a sheet editor instance.
7
+ * @param {Object} options
8
+ * @param {React.RefObject<WorkbookInstance | null>} options.sheetEditorRef - Reference to the sheet editor instance
9
+ * @param {React.RefObject<Y.Doc | null>} options.ydocRef - Reference to the YDoc instance
10
+ * @returns {void}
11
+ */
12
+ export declare const hyperlinkYdocUpdate: ({ sheetEditorRef, ydocRef, dsheetId, handleContentPortal }: {
13
+ sheetEditorRef: React.RefObject<WorkbookInstance | null>;
14
+ ydocRef: React.RefObject<Y.Doc | null>;
15
+ dsheetId: string;
16
+ handleContentPortal?: any;
17
+ }) => void;
@@ -0,0 +1,17 @@
1
+ import { WorkbookInstance } from '@fileverse-dev/fortune-react';
2
+
3
+ import * as Y from 'yjs';
4
+ /**
5
+ * Verifies the integrity of sheet data in a YDoc against a given sheet editor instance.
6
+ * This function is used to verify that the sheet data in a YDoc matches the data in a sheet editor instance.
7
+ * @param {Object} options
8
+ * @param {React.RefObject<WorkbookInstance | null>} options.sheetEditorRef - Reference to the sheet editor instance
9
+ * @param {React.RefObject<Y.Doc | null>} options.ydocRef - Reference to the YDoc instance
10
+ * @returns {void}
11
+ */
12
+ export declare const liveQueryListYdocUpdate: ({ sheetEditorRef, ydocRef, dsheetId, handleContentPortal }: {
13
+ sheetEditorRef: React.RefObject<WorkbookInstance | null>;
14
+ ydocRef: React.RefObject<Y.Doc | null>;
15
+ dsheetId: string;
16
+ handleContentPortal?: any;
17
+ }) => void;
@@ -0,0 +1,6 @@
1
+ import { Sheet } from '@fileverse-dev/fortune-react';
2
+ import * as Y from 'yjs';
3
+ export declare function migrateSheetArrayIfNeeded(ydoc: Y.Doc, sheetArray: Y.Array<any>): void;
4
+ type SheetFactory = () => Y.Map<any>;
5
+ export declare function migrateSheetFactoryForImport(sheet: Sheet | Y.Map<any>): SheetFactory;
6
+ export {};
@@ -0,0 +1,11 @@
1
+ import { Sheet, WorkbookInstance } from '@fileverse-dev/fortune-react';
2
+ import * as Y from 'yjs';
3
+ export type SheetChangePath = {
4
+ sheetId: string;
5
+ path: string[];
6
+ key?: string;
7
+ value: any;
8
+ type?: 'update' | 'delete';
9
+ };
10
+ export declare const updateYdocSheetData: (ydoc: Y.Doc | null, dsheetId: string, sheetEditor: WorkbookInstance | null, changes: SheetChangePath[], handleContentPortal: any) => void;
11
+ export declare function ySheetArrayToPlain(sheetArray: Y.Array<Y.Map>): Sheet[];
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@fileverse-dev/dsheet",
3
3
  "private": false,
4
4
  "description": "DSheet",
5
- "version": "1.2.92",
5
+ "version": "1.2.93-ydoc",
6
6
  "main": "dist/index.es.js",
7
7
  "module": "dist/index.es.js",
8
8
  "exports": {
@@ -35,7 +35,7 @@
35
35
  "dependencies": {
36
36
  "@fileverse-dev/dsheets-templates": "^0.0.29",
37
37
  "@fileverse-dev/formulajs": "^4.4.47",
38
- "@fileverse-dev/fortune-react": "^1.2.94",
38
+ "@fileverse-dev/fortune-react": "1.2.95-ydoc",
39
39
  "@fileverse/ui": "^5.0.0",
40
40
  "classnames": "^2.5.1",
41
41
  "exceljs": "^4.4.0",
@@ -1,9 +0,0 @@
1
- import { Sheet } from '@fileverse-dev/fortune-react';
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
- };
@@ -1,8 +0,0 @@
1
- import { Sheet, WorkbookInstance } from '@fileverse-dev/fortune-react';
2
- import * as Y from 'yjs';
3
- export declare const updateSheetData: (ydoc: Y.Doc | null, dsheetId: string, data: Sheet[], sheetEditor: WorkbookInstance | null, dataBlockCalcFunction?: {
4
- [key: string]: {
5
- [key: string]: any;
6
- };
7
- }, isReadOnly?: boolean) => void;
8
- export declare const formatSheetData: (data: Sheet[], preSheetArray: Sheet[], sheetEditor: WorkbookInstance) => Sheet[];