@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
package/README.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# @leankylin-sheet/react
|
|
2
|
+
|
|
3
|
+
LeankylinSheet is a drop-in javascript spreadsheet library that provides rich features like Excel and Google Sheets
|
|
4
|
+
|
|
5
|
+
See our repo [leankylin-sheet](http://114.55.85.79:19999/leankylin-front/leankylin-sheet) for more information.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
Using npm:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
$ npm install --save @leankylin-sheet/react
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
or using yarn:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
$ yarn add @leankylin-sheet/react
|
|
19
|
+
```
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
type Props = React.PropsWithChildren<{
|
|
3
|
+
onClick?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>, container: HTMLDivElement) => void;
|
|
4
|
+
onMouseLeave?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>, container: HTMLDivElement) => void;
|
|
5
|
+
onMouseEnter?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>, container: HTMLDivElement) => void;
|
|
6
|
+
}>;
|
|
7
|
+
declare const Menu: React.FC<Props>;
|
|
8
|
+
export default Menu;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import "./index.css";
|
|
3
|
+
type Props = {
|
|
4
|
+
type?: "ok" | "yesno";
|
|
5
|
+
onOk?: () => void;
|
|
6
|
+
onCancel?: () => void;
|
|
7
|
+
containerStyle?: React.CSSProperties;
|
|
8
|
+
contentStyle?: React.CSSProperties;
|
|
9
|
+
children?: React.ReactNode;
|
|
10
|
+
};
|
|
11
|
+
declare const Dialog: React.FC<Props>;
|
|
12
|
+
export default Dialog;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
type ContentEditableProps = Omit<React.HTMLAttributes<HTMLDivElement>, "onChange"> & {
|
|
3
|
+
initialContent?: string;
|
|
4
|
+
innerRef?: (e: HTMLDivElement | null) => void;
|
|
5
|
+
onChange?: (html: string, isBlur?: boolean) => void;
|
|
6
|
+
onBlur?: (e: React.FocusEvent<HTMLDivElement, Element>) => void;
|
|
7
|
+
autoFocus?: boolean;
|
|
8
|
+
allowEdit?: boolean;
|
|
9
|
+
};
|
|
10
|
+
declare const ContentEditable: React.FC<ContentEditableProps>;
|
|
11
|
+
export default ContentEditable;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
type Props = {
|
|
3
|
+
tooltip: string;
|
|
4
|
+
iconId: string;
|
|
5
|
+
onClick?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
selected?: boolean;
|
|
8
|
+
children?: React.ReactNode;
|
|
9
|
+
};
|
|
10
|
+
declare const Button: React.FC<Props>;
|
|
11
|
+
export default Button;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
type Props = {
|
|
3
|
+
tooltip: string;
|
|
4
|
+
iconId?: string;
|
|
5
|
+
text?: string;
|
|
6
|
+
onClick?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
|
|
7
|
+
children: (setOpen: React.Dispatch<React.SetStateAction<boolean>>) => React.ReactNode;
|
|
8
|
+
};
|
|
9
|
+
declare const Combo: React.FC<Props>;
|
|
10
|
+
export default Combo;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
type Props = {
|
|
3
|
+
tooltip?: string;
|
|
4
|
+
onClick?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
|
|
5
|
+
selected?: boolean;
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
iconName?: string;
|
|
8
|
+
icon?: React.ReactNode;
|
|
9
|
+
};
|
|
10
|
+
declare const CustomButton: React.FC<Props>;
|
|
11
|
+
export default CustomButton;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React, { CSSProperties } from "react";
|
|
2
|
+
declare const Select: React.FC<{
|
|
3
|
+
children?: React.ReactNode;
|
|
4
|
+
style?: CSSProperties;
|
|
5
|
+
}>;
|
|
6
|
+
type OptionProps = {
|
|
7
|
+
onClick?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
|
|
8
|
+
iconId?: string;
|
|
9
|
+
onMouseLeave?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
|
|
10
|
+
onMouseEnter?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
|
|
11
|
+
};
|
|
12
|
+
declare const Option: React.FC<React.PropsWithChildren<OptionProps>>;
|
|
13
|
+
export { Option };
|
|
14
|
+
export default Select;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { api, Cell, Context, Op, Range, Selection, Presence, Settings, SingleRange, Sheet, CellMatrix, CellWithRowAndCol } from "@leankylin-sheet/core";
|
|
2
|
+
import { SetContextOptions } from "../../context";
|
|
3
|
+
export declare function generateAPIs(context: Context, setContext: (recipe: (ctx: Context) => void, options?: SetContextOptions) => void, handleUndo: () => void, handleRedo: () => void, settings: Required<Settings>, cellInput: HTMLDivElement | null, scrollbarX: HTMLDivElement | null, scrollbarY: HTMLDivElement | null): {
|
|
4
|
+
applyOp: (ops: Op[]) => void;
|
|
5
|
+
getCellValue: (row: number, column: number, options?: api.CommonOptions & {
|
|
6
|
+
type?: keyof Cell;
|
|
7
|
+
}) => any;
|
|
8
|
+
setCellValue: (row: number, column: number, value: any, options?: api.CommonOptions & {
|
|
9
|
+
type?: keyof Cell;
|
|
10
|
+
}) => void;
|
|
11
|
+
clearCell: (row: number, column: number, options?: api.CommonOptions) => void;
|
|
12
|
+
setCellFormat: (row: number, column: number, attr: keyof Cell, value: any, options?: api.CommonOptions) => void;
|
|
13
|
+
autoFillCell: (copyRange: SingleRange, applyRange: SingleRange, direction: "up" | "down" | "left" | "right") => void;
|
|
14
|
+
freeze: (type: "row" | "column" | "both", range: {
|
|
15
|
+
row: number;
|
|
16
|
+
column: number;
|
|
17
|
+
}, options?: api.CommonOptions) => void;
|
|
18
|
+
insertRowOrColumn: (type: "row" | "column", index: number, count: number, direction?: "lefttop" | "rightbottom", options?: api.CommonOptions) => void;
|
|
19
|
+
deleteRowOrColumn: (type: "row" | "column", start: number, end: number, options?: api.CommonOptions) => void;
|
|
20
|
+
setRowHeight: (rowInfo: Record<string, number>, options?: api.CommonOptions, custom?: boolean) => void;
|
|
21
|
+
setColumnWidth: (columnInfo: Record<string, number>, options?: api.CommonOptions, custom?: boolean) => void;
|
|
22
|
+
getRowHeight: (rows: number[], options?: api.CommonOptions) => Record<number, number>;
|
|
23
|
+
getColumnWidth: (columns: number[], options?: api.CommonOptions) => Record<number, number>;
|
|
24
|
+
getSelection: () => {
|
|
25
|
+
row: number[];
|
|
26
|
+
column: number[];
|
|
27
|
+
}[] | undefined;
|
|
28
|
+
getFlattenRange: (range: Range) => {
|
|
29
|
+
r: number;
|
|
30
|
+
c: number;
|
|
31
|
+
}[];
|
|
32
|
+
getCellsByFlattenRange: (range?: {
|
|
33
|
+
r: number;
|
|
34
|
+
c: number;
|
|
35
|
+
}[]) => (Cell | null)[];
|
|
36
|
+
getSelectionCoordinates: () => string[];
|
|
37
|
+
getCellsByRange: (range: Selection, options?: api.CommonOptions) => (Cell | null)[][];
|
|
38
|
+
getHtmlByRange: (range: Range, options?: api.CommonOptions) => string | null;
|
|
39
|
+
setSelection: (range: Range, options?: api.CommonOptions) => void;
|
|
40
|
+
setCellValuesByRange: (data: any[][], range: SingleRange, options?: api.CommonOptions) => void;
|
|
41
|
+
setCellFormatByRange: (attr: keyof Cell, value: any, range: Range | SingleRange, options?: api.CommonOptions) => void;
|
|
42
|
+
mergeCells: (ranges: Range, type: string, options?: api.CommonOptions) => void;
|
|
43
|
+
cancelMerge: (ranges: Range, options?: api.CommonOptions) => void;
|
|
44
|
+
getAllSheets: () => Sheet[];
|
|
45
|
+
getSheet: (options?: api.CommonOptions) => {
|
|
46
|
+
celldata: CellWithRowAndCol[];
|
|
47
|
+
name: string;
|
|
48
|
+
config?: import("@leankylin-sheet/core").SheetConfig | undefined;
|
|
49
|
+
order?: number | undefined;
|
|
50
|
+
color?: string | undefined;
|
|
51
|
+
data?: CellMatrix | undefined;
|
|
52
|
+
id?: string | undefined;
|
|
53
|
+
images?: import("@leankylin-sheet/core").Image[] | undefined;
|
|
54
|
+
zoomRatio?: number | undefined;
|
|
55
|
+
column?: number | undefined;
|
|
56
|
+
row?: number | undefined;
|
|
57
|
+
addRows?: number | undefined;
|
|
58
|
+
status?: number | undefined;
|
|
59
|
+
hide?: number | undefined;
|
|
60
|
+
luckysheet_select_save?: Selection[] | undefined;
|
|
61
|
+
luckysheet_selection_range?: {
|
|
62
|
+
row: number[];
|
|
63
|
+
column: number[];
|
|
64
|
+
}[] | undefined;
|
|
65
|
+
calcChain?: any[] | undefined;
|
|
66
|
+
defaultRowHeight?: number | undefined;
|
|
67
|
+
defaultColWidth?: number | undefined;
|
|
68
|
+
showGridLines?: number | boolean | undefined;
|
|
69
|
+
pivotTable?: any;
|
|
70
|
+
isPivotTable?: boolean | undefined;
|
|
71
|
+
filter?: Record<string, any> | undefined;
|
|
72
|
+
filter_select?: {
|
|
73
|
+
row: number[];
|
|
74
|
+
column: number[];
|
|
75
|
+
} | undefined;
|
|
76
|
+
luckysheet_conditionformat_save?: any[] | undefined;
|
|
77
|
+
luckysheet_alternateformat_save?: any[] | undefined;
|
|
78
|
+
dataVerification?: any;
|
|
79
|
+
hyperlink?: Record<string, {
|
|
80
|
+
linkType: string;
|
|
81
|
+
linkAddress: string;
|
|
82
|
+
}> | undefined;
|
|
83
|
+
dynamicArray_compute?: any;
|
|
84
|
+
dynamicArray?: any[] | undefined;
|
|
85
|
+
frozen?: {
|
|
86
|
+
type: "row" | "column" | "both" | "rangeRow" | "rangeColumn" | "rangeBoth";
|
|
87
|
+
range?: {
|
|
88
|
+
row_focus: number;
|
|
89
|
+
column_focus: number;
|
|
90
|
+
} | undefined;
|
|
91
|
+
} | undefined;
|
|
92
|
+
};
|
|
93
|
+
addSheet: () => void;
|
|
94
|
+
deleteSheet: (options?: api.CommonOptions) => void;
|
|
95
|
+
updateSheet: (data: Sheet[]) => void;
|
|
96
|
+
activateSheet: (options?: api.CommonOptions) => void;
|
|
97
|
+
setSheetName: (name: string, options?: api.CommonOptions) => void;
|
|
98
|
+
setSheetOrder: (orderList: Record<string, number>) => void;
|
|
99
|
+
scroll: (options: {
|
|
100
|
+
scrollLeft?: number;
|
|
101
|
+
scrollTop?: number;
|
|
102
|
+
targetRow?: number;
|
|
103
|
+
targetColumn?: number;
|
|
104
|
+
}) => void;
|
|
105
|
+
addPresences: (newPresences: Presence[]) => void;
|
|
106
|
+
removePresences: (arr: {
|
|
107
|
+
username: string;
|
|
108
|
+
userId?: string;
|
|
109
|
+
}[]) => void;
|
|
110
|
+
handleUndo: () => void;
|
|
111
|
+
handleRedo: () => void;
|
|
112
|
+
calculateFormula: () => void;
|
|
113
|
+
dataToCelldata: (data: CellMatrix | undefined) => CellWithRowAndCol[];
|
|
114
|
+
celldataToData: (celldata: CellWithRowAndCol[], rowCount?: number, colCount?: number) => CellMatrix | null;
|
|
115
|
+
};
|