@fileverse-dev/dsheet 0.0.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/README.md +57 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +129005 -0
- package/dist/package/constant/shared-constant.d.ts +8 -0
- package/dist/package/dsheet-editor.d.ts +4 -0
- package/dist/package/types.d.ts +16 -0
- package/dist/package/use-dsheet-editor.d.ts +126 -0
- package/dist/package/utils/diffSheet.d.ts +9 -0
- package/dist/package/utils/handleFileImport.d.ts +1 -0
- package/dist/package/utils/updateSheetUI.d.ts +7 -0
- package/dist/style.css +1 -0
- package/dist/vite.svg +1 -0
- package/package.json +79 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Sheet } from '@fortune-sheet/core';
|
|
2
|
+
|
|
3
|
+
export interface DsheetProp {
|
|
4
|
+
renderNavbar: () => JSX.Element;
|
|
5
|
+
initialSheetData?: Sheet[];
|
|
6
|
+
enableIndexeddbSync?: boolean;
|
|
7
|
+
dsheetId?: string;
|
|
8
|
+
onChange?: (updatedSheetContent: string, updateChunk: string) => void;
|
|
9
|
+
username?: string;
|
|
10
|
+
enableWebrtc?: boolean;
|
|
11
|
+
portalContent?: any;
|
|
12
|
+
isReadOnly?: boolean;
|
|
13
|
+
isCollaborative?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export interface sheetEditorRef {
|
|
16
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { Sheet } from '@fortune-sheet/core';
|
|
2
|
+
import { DsheetProp } from './types';
|
|
3
|
+
|
|
4
|
+
export declare const useDsheetEditor: ({ initialSheetData, enableIndexeddbSync, dsheetId, onChange, username, enableWebrtc, portalContent, }: Partial<DsheetProp>) => {
|
|
5
|
+
sheetEditorRef: import('react').RefObject<{
|
|
6
|
+
applyOp: (ops: import('@fortune-sheet/core').Op[]) => void;
|
|
7
|
+
getCellValue: (row: number, column: number, options?: import('@fortune-sheet/core/dist/api').CommonOptions & {
|
|
8
|
+
type?: keyof import('@fortune-sheet/core').Cell;
|
|
9
|
+
}) => any;
|
|
10
|
+
setCellValue: (row: number, column: number, value: any, options?: import('@fortune-sheet/core/dist/api').CommonOptions & {
|
|
11
|
+
type?: keyof import('@fortune-sheet/core').Cell;
|
|
12
|
+
}) => void;
|
|
13
|
+
clearCell: (row: number, column: number, options?: import('@fortune-sheet/core/dist/api').CommonOptions) => void;
|
|
14
|
+
setCellFormat: (row: number, column: number, attr: keyof import('@fortune-sheet/core').Cell, value: any, options?: import('@fortune-sheet/core/dist/api').CommonOptions) => void;
|
|
15
|
+
autoFillCell: (copyRange: import('@fortune-sheet/core').SingleRange, applyRange: import('@fortune-sheet/core').SingleRange, direction: "up" | "down" | "left" | "right") => void;
|
|
16
|
+
freeze: (type: "row" | "column" | "both", range: {
|
|
17
|
+
row: number;
|
|
18
|
+
column: number;
|
|
19
|
+
}, options?: import('@fortune-sheet/core/dist/api').CommonOptions) => void;
|
|
20
|
+
insertRowOrColumn: (type: "row" | "column", index: number, count: number, direction?: "lefttop" | "rightbottom", options?: import('@fortune-sheet/core/dist/api').CommonOptions) => void;
|
|
21
|
+
deleteRowOrColumn: (type: "row" | "column", start: number, end: number, options?: import('@fortune-sheet/core/dist/api').CommonOptions) => void;
|
|
22
|
+
hideRowOrColumn: (rowOrColInfo: string[], type: "row" | "column") => void;
|
|
23
|
+
showRowOrColumn: (rowOrColInfo: string[], type: "row" | "column") => void;
|
|
24
|
+
setRowHeight: (rowInfo: Record<string, number>, options?: import('@fortune-sheet/core/dist/api').CommonOptions, custom?: boolean) => void;
|
|
25
|
+
setColumnWidth: (columnInfo: Record<string, number>, options?: import('@fortune-sheet/core/dist/api').CommonOptions, custom?: boolean) => void;
|
|
26
|
+
getRowHeight: (rows: number[], options?: import('@fortune-sheet/core/dist/api').CommonOptions) => Record<number, number>;
|
|
27
|
+
getColumnWidth: (columns: number[], options?: import('@fortune-sheet/core/dist/api').CommonOptions) => Record<number, number>;
|
|
28
|
+
getSelection: () => {
|
|
29
|
+
row: number[];
|
|
30
|
+
column: number[];
|
|
31
|
+
}[] | undefined;
|
|
32
|
+
getFlattenRange: (range: import('@fortune-sheet/core').Range) => {
|
|
33
|
+
r: number;
|
|
34
|
+
c: number;
|
|
35
|
+
}[];
|
|
36
|
+
getCellsByFlattenRange: (range?: {
|
|
37
|
+
r: number;
|
|
38
|
+
c: number;
|
|
39
|
+
}[] | undefined) => (import('@fortune-sheet/core').Cell | null)[];
|
|
40
|
+
getSelectionCoordinates: () => string[];
|
|
41
|
+
getCellsByRange: (range: import('@fortune-sheet/core').Selection, options?: import('@fortune-sheet/core/dist/api').CommonOptions) => (import('@fortune-sheet/core').Cell | null)[][];
|
|
42
|
+
getHtmlByRange: (range: import('@fortune-sheet/core').Range, options?: import('@fortune-sheet/core/dist/api').CommonOptions) => string | null;
|
|
43
|
+
setSelection: (range: import('@fortune-sheet/core').Range, options?: import('@fortune-sheet/core/dist/api').CommonOptions) => void;
|
|
44
|
+
setCellValuesByRange: (data: any[][], range: import('@fortune-sheet/core').SingleRange, options?: import('@fortune-sheet/core/dist/api').CommonOptions) => void;
|
|
45
|
+
setCellFormatByRange: (attr: keyof import('@fortune-sheet/core').Cell, value: any, range: import('@fortune-sheet/core').Range | import('@fortune-sheet/core').SingleRange, options?: import('@fortune-sheet/core/dist/api').CommonOptions) => void;
|
|
46
|
+
mergeCells: (ranges: import('@fortune-sheet/core').Range, type: string, options?: import('@fortune-sheet/core/dist/api').CommonOptions) => void;
|
|
47
|
+
cancelMerge: (ranges: import('@fortune-sheet/core').Range, options?: import('@fortune-sheet/core/dist/api').CommonOptions) => void;
|
|
48
|
+
getAllSheets: () => Sheet[];
|
|
49
|
+
getSheet: (options?: import('@fortune-sheet/core/dist/api').CommonOptions) => {
|
|
50
|
+
celldata: import('@fortune-sheet/core').CellWithRowAndCol[];
|
|
51
|
+
name: string;
|
|
52
|
+
config?: import('@fortune-sheet/core').SheetConfig | undefined;
|
|
53
|
+
order?: number | undefined;
|
|
54
|
+
color?: string | undefined;
|
|
55
|
+
data?: import('@fortune-sheet/core').CellMatrix | undefined;
|
|
56
|
+
id?: string | undefined;
|
|
57
|
+
images?: import('@fortune-sheet/core').Image[] | undefined;
|
|
58
|
+
zoomRatio?: number | undefined;
|
|
59
|
+
column?: number | undefined;
|
|
60
|
+
row?: number | undefined;
|
|
61
|
+
addRows?: number | undefined;
|
|
62
|
+
status?: number | undefined;
|
|
63
|
+
hide?: number | undefined;
|
|
64
|
+
luckysheet_select_save?: import('@fortune-sheet/core').Selection[] | undefined;
|
|
65
|
+
luckysheet_selection_range?: {
|
|
66
|
+
row: number[];
|
|
67
|
+
column: number[];
|
|
68
|
+
}[] | undefined;
|
|
69
|
+
calcChain?: any[] | undefined;
|
|
70
|
+
defaultRowHeight?: number | undefined;
|
|
71
|
+
defaultColWidth?: number | undefined;
|
|
72
|
+
showGridLines?: number | boolean | undefined;
|
|
73
|
+
pivotTable?: any;
|
|
74
|
+
isPivotTable?: boolean | undefined;
|
|
75
|
+
filter?: Record<string, any> | undefined;
|
|
76
|
+
filter_select?: {
|
|
77
|
+
row: number[];
|
|
78
|
+
column: number[];
|
|
79
|
+
} | undefined;
|
|
80
|
+
luckysheet_conditionformat_save?: any[] | undefined;
|
|
81
|
+
luckysheet_alternateformat_save?: any[] | undefined;
|
|
82
|
+
dataVerification?: any;
|
|
83
|
+
hyperlink?: Record<string, {
|
|
84
|
+
linkType: string;
|
|
85
|
+
linkAddress: string;
|
|
86
|
+
}> | undefined;
|
|
87
|
+
dynamicArray_compute?: any;
|
|
88
|
+
dynamicArray?: any[] | undefined;
|
|
89
|
+
frozen?: {
|
|
90
|
+
type: "row" | "column" | "both" | "rangeRow" | "rangeColumn" | "rangeBoth";
|
|
91
|
+
range?: {
|
|
92
|
+
row_focus: number;
|
|
93
|
+
column_focus: number;
|
|
94
|
+
} | undefined;
|
|
95
|
+
} | undefined;
|
|
96
|
+
};
|
|
97
|
+
addSheet: () => void;
|
|
98
|
+
deleteSheet: (options?: import('@fortune-sheet/core/dist/api').CommonOptions) => void;
|
|
99
|
+
updateSheet: (data: Sheet[]) => void;
|
|
100
|
+
activateSheet: (options?: import('@fortune-sheet/core/dist/api').CommonOptions) => void;
|
|
101
|
+
setSheetName: (name: string, options?: import('@fortune-sheet/core/dist/api').CommonOptions) => void;
|
|
102
|
+
setSheetOrder: (orderList: Record<string, number>) => void;
|
|
103
|
+
scroll: (options: {
|
|
104
|
+
scrollLeft?: number;
|
|
105
|
+
scrollTop?: number;
|
|
106
|
+
targetRow?: number;
|
|
107
|
+
targetColumn?: number;
|
|
108
|
+
}) => void;
|
|
109
|
+
addPresences: (newPresences: import('@fortune-sheet/core').Presence[]) => void;
|
|
110
|
+
removePresences: (arr: {
|
|
111
|
+
username: string;
|
|
112
|
+
userId?: string;
|
|
113
|
+
}[]) => void;
|
|
114
|
+
handleUndo: () => void;
|
|
115
|
+
handleRedo: () => void;
|
|
116
|
+
calculateFormula: () => void;
|
|
117
|
+
dataToCelldata: (data: import('@fortune-sheet/core').CellMatrix | undefined) => import('@fortune-sheet/core').CellWithRowAndCol[];
|
|
118
|
+
celldataToData: (celldata: import('@fortune-sheet/core').CellWithRowAndCol[], rowCount?: number | undefined, colCount?: number | undefined) => import('@fortune-sheet/core').CellMatrix | null;
|
|
119
|
+
}>;
|
|
120
|
+
handleChange: (data: Sheet[]) => void;
|
|
121
|
+
currentDataRef: import('react').MutableRefObject<Sheet[] | null>;
|
|
122
|
+
sheetData: Sheet[] | null;
|
|
123
|
+
loading: boolean;
|
|
124
|
+
setSheetData: import('react').Dispatch<import('react').SetStateAction<Sheet[] | null>>;
|
|
125
|
+
handleFileUpload: (event: React.ChangeEvent<HTMLInputElement>) => Promise<void>;
|
|
126
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Sheet } from '@fortune-sheet/core';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Compare two spreadsheets' cell data and check if anything changed
|
|
5
|
+
* @param {Array} oldSheets - Original sheets data
|
|
6
|
+
* @param {Array} newSheets - New sheets data
|
|
7
|
+
* @returns {boolean} - true if any cell data changed, false if identical
|
|
8
|
+
*/
|
|
9
|
+
export declare function isSpreadsheetChanged(oldSheets: Sheet[], newSheets: Sheet[]): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const handleFileUploadUtil: (event: React.ChangeEvent<HTMLInputElement>) => Promise<any>;
|