@leankylin-sheet/react 0.3.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 +19 -0
- package/dist/components/ChangeColor/index.d.ts +7 -0
- package/dist/components/ConditionFormat/ConditionRules.d.ts +6 -0
- package/dist/components/ConditionFormat/index.d.ts +7 -0
- package/dist/components/ContextMenu/Divider.d.ts +3 -0
- package/dist/components/ContextMenu/FilterMenu.d.ts +3 -0
- package/dist/components/ContextMenu/Menu.d.ts +8 -0
- package/dist/components/ContextMenu/SheetTab.d.ts +4 -0
- package/dist/components/ContextMenu/index.d.ts +4 -0
- package/dist/components/CustomSort/index.d.ts +4 -0
- package/dist/components/DataVerification/DropdownList.d.ts +4 -0
- package/dist/components/DataVerification/RangeDialog.d.ts +4 -0
- package/dist/components/DataVerification/index.d.ts +4 -0
- package/dist/components/Dialog/index.d.ts +12 -0
- package/dist/components/FilterOption/index.d.ts +5 -0
- package/dist/components/FormatSearch/index.d.ts +6 -0
- package/dist/components/FormulaSearch/index.d.ts +5 -0
- package/dist/components/FxEditor/NameBox.d.ts +3 -0
- package/dist/components/FxEditor/index.d.ts +4 -0
- package/dist/components/ImgBoxs/index.d.ts +3 -0
- package/dist/components/LinkEidtCard/index.d.ts +5 -0
- package/dist/components/LocationCondition/index.d.ts +3 -0
- package/dist/components/MessageBox/index.d.ts +9 -0
- package/dist/components/NotationBoxes/index.d.ts +3 -0
- package/dist/components/SVGDefines.d.ts +3 -0
- package/dist/components/SVGIcon.d.ts +9 -0
- package/dist/components/SearchReplace/index.d.ts +6 -0
- package/dist/components/Sheet/index.d.ts +8 -0
- package/dist/components/SheetList/SheetHiddenButton.d.ts +8 -0
- package/dist/components/SheetList/SheetListItem.d.ts +9 -0
- package/dist/components/SheetList/index.d.ts +4 -0
- package/dist/components/SheetOverlay/ColumnHeader.d.ts +3 -0
- package/dist/components/SheetOverlay/ContentEditable.d.ts +11 -0
- package/dist/components/SheetOverlay/FormulaHint/index.d.ts +4 -0
- package/dist/components/SheetOverlay/FormulaSearch/index.d.ts +4 -0
- package/dist/components/SheetOverlay/InputBox.d.ts +3 -0
- package/dist/components/SheetOverlay/RowHeader.d.ts +3 -0
- package/dist/components/SheetOverlay/ScrollBar/index.d.ts +7 -0
- package/dist/components/SheetOverlay/index.d.ts +4 -0
- package/dist/components/SheetTab/SheetItem.d.ts +8 -0
- package/dist/components/SheetTab/index.d.ts +4 -0
- package/dist/components/SplitColumn/index.d.ts +3 -0
- package/dist/components/Toolbar/Button.d.ts +11 -0
- package/dist/components/Toolbar/ColorPicker.d.ts +6 -0
- package/dist/components/Toolbar/Combo.d.ts +10 -0
- package/dist/components/Toolbar/CustomBorder.d.ts +7 -0
- package/dist/components/Toolbar/CustomButton.d.ts +11 -0
- package/dist/components/Toolbar/CustomColor.d.ts +8 -0
- package/dist/components/Toolbar/CustomIcon.d.ts +9 -0
- package/dist/components/Toolbar/Divider.d.ts +4 -0
- package/dist/components/Toolbar/MoreItemsContainer.d.ts +6 -0
- package/dist/components/Toolbar/Select.d.ts +14 -0
- package/dist/components/Toolbar/index.d.ts +7 -0
- package/dist/components/Workbook/api.d.ts +115 -0
- package/dist/components/Workbook/index.d.ts +123 -0
- package/dist/components/ZoomControl/index.d.ts +4 -0
- package/dist/components/index.d.ts +3 -0
- package/dist/context/index.d.ts +25 -0
- package/dist/context/modal.d.ts +10 -0
- package/dist/hooks/useAlert.d.ts +4 -0
- package/dist/hooks/useDialog.d.ts +5 -0
- package/dist/hooks/useOutsideClick.d.ts +2 -0
- package/dist/hooks/usePrevious.d.ts +2 -0
- package/dist/index.css +3395 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.esm.css +3395 -0
- package/dist/index.esm.js +10841 -0
- package/dist/index.js +10851 -0
- package/dist/index.umd.css +3395 -0
- package/dist/index.umd.js +45440 -0
- package/dist/index.umd.min.css +1 -0
- package/dist/index.umd.min.js +9 -0
- package/package.json +41 -0
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { Settings, CellWithRowAndCol, Sheet as SheetType, Op, CellMatrix } from "@leankylin-sheet/core";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import "./index.css";
|
|
4
|
+
import { generateAPIs } from "./api";
|
|
5
|
+
export type WorkbookInstance = ReturnType<typeof generateAPIs>;
|
|
6
|
+
type AdditionalProps = {
|
|
7
|
+
onChange?: (data: SheetType[]) => void;
|
|
8
|
+
onOp?: (op: Op[]) => void;
|
|
9
|
+
};
|
|
10
|
+
declare const Workbook: React.ForwardRefExoticComponent<Settings & AdditionalProps & React.RefAttributes<{
|
|
11
|
+
applyOp: (ops: Op[]) => void;
|
|
12
|
+
getCellValue: (row: number, column: number, options?: import("@leankylin-sheet/core/dist/api").CommonOptions & {
|
|
13
|
+
type?: "v" | "m" | "mc" | "f" | "ct" | "qp" | "spl" | "bg" | "lo" | "rt" | "ps" | "hl" | keyof import("@leankylin-sheet/core").CellStyle | undefined;
|
|
14
|
+
}) => any;
|
|
15
|
+
setCellValue: (row: number, column: number, value: any, options?: import("@leankylin-sheet/core/dist/api").CommonOptions & {
|
|
16
|
+
type?: "v" | "m" | "mc" | "f" | "ct" | "qp" | "spl" | "bg" | "lo" | "rt" | "ps" | "hl" | keyof import("@leankylin-sheet/core").CellStyle | undefined;
|
|
17
|
+
}) => void;
|
|
18
|
+
clearCell: (row: number, column: number, options?: import("@leankylin-sheet/core/dist/api").CommonOptions) => void;
|
|
19
|
+
setCellFormat: (row: number, column: number, attr: "v" | "m" | "mc" | "f" | "ct" | "qp" | "spl" | "bg" | "lo" | "rt" | "ps" | "hl" | keyof import("@leankylin-sheet/core").CellStyle, value: any, options?: import("@leankylin-sheet/core/dist/api").CommonOptions) => void;
|
|
20
|
+
autoFillCell: (copyRange: import("@leankylin-sheet/core").SingleRange, applyRange: import("@leankylin-sheet/core").SingleRange, direction: "up" | "down" | "left" | "right") => void;
|
|
21
|
+
freeze: (type: "row" | "column" | "both", range: {
|
|
22
|
+
row: number;
|
|
23
|
+
column: number;
|
|
24
|
+
}, options?: import("@leankylin-sheet/core/dist/api").CommonOptions) => void;
|
|
25
|
+
insertRowOrColumn: (type: "row" | "column", index: number, count: number, direction?: "lefttop" | "rightbottom", options?: import("@leankylin-sheet/core/dist/api").CommonOptions) => void;
|
|
26
|
+
deleteRowOrColumn: (type: "row" | "column", start: number, end: number, options?: import("@leankylin-sheet/core/dist/api").CommonOptions) => void;
|
|
27
|
+
setRowHeight: (rowInfo: Record<string, number>, options?: import("@leankylin-sheet/core/dist/api").CommonOptions, custom?: boolean) => void;
|
|
28
|
+
setColumnWidth: (columnInfo: Record<string, number>, options?: import("@leankylin-sheet/core/dist/api").CommonOptions, custom?: boolean) => void;
|
|
29
|
+
getRowHeight: (rows: number[], options?: import("@leankylin-sheet/core/dist/api").CommonOptions) => Record<number, number>;
|
|
30
|
+
getColumnWidth: (columns: number[], options?: import("@leankylin-sheet/core/dist/api").CommonOptions) => Record<number, number>;
|
|
31
|
+
getSelection: () => {
|
|
32
|
+
row: number[];
|
|
33
|
+
column: number[];
|
|
34
|
+
}[] | undefined;
|
|
35
|
+
getFlattenRange: (range: import("@leankylin-sheet/core").Range) => {
|
|
36
|
+
r: number;
|
|
37
|
+
c: number;
|
|
38
|
+
}[];
|
|
39
|
+
getCellsByFlattenRange: (range?: {
|
|
40
|
+
r: number;
|
|
41
|
+
c: number;
|
|
42
|
+
}[] | undefined) => (import("@leankylin-sheet/core").Cell | null)[];
|
|
43
|
+
getSelectionCoordinates: () => string[];
|
|
44
|
+
getCellsByRange: (range: import("@leankylin-sheet/core").Selection, options?: import("@leankylin-sheet/core/dist/api").CommonOptions) => (import("@leankylin-sheet/core").Cell | null)[][];
|
|
45
|
+
getHtmlByRange: (range: import("@leankylin-sheet/core").Range, options?: import("@leankylin-sheet/core/dist/api").CommonOptions) => string | null;
|
|
46
|
+
setSelection: (range: import("@leankylin-sheet/core").Range, options?: import("@leankylin-sheet/core/dist/api").CommonOptions) => void;
|
|
47
|
+
setCellValuesByRange: (data: any[][], range: import("@leankylin-sheet/core").SingleRange, options?: import("@leankylin-sheet/core/dist/api").CommonOptions) => void;
|
|
48
|
+
setCellFormatByRange: (attr: "v" | "m" | "mc" | "f" | "ct" | "qp" | "spl" | "bg" | "lo" | "rt" | "ps" | "hl" | keyof import("@leankylin-sheet/core").CellStyle, value: any, range: import("@leankylin-sheet/core").SingleRange | import("@leankylin-sheet/core").Range, options?: import("@leankylin-sheet/core/dist/api").CommonOptions) => void;
|
|
49
|
+
mergeCells: (ranges: import("@leankylin-sheet/core").Range, type: string, options?: import("@leankylin-sheet/core/dist/api").CommonOptions) => void;
|
|
50
|
+
cancelMerge: (ranges: import("@leankylin-sheet/core").Range, options?: import("@leankylin-sheet/core/dist/api").CommonOptions) => void;
|
|
51
|
+
getAllSheets: () => SheetType[];
|
|
52
|
+
getSheet: (options?: import("@leankylin-sheet/core/dist/api").CommonOptions) => {
|
|
53
|
+
celldata: CellWithRowAndCol[];
|
|
54
|
+
name: string;
|
|
55
|
+
config?: import("@leankylin-sheet/core").SheetConfig | undefined;
|
|
56
|
+
order?: number | undefined;
|
|
57
|
+
color?: string | undefined;
|
|
58
|
+
data?: CellMatrix | undefined;
|
|
59
|
+
id?: string | undefined;
|
|
60
|
+
images?: import("@leankylin-sheet/core").Image[] | undefined;
|
|
61
|
+
zoomRatio?: number | undefined;
|
|
62
|
+
column?: number | undefined;
|
|
63
|
+
row?: number | undefined;
|
|
64
|
+
addRows?: number | undefined;
|
|
65
|
+
status?: number | undefined;
|
|
66
|
+
hide?: number | undefined;
|
|
67
|
+
luckysheet_select_save?: import("@leankylin-sheet/core").Selection[] | undefined;
|
|
68
|
+
luckysheet_selection_range?: {
|
|
69
|
+
row: number[];
|
|
70
|
+
column: number[];
|
|
71
|
+
}[] | undefined;
|
|
72
|
+
calcChain?: any[] | undefined;
|
|
73
|
+
defaultRowHeight?: number | undefined;
|
|
74
|
+
defaultColWidth?: number | undefined;
|
|
75
|
+
showGridLines?: number | boolean | undefined;
|
|
76
|
+
pivotTable?: any;
|
|
77
|
+
isPivotTable?: boolean | undefined;
|
|
78
|
+
filter?: Record<string, any> | undefined;
|
|
79
|
+
filter_select?: {
|
|
80
|
+
row: number[];
|
|
81
|
+
column: number[];
|
|
82
|
+
} | undefined;
|
|
83
|
+
luckysheet_conditionformat_save?: any[] | undefined;
|
|
84
|
+
luckysheet_alternateformat_save?: any[] | undefined;
|
|
85
|
+
dataVerification?: any;
|
|
86
|
+
hyperlink?: Record<string, {
|
|
87
|
+
linkType: string;
|
|
88
|
+
linkAddress: string;
|
|
89
|
+
}> | undefined;
|
|
90
|
+
dynamicArray_compute?: any;
|
|
91
|
+
dynamicArray?: any[] | undefined;
|
|
92
|
+
frozen?: {
|
|
93
|
+
type: "row" | "column" | "both" | "rangeRow" | "rangeColumn" | "rangeBoth";
|
|
94
|
+
range?: {
|
|
95
|
+
row_focus: number;
|
|
96
|
+
column_focus: number;
|
|
97
|
+
} | undefined;
|
|
98
|
+
} | undefined;
|
|
99
|
+
};
|
|
100
|
+
addSheet: () => void;
|
|
101
|
+
deleteSheet: (options?: import("@leankylin-sheet/core/dist/api").CommonOptions) => void;
|
|
102
|
+
updateSheet: (data: SheetType[]) => void;
|
|
103
|
+
activateSheet: (options?: import("@leankylin-sheet/core/dist/api").CommonOptions) => void;
|
|
104
|
+
setSheetName: (name: string, options?: import("@leankylin-sheet/core/dist/api").CommonOptions) => void;
|
|
105
|
+
setSheetOrder: (orderList: Record<string, number>) => void;
|
|
106
|
+
scroll: (options: {
|
|
107
|
+
scrollLeft?: number | undefined;
|
|
108
|
+
scrollTop?: number | undefined;
|
|
109
|
+
targetRow?: number | undefined;
|
|
110
|
+
targetColumn?: number | undefined;
|
|
111
|
+
}) => void;
|
|
112
|
+
addPresences: (newPresences: import("@leankylin-sheet/core").Presence[]) => void;
|
|
113
|
+
removePresences: (arr: {
|
|
114
|
+
username: string;
|
|
115
|
+
userId?: string | undefined;
|
|
116
|
+
}[]) => void;
|
|
117
|
+
handleUndo: () => void;
|
|
118
|
+
handleRedo: () => void;
|
|
119
|
+
calculateFormula: () => void;
|
|
120
|
+
dataToCelldata: (data: CellMatrix | undefined) => CellWithRowAndCol[];
|
|
121
|
+
celldataToData: (celldata: CellWithRowAndCol[], rowCount?: number | undefined, colCount?: number | undefined) => CellMatrix | null;
|
|
122
|
+
}>>;
|
|
123
|
+
export default Workbook;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Context, Settings, GlobalCache, PatchOptions } from "@leankylin-sheet/core";
|
|
3
|
+
export type RefValues = {
|
|
4
|
+
globalCache: GlobalCache;
|
|
5
|
+
cellInput: React.MutableRefObject<HTMLDivElement | null>;
|
|
6
|
+
fxInput: React.MutableRefObject<HTMLDivElement | null>;
|
|
7
|
+
canvas: React.MutableRefObject<HTMLCanvasElement | null>;
|
|
8
|
+
scrollbarX: React.MutableRefObject<HTMLDivElement | null>;
|
|
9
|
+
scrollbarY: React.MutableRefObject<HTMLDivElement | null>;
|
|
10
|
+
cellArea: React.MutableRefObject<HTMLDivElement | null>;
|
|
11
|
+
workbookContainer: React.MutableRefObject<HTMLDivElement | null>;
|
|
12
|
+
};
|
|
13
|
+
export type SetContextOptions = {
|
|
14
|
+
noHistory?: boolean;
|
|
15
|
+
logPatch?: boolean;
|
|
16
|
+
} & PatchOptions;
|
|
17
|
+
declare const WorkbookContext: React.Context<{
|
|
18
|
+
context: Context;
|
|
19
|
+
setContext: (recipe: (ctx: Context) => void, options?: SetContextOptions) => void;
|
|
20
|
+
settings: Required<Settings>;
|
|
21
|
+
refs: RefValues;
|
|
22
|
+
handleUndo: () => void;
|
|
23
|
+
handleRedo: () => void;
|
|
24
|
+
}>;
|
|
25
|
+
export default WorkbookContext;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
declare const ModalContext: React.Context<{
|
|
3
|
+
component: React.ReactNode;
|
|
4
|
+
showModal: (c: React.ReactNode) => void;
|
|
5
|
+
hideModal: () => void;
|
|
6
|
+
}>;
|
|
7
|
+
declare const ModalProvider: React.FC<{
|
|
8
|
+
children?: React.ReactNode;
|
|
9
|
+
}>;
|
|
10
|
+
export { ModalContext, ModalProvider };
|